diff options
author | marha <marha@users.sourceforge.net> | 2011-09-22 15:42:49 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2011-09-22 15:42:49 +0200 |
commit | 46d4f558531910ca1f3297da85b99334d6de2921 (patch) | |
tree | 60c37077eb160948fe317a17ec4c19bef679aa35 /mesalib/src/mesa/drivers | |
parent | 0bf6df93b9fdbb7902bf1014d605c6876a3ad035 (diff) | |
parent | c1e6c7428a8d2c1b60ffac7df7a3f56c300fa983 (diff) | |
download | vcxsrv-46d4f558531910ca1f3297da85b99334d6de2921.tar.gz vcxsrv-46d4f558531910ca1f3297da85b99334d6de2921.tar.bz2 vcxsrv-46d4f558531910ca1f3297da85b99334d6de2921.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
xorg-server/Xext/dpms.c
xorg-server/Xext/saver.c
xorg-server/Xext/security.c
xorg-server/Xext/shape.c
xorg-server/Xext/sync.c
xorg-server/Xi/opendev.c
xorg-server/fb/wfbrename.h
xorg-server/glx/glxserver.h
xorg-server/hw/xwin/winwindowswm.c
xorg-server/mi/miarc.c
xorg-server/mi/miwideline.c
xorg-server/os/io.c
xorg-server/render/mipict.c
Diffstat (limited to 'mesalib/src/mesa/drivers')
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.c | 44 | ||||
-rw-r--r-- | mesalib/src/mesa/drivers/dri/swrast/swrast_span.c | 2 |
2 files changed, 41 insertions, 5 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 */ diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c b/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c index c7d0bfdac..772d09f5a 100644 --- a/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c +++ b/mesalib/src/mesa/drivers/dri/swrast/swrast_span.c @@ -45,7 +45,7 @@ static const GLubyte kernel[16] = { #if DITHER #define DITHER_COMP(X, Y) kernel[((X) & 0x3) | (((Y) & 0x3) << 2)] -#define DITHER_CLAMP(X) (((X) < CHAN_MAX) ? (X) : CHAN_MAX) +#define DITHER_CLAMP(X) (((X) < 255) ? (X) : 255) #else #define DITHER_COMP(X, Y) 0 |