Module: Mesa
Branch: master
Commit: 527bf67682db70091abf9c5395433bf9b8b98aab
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=527bf67682db70091abf9c5395433bf9b8b98aab

Author: Dave Airlie <airl...@gmail.com>
Date:   Thu Jan 13 17:22:54 2011 +1000

gallium: add EXT_texture_sRGB_decode.

This uses a sampler view to access the texture with the alternate format.

Signed-off-by: Dave Airlie <airl...@redhat.com>

---

 src/mesa/state_tracker/st_atom_texture.c |    4 ++++
 src/mesa/state_tracker/st_extensions.c   |    1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_texture.c 
b/src/mesa/state_tracker/st_atom_texture.c
index 029b040..422ae43 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -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;
 
diff --git a/src/mesa/state_tracker/st_extensions.c 
b/src/mesa/state_tracker/st_extensions.c
index aead592..abaf823 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -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,

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to