Mesa (gallium-0.2): mesa: fix shadow sampling unit issue.

Alan Hourihane alanh at kemper.freedesktop.org
Thu Nov 20 13:44:24 UTC 2008


Module: Mesa
Branch: gallium-0.2
Commit: b6bb5e09e0ad1f61f96c65bbc870bd493df12f1a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6bb5e09e0ad1f61f96c65bbc870bd493df12f1a

Author: Xiang, Haihao <haihao.xiang at intel.com>
Date:   Thu Nov 20 16:54:16 2008 +0800

mesa: fix shadow sampling unit issue.

texture comparison logic is bypassed if the currently bound texture is not
a depth/depth_stencil texture.

---

 src/mesa/main/texenvprogram.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index dcd7f90..ba7ce4a 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -213,16 +213,21 @@ static void make_state_key( GLcontext *ctx,  struct state_key *key )
 
    for (i=0;i<MAX_TEXTURE_UNITS;i++) {
       const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
+      GLenum format;
 
       if (!texUnit->_ReallyEnabled || !texUnit->Enabled)
          continue;
 
+      format = texUnit->_Current->Image[0][texUnit->_Current->BaseLevel]->_BaseFormat;
+
       key->unit[i].enabled = 1;
       key->enabled_units |= (1<<i);
 
       key->unit[i].source_index = 
 	 translate_tex_src_bit(texUnit->_ReallyEnabled);		
-      key->unit[i].shadow = texUnit->_Current->CompareMode == GL_COMPARE_R_TO_TEXTURE;
+      key->unit[i].shadow = ((texUnit->_Current->CompareMode == GL_COMPARE_R_TO_TEXTURE) && 
+                             ((format == GL_DEPTH_COMPONENT) || 
+                              (format == GL_DEPTH_STENCIL_EXT)));
 
       key->unit[i].NumArgsRGB = texUnit->_CurrentCombine->_NumArgsRGB;
       key->unit[i].NumArgsA = texUnit->_CurrentCombine->_NumArgsA;




More information about the mesa-commit mailing list