[Mesa-dev] [PATCH 1/2] meta: Don't do srgb to linear decode when blitting srgb textures.
Brian Paul
brian.e.paul at gmail.com
Wed Jun 1 13:35:23 PDT 2011
On Wed, Jun 1, 2011 at 2:17 PM, Eric Anholt <eric at anholt.net> wrote:
> Fixes the GL_SRGB8_ALPHA8 -> GL_RGBA8 blits in fbo-srgb-blit.c
> ---
> src/mesa/drivers/common/meta.c | 10 ++++++++++
> 1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index 08b6024..a0d4b9e 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -1186,6 +1186,7 @@ blitframebuffer_texture(struct gl_context *ctx,
> const GLint maxLevelSave = texObj->MaxLevel;
> const GLenum wrapSSave = texObj->Sampler.WrapS;
> const GLenum wrapTSave = texObj->Sampler.WrapT;
> + const GLenum srgbSave = texObj->Sampler.sRGBDecode;
> const GLenum target = texObj->Target;
>
> if (drawAtt->Texture == readAtt->Texture) {
> @@ -1217,6 +1218,12 @@ blitframebuffer_texture(struct gl_context *ctx,
> }
> _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
> _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
> +
> + if (ctx->Extensions.EXT_texture_sRGB_decode) {
> + _mesa_TexParameteri(target, GL_TEXTURE_SRGB_DECODE_EXT,
> + GL_SKIP_DECODE_EXT);
> + }
> +
> _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
> _mesa_set_enable(ctx, target, GL_TRUE);
>
> @@ -1278,6 +1285,9 @@ blitframebuffer_texture(struct gl_context *ctx,
> }
> _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, wrapSSave);
> _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, wrapTSave);
> + if (ctx->Extensions.EXT_texture_sRGB_decode) {
> + _mesa_TexParameteri(target, GL_TEXTURE_SRGB_DECODE_EXT, srgbSave);
> + }
>
> /* Done with color buffer */
> mask &= ~GL_COLOR_BUFFER_BIT;
> --
> 1.7.5.1
For the series: Reviewed-by: Brian Paul <brianp at vmware.com>
-Brian
More information about the mesa-dev
mailing list