}
if (s->state.compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) {
+ state->unit[i].compare_mode_enabled = 1;
+
/* XXX Gallium doesn't provide us with any information regarding
* this mode, so we are screwed. Let's set INTENSITY for now. */
state->unit[i].depth_texture_swizzle = RC_SWIZZLE_XYZW;
*/
unsigned texture_compare_func : 3;
+ /**
+ * No matter what the sampler type is,
+ * this field turns it into a shadow sampler.
+ */
+ unsigned compare_mode_enabled : 1;
+
/**
* If the sampler needs to fake NPOT, this field is set.
*/
/* ARB_shadow & EXT_shadow_funcs */
if (inst->U.I.Opcode != RC_OPCODE_KIL &&
- c->Program.ShadowSamplers & (1 << inst->U.I.TexSrcUnit)) {
+ ((c->Program.ShadowSamplers & (1 << inst->U.I.TexSrcUnit)) ||
+ (compiler->state.unit[inst->U.I.TexSrcUnit].compare_mode_enabled))) {
rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func;
if (comparefunc == RC_COMPARE_FUNC_NEVER || comparefunc == RC_COMPARE_FUNC_ALWAYS) {