mesa: fix shadow sampling unit issue.

texture comparison logic is bypassed if the currently bound texture is not
a depth/depth_stencil texture.
This commit is contained in:
Xiang, Haihao 2008-11-20 16:54:16 +08:00
parent 1412ca0be2
commit b6bb5e09e0
1 changed files with 6 additions and 1 deletions

View File

@ -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;