i915g: fix shadow compare.
authorStéphane Marchesin <marcheu@chromium.org>
Tue, 28 Jun 2011 05:40:03 +0000 (22:40 -0700)
committerStéphane Marchesin <marcheu@chromium.org>
Tue, 28 Jun 2011 07:59:40 +0000 (00:59 -0700)
"Works" as well as i915c now.

src/gallium/drivers/i915/i915_state.c
src/gallium/drivers/i915/i915_state_inlines.h

index 2f5eced8abe36cf74fa387867c48411dd0f967ed..7c888b798dc05a4d62a8aa9810d9bf034c3b99c3 100644 (file)
@@ -247,7 +247,7 @@ i915_create_sampler_state(struct pipe_context *pipe,
    if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) 
    {
       cso->state[0] |= (SS2_SHADOW_ENABLE |
-                        i915_translate_compare_func(sampler->compare_func));
+                        i915_translate_shadow_compare_func(sampler->compare_func));
 
       minFilt = FILTER_4X4_FLAT;
       magFilt = FILTER_4X4_FLAT;
index b589117fbfe06bfb8a543cc25dc132a10be2035e..aa992f75c51b94d55cf4bfda77ddb94e2e79155c 100644 (file)
@@ -59,6 +59,31 @@ i915_translate_compare_func(unsigned func)
    }
 }
 
+static INLINE unsigned
+i915_translate_shadow_compare_func(unsigned func)
+{
+   switch (func) {
+   case PIPE_FUNC_NEVER:
+      return COMPAREFUNC_ALWAYS;
+   case PIPE_FUNC_LESS:
+      return COMPAREFUNC_LEQUAL;
+   case PIPE_FUNC_LEQUAL:
+      return COMPAREFUNC_LESS;
+   case PIPE_FUNC_GREATER:
+      return COMPAREFUNC_GEQUAL;
+   case PIPE_FUNC_GEQUAL:
+      return COMPAREFUNC_GREATER;
+   case PIPE_FUNC_NOTEQUAL:
+      return COMPAREFUNC_EQUAL;
+   case PIPE_FUNC_EQUAL:
+      return COMPAREFUNC_NOTEQUAL;
+   case PIPE_FUNC_ALWAYS:
+      return COMPAREFUNC_NEVER;
+   default:
+      return COMPAREFUNC_NEVER;
+   }
+}
+
 static INLINE unsigned
 i915_translate_stencil_op(unsigned op)
 {