Mesa (master): svga: fix the test for sRGB texture formats

Brian Paul brianp at kemper.freedesktop.org
Thu Sep 22 14:45:10 UTC 2011


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

Author: Brian Paul <brianp at vmware.com>
Date:   Wed Jul 27 16:08:58 2011 -0600

svga: fix the test for sRGB texture formats

The pipe_sampler_view::format field should be prefered over the resource/
texture format.  The former is used to override the texture format for
sRGB decode enable/disable, etc.

Also, use new util_format_is_srgb() helper to catch all sRGB formats.

This fixes the piglit tex-srgb test for GL_EXT_texture_sRGB_decode.

---

 src/gallium/drivers/svga/svga_pipe_sampler.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c
index 446fcc4..dcfeaac 100644
--- a/src/gallium/drivers/svga/svga_pipe_sampler.c
+++ b/src/gallium/drivers/svga/svga_pipe_sampler.c
@@ -25,6 +25,7 @@
 
 #include "util/u_inlines.h"
 #include "pipe/p_defines.h"
+#include "util/u_format.h"
 #include "util/u_math.h"
 #include "util/u_memory.h"
 #include "tgsi/tgsi_parse.h"
@@ -230,7 +231,7 @@ svga_set_fragment_sampler_views(struct pipe_context *pipe,
       if (!views[i])
          continue;
 
-      if (views[i]->texture->format == PIPE_FORMAT_B8G8R8A8_SRGB)
+      if (util_format_is_srgb(views[i]->format))
          flag_srgb |= 1 << i;
 
       if (views[i]->texture->target == PIPE_TEXTURE_1D)




More information about the mesa-commit mailing list