Mesa (master): mesa/ff_shader: Fix sampler state reading

Eric Anholt anholt at kemper.freedesktop.org
Wed Aug 1 23:04:34 UTC 2012


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

Author: Pauli Nieminen <pauli.nieminen at linux.intel.com>
Date:   Tue Jun 12 21:38:53 2012 +0300

mesa/ff_shader: Fix sampler state reading

Fixed function fragment shader generator was incorrectly read texture
sampling state directly from texture object. To make sure that
ARB_sampler_object works correctly shader generator has to use the
bound sampler if one exist.

Signed-off-by: Pauli Nieminen <pauli.nieminen at linux.intel.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/main/ff_fragment_shader.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp
index 0233f38..f743ce1 100644
--- a/src/mesa/main/ff_fragment_shader.cpp
+++ b/src/mesa/main/ff_fragment_shader.cpp
@@ -33,6 +33,7 @@ extern "C" {
 #include "mtypes.h"
 #include "main/uniforms.h"
 #include "main/macros.h"
+#include "main/samplerobj.h"
 #include "program/program.h"
 #include "program/prog_parameter.h"
 #include "program/prog_cache.h"
@@ -428,11 +429,13 @@ static GLuint make_state_key( struct gl_context *ctx,  struct state_key *key )
       const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
       const struct gl_texture_object *texObj = texUnit->_Current;
       const struct gl_tex_env_combine_state *comb = texUnit->_CurrentCombine;
+      const struct gl_sampler_object *samp;
       GLenum format;
 
       if (!texUnit->_ReallyEnabled || !texUnit->Enabled)
          continue;
 
+      samp = _mesa_get_samplerobj(ctx, i);
       format = texObj->Image[0][texObj->BaseLevel]->_BaseFormat;
 
       key->unit[i].enabled = 1;
@@ -444,7 +447,7 @@ static GLuint make_state_key( struct gl_context *ctx,  struct state_key *key )
          translate_tex_src_bit(texUnit->_ReallyEnabled);
 
       key->unit[i].shadow =
-         ((texObj->Sampler.CompareMode == GL_COMPARE_R_TO_TEXTURE) &&
+         ((samp->CompareMode == GL_COMPARE_R_TO_TEXTURE) &&
           ((format == GL_DEPTH_COMPONENT) || 
            (format == GL_DEPTH_STENCIL_EXT)));
 




More information about the mesa-commit mailing list