aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/common
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-22 15:20:09 +0200
committermarha <marha@users.sourceforge.net>2011-09-22 15:20:09 +0200
commitc1e6c7428a8d2c1b60ffac7df7a3f56c300fa983 (patch)
tree8874978d314129a4f47ee575b076c2d8eb1a8738 /mesalib/src/mesa/drivers/common
parent37466741e35c5eb3b204863a5023bf8d192efc06 (diff)
downloadvcxsrv-c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983.tar.gz
vcxsrv-c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983.tar.bz2
vcxsrv-c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983.zip
libxtrans libX11 libX11 libXext mesa xserver git update 22 sep 2011
Diffstat (limited to 'mesalib/src/mesa/drivers/common')
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c44
1 files changed, 40 insertions, 4 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 1b71aa194..b6e80d70a 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -740,6 +740,11 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_reference_shader_program(ctx, &ctx->Shader.ActiveProgram,
save->ActiveShader);
+
+ _mesa_reference_shader_program(ctx, &save->VertexShader, NULL);
+ _mesa_reference_shader_program(ctx, &save->GeometryShader, NULL);
+ _mesa_reference_shader_program(ctx, &save->FragmentShader, NULL);
+ _mesa_reference_shader_program(ctx, &save->ActiveShader, NULL);
}
if (state & MESA_META_STENCIL_TEST) {
@@ -1223,7 +1228,7 @@ blitframebuffer_texture(struct gl_context *ctx,
GL_SKIP_DECODE_EXT);
}
if (ctx->Extensions.EXT_framebuffer_sRGB) {
- _mesa_Disable(GL_FRAMEBUFFER_SRGB_EXT);
+ _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
}
_mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
@@ -1291,7 +1296,7 @@ blitframebuffer_texture(struct gl_context *ctx,
_mesa_TexParameteri(target, GL_TEXTURE_SRGB_DECODE_EXT, srgbSave);
}
if (ctx->Extensions.EXT_framebuffer_sRGB && fbo_srgb_save) {
- _mesa_Enable(GL_FRAMEBUFFER_SRGB_EXT);
+ _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_TRUE);
}
/* Done with color buffer */
@@ -2452,6 +2457,15 @@ _mesa_meta_check_generate_mipmap_fallback(struct gl_context *ctx, GLenum target,
return GL_TRUE;
}
+ if (_mesa_get_format_color_encoding(baseImage->TexFormat) == GL_SRGB &&
+ !ctx->Extensions.EXT_texture_sRGB_decode) {
+ /* The texture format is sRGB but we can't turn off sRGB->linear
+ * texture sample conversion. So we won't be able to generate the
+ * right colors when rendering. Need to use a fallback.
+ */
+ return GL_TRUE;
+ }
+
/*
* Test that we can actually render in the texture's format.
*/
@@ -2669,6 +2683,8 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
const GLenum wrapSSave = texObj->Sampler.WrapS;
const GLenum wrapTSave = texObj->Sampler.WrapT;
const GLenum wrapRSave = texObj->Sampler.WrapR;
+ const GLenum srgbDecodeSave = texObj->Sampler.sRGBDecode;
+ const GLenum srgbBufferSave = ctx->Color.sRGBEnabled;
const GLuint fboSave = ctx->DrawBuffer->Name;
const GLuint original_active_unit = ctx->Texture.CurrentUnit;
GLenum faceTarget;
@@ -2731,6 +2747,15 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
_mesa_TexParameteri(target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
+ /* We don't want to encode or decode sRGB values; treat them as linear */
+ if (ctx->Extensions.EXT_texture_sRGB_decode) {
+ _mesa_TexParameteri(target, GL_TEXTURE_SRGB_DECODE_EXT,
+ GL_SKIP_DECODE_EXT);
+ }
+ if (ctx->Extensions.EXT_framebuffer_sRGB) {
+ _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
+ }
+
_mesa_set_enable(ctx, target, GL_TRUE);
/* setup texcoords (XXX what about border?) */
@@ -2875,6 +2900,14 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target,
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
+ if (ctx->Extensions.EXT_texture_sRGB_decode) {
+ _mesa_TexParameteri(target, GL_TEXTURE_SRGB_DECODE_EXT,
+ srgbDecodeSave);
+ }
+ if (ctx->Extensions.EXT_framebuffer_sRGB && srgbBufferSave) {
+ _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_TRUE);
+ }
+
_mesa_lock_texture(ctx, texObj); /* relock */
_mesa_meta_end(ctx);
@@ -3154,7 +3187,7 @@ decompress_texture_image(struct gl_context *ctx,
/* setup texture state */
_mesa_BindTexture(target, texObj->Name);
- _mesa_Enable(target);
+ _mesa_set_enable(ctx, target, GL_TRUE);
{
/* save texture object state */
@@ -3179,7 +3212,7 @@ decompress_texture_image(struct gl_context *ctx,
GL_SKIP_DECODE_EXT);
}
if (ctx->Extensions.EXT_framebuffer_sRGB) {
- _mesa_Disable(GL_FRAMEBUFFER_SRGB_EXT);
+ _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB_EXT, GL_FALSE);
}
/* render quad w/ texture into renderbuffer */
@@ -3205,6 +3238,9 @@ decompress_texture_image(struct gl_context *ctx,
ctx->Pack.RowLength = destRowLength;
_mesa_ReadPixels(0, 0, width, height, destFormat, destType, dest);
+ /* disable texture unit */
+ _mesa_set_enable(ctx, target, GL_FALSE);
+
_mesa_meta_end(ctx);
/* restore fbo bindings */