r300g: implement depth clamp
authorMarek Olšák <maraeo@gmail.com>
Tue, 20 Jul 2010 14:37:22 +0000 (16:37 +0200)
committerMarek Olšák <maraeo@gmail.com>
Wed, 21 Jul 2010 20:54:34 +0000 (22:54 +0200)
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
src/gallium/drivers/r300/r300_state.c

index 9c73ffc09b2e899563b5d551cbb9278c81038484..5a11b98eb6c5c49ba026f702874919c370bee5cf 100644 (file)
@@ -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). */
index 0bbc022f837f61bbf74fac0f7e5969d028ae0769..f52265b1c03affc5ba1e107edd34dd1132158212 100644 (file)
@@ -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;