Mesa (master): r300g: implement depth clamp

Marek Olšák mareko at kemper.freedesktop.org
Wed Jul 21 20:54:55 UTC 2010


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

Author: Marek Olšák <maraeo at gmail.com>
Date:   Tue Jul 20 16:37:22 2010 +0200

r300g: implement depth clamp

Depth clamping seems to be implicit if clipping is disabled.

It's not perfect, but it's good enough for wine and passes
the corresponding piglit tests.

---

 src/gallium/drivers/r300/r300_screen.c |    1 +
 src/gallium/drivers/r300/r300_state.c  |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 9c73ffc..5a11b98 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -115,6 +115,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         case PIPE_CAP_TEXTURE_MIRROR_REPEAT:
         case PIPE_CAP_BLEND_EQUATION_SEPARATE:
         case PIPE_CAP_TEXTURE_SWIZZLE:
+        case PIPE_CAP_DEPTH_CLAMP:
             return 1;
 
         /* Unsupported features (boolean caps). */
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 0bbc022..f52265b 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -440,7 +440,8 @@ static void r300_set_clip_state(struct pipe_context* pipe,
            OUT_CB_TABLE(state->ucp, state->nr * 4);
         }
         OUT_CB_REG(R300_VAP_CLIP_CNTL, ((1 << state->nr) - 1) |
-                R300_PS_UCP_MODE_CLIP_AS_TRIFAN);
+                R300_PS_UCP_MODE_CLIP_AS_TRIFAN |
+                (state->depth_clamp ? R300_CLIP_DISABLE : 0));
         END_CB;
 
         r300->clip_state.dirty = TRUE;




More information about the mesa-commit mailing list