softpipe: make z/s test always pass if no zsbuf, instead of crashing
authorLuca Barbieri <luca@luca-barbieri.com>
Mon, 20 Sep 2010 17:22:44 +0000 (19:22 +0200)
committerLuca Barbieri <luca@luca-barbieri.com>
Mon, 20 Sep 2010 18:23:35 +0000 (20:23 +0200)
D3D10 specifies this.

src/gallium/drivers/softpipe/sp_quad_depth_test.c

index 5590d4089291f0ceebfae31deeb3ce12eb1fb365..425fecd5da18d337982ce55d44b7e192dbf41b5c 100644 (file)
@@ -695,8 +695,9 @@ depth_test_quads_fallback(struct quad_stage *qs,
       nr = alpha_test_quads(qs, quads, nr);
    }
 
-   if (qs->softpipe->depth_stencil->depth.enabled ||
-       qs->softpipe->depth_stencil->stencil[0].enabled) {
+   if (qs->softpipe->framebuffer.zsbuf &&
+       (qs->softpipe->depth_stencil->depth.enabled ||
+       qs->softpipe->depth_stencil->stencil[0].enabled)) {
 
       data.ps = qs->softpipe->framebuffer.zsbuf;
       data.format = data.ps->format;
@@ -805,6 +806,9 @@ choose_depth_test(struct quad_stage *qs,
 
    boolean occlusion = qs->softpipe->active_query_count;
 
+   if(!qs->softpipe->framebuffer.zsbuf)
+      depth = depthwrite = stencil = FALSE;
+
    /* default */
    qs->run = depth_test_quads_fallback;