summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorNicolai Haehnle <[email protected]>2008-06-14 02:28:58 +0200
committerNicolai Haehnle <[email protected]>2008-06-14 04:15:31 +0200
commit83ad2a756ea8dd1b0ca9746e355ce3de0f29356e (patch)
treed48cd3208a3de8909dae1f5f6b7e411f962a4605 /src/mesa/main
parent2882e5162525138316db9a1ab539a17498d06da1 (diff)
texenvprogram: Mark textures using ARB_shadow as ShadowSamplers
Since ARB_fragment_program and friends are defined to ignore the setting of the GL_TEXTURE_COMPARE_FUNC parameter, we have to explicitly enable the shadow comparison by marking the texture unit in ShadowSamplers when appropriate.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/texenvprogram.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c
index af19a38c42b..512d52704d8 100644
--- a/src/mesa/main/texenvprogram.c
+++ b/src/mesa/main/texenvprogram.c
@@ -68,6 +68,7 @@ struct state_key {
struct {
GLuint enabled:1;
GLuint source_index:3; /* one of TEXTURE_1D/2D/3D/CUBE/RECT_INDEX */
+ GLuint shadow:1;
GLuint ScaleShiftRGB:2;
GLuint ScaleShiftA:2;
@@ -219,6 +220,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
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].NumArgsRGB = texUnit->_CurrentCombine->_NumArgsRGB;
key->unit[i].NumArgsA = texUnit->_CurrentCombine->_NumArgsA;
@@ -945,11 +947,13 @@ static void load_texture( struct texenv_fragment_program *p, GLuint unit )
/* TODO: Use D0_MASK_XY where possible.
*/
- if (p->state->unit[unit].enabled)
+ if (p->state->unit[unit].enabled) {
p->src_texture[unit] = emit_texld( p, OPCODE_TXP,
tmp, WRITEMASK_XYZW,
unit, dim, texcoord );
- else
+ if (p->state->unit[unit].shadow)
+ p->program->Base.ShadowSamplers |= 1 << unit;
+ } else
p->src_texture[unit] = get_zero(p);
}
}