Mesa (master): i915g: fix shadow compare.

Stephane Marchesin marcheu at kemper.freedesktop.org
Tue Jun 28 07:59:39 UTC 2011


Module: Mesa
Branch: master
Commit: 6f62a25448b765867ca9f424870abf5108d3a96d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6f62a25448b765867ca9f424870abf5108d3a96d

Author: Stéphane Marchesin <marcheu at chromium.org>
Date:   Mon Jun 27 22:40:03 2011 -0700

i915g: fix shadow compare.

"Works" as well as i915c now.

---

 src/gallium/drivers/i915/i915_state.c         |    2 +-
 src/gallium/drivers/i915/i915_state_inlines.h |   25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index 2f5eced..7c888b7 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -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;
diff --git a/src/gallium/drivers/i915/i915_state_inlines.h b/src/gallium/drivers/i915/i915_state_inlines.h
index b589117..aa992f7 100644
--- a/src/gallium/drivers/i915/i915_state_inlines.h
+++ b/src/gallium/drivers/i915/i915_state_inlines.h
@@ -60,6 +60,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)
 {
    switch (op) {




More information about the mesa-commit mailing list