r300g: respect compare mode regardless of sampler type
authorMarek Olšák <maraeo@gmail.com>
Sat, 8 May 2010 03:59:28 +0000 (05:59 +0200)
committerMarek Olšák <maraeo@gmail.com>
Sat, 8 May 2010 21:03:45 +0000 (23:03 +0200)
src/gallium/drivers/r300/r300_fs.c
src/mesa/drivers/dri/r300/compiler/radeon_code.h
src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c

index 5173e2cf6d04aa17f0cc0666349237bd9be09e80..19023457bf3528f6b461c5bc4cc90a35a3756fee 100644 (file)
@@ -146,6 +146,8 @@ static void get_external_state(
         }
 
         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;
index 17703a9ad3826f07fd5767c4d33837a863d69fd7..1979e7e4e49707f79c5549207dfe63acb82adb5a 100644 (file)
@@ -143,6 +143,12 @@ struct r300_fragment_program_external_state {
                 */
                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.
                 */
index 53154f7fbb8ea23731e95c34136f1681e2638d82..42c08cd550537a0499487c5b031d613773557790 100644 (file)
@@ -97,7 +97,8 @@ int radeonTransformTEX(
 
        /* 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) {