gallium: add EXT_texture_sRGB_decode.
authorDave Airlie <airlied@gmail.com>
Thu, 13 Jan 2011 07:22:54 +0000 (17:22 +1000)
committerDave Airlie <airlied@redhat.com>
Sun, 16 Jan 2011 02:54:07 +0000 (12:54 +1000)
This uses a sampler view to access the texture with the alternate format.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/state_tracker/st_atom_texture.c
src/mesa/state_tracker/st_extensions.c

index 029b0403462f6c9bca782a475217c4ef8cecd50d..422ae43585b95c39ce4157a74fc76a0864a976f9 100644 (file)
@@ -221,6 +221,10 @@ update_textures(struct st_context *st)
            firstImage = st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]);
 
            firstImageFormat = st_mesa_format_to_pipe_format(firstImage->base.TexFormat);
+           if ((stObj->base.sRGBDecode == GL_SKIP_DECODE_EXT) && (_mesa_get_format_color_encoding(firstImage->base.TexFormat) == GL_SRGB)) {
+              firstImageFormat = st_mesa_format_to_pipe_format(_mesa_get_srgb_format_linear(firstImage->base.TexFormat));
+           }
+
            if (firstImageFormat != stObj->pt->format)
               st_view_format = firstImageFormat;
 
index aead59271025af79a4a5d5d644a18800252d2e23..abaf82354166e6efad2482d753270ac275e431a6 100644 (file)
@@ -387,6 +387,7 @@ void st_init_extensions(struct st_context *st)
                                    PIPE_TEXTURE_2D, 0,
                                    PIPE_BIND_SAMPLER_VIEW, 0)) {
       ctx->Extensions.EXT_texture_sRGB = GL_TRUE;
+      ctx->Extensions.EXT_texture_sRGB_decode = GL_TRUE;
    }
 
    if (screen->is_format_supported(screen, PIPE_FORMAT_R8G8_UNORM,