summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/softpipe/sp_quad_depth_test.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-07-21 16:48:45 -0600
committerBrian Paul <brianp@vmware.com>2010-07-21 16:52:01 -0600
commit7cd6a6cc995407a19254401511dafd943299b8ac (patch)
tree7edb107410b772446cc2572d3268c2f45b06844b /src/gallium/drivers/softpipe/sp_quad_depth_test.c
parentef2d10cd45c0aba00aedbd7f412af0eb24385b77 (diff)
softpipe: add missing support for PIPE_FORMAT_S8_USCALED surfaces
And remove checks of surface depth bits. The state tracker should not turn on depth/stencil testing if the framebuffer doesn't have depth/stencil.
Diffstat (limited to 'src/gallium/drivers/softpipe/sp_quad_depth_test.c')
-rw-r--r--src/gallium/drivers/softpipe/sp_quad_depth_test.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
index 72117c233e5..5590d408929 100644
--- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c
+++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c
@@ -82,7 +82,7 @@ get_depth_stencil_values( struct depth_data *data,
data->bzzzz[j] = tile->data.depth32[y][x] & 0xffffff;
data->stencilVals[j] = tile->data.depth32[y][x] >> 24;
}
- break;
+ break;
case PIPE_FORMAT_X8Z24_UNORM:
case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
for (j = 0; j < QUAD_SIZE; j++) {
@@ -92,6 +92,14 @@ get_depth_stencil_values( struct depth_data *data,
data->stencilVals[j] = tile->data.depth32[y][x] & 0xff;
}
break;
+ case PIPE_FORMAT_S8_USCALED:
+ for (j = 0; j < QUAD_SIZE; j++) {
+ int x = quad->input.x0 % TILE_SIZE + (j & 1);
+ int y = quad->input.y0 % TILE_SIZE + (j >> 1);
+ data->bzzzz[j] = 0;
+ data->stencilVals[j] = tile->data.stencil8[y][x];
+ }
+ break;
default:
assert(0);
}
@@ -227,6 +235,14 @@ write_depth_stencil_values( struct depth_data *data,
tile->data.depth32[y][x] = data->bzzzz[j] << 8;
}
break;
+ case PIPE_FORMAT_S8_USCALED:
+ for (j = 0; j < QUAD_SIZE; j++) {
+ int x = quad->input.x0 % TILE_SIZE + (j & 1);
+ int y = quad->input.y0 % TILE_SIZE + (j >> 1);
+ tile->data.stencil8[y][x] = data->stencilVals[j];
+ }
+ break;
+
default:
assert(0);
}
@@ -661,20 +677,6 @@ static unsigned mask_count[16] =
-/** helper to get number of Z buffer bits */
-static unsigned
-get_depth_bits(struct quad_stage *qs)
-{
- struct pipe_surface *zsurf = qs->softpipe->framebuffer.zsbuf;
- if (zsurf)
- return util_format_get_component_bits(zsurf->format,
- UTIL_FORMAT_COLORSPACE_ZS, 0);
- else
- return 0;
-}
-
-
-
/**
* General depth/stencil test function. Used when there's no fast-path.
*/
@@ -693,9 +695,8 @@ depth_test_quads_fallback(struct quad_stage *qs,
nr = alpha_test_quads(qs, quads, nr);
}
- if (get_depth_bits(qs) > 0 &&
- (qs->softpipe->depth_stencil->depth.enabled ||
- qs->softpipe->depth_stencil->stencil[0].enabled)) {
+ if (qs->softpipe->depth_stencil->depth.enabled ||
+ qs->softpipe->depth_stencil->stencil[0].enabled) {
data.ps = qs->softpipe->framebuffer.zsbuf;
data.format = data.ps->format;
@@ -794,8 +795,7 @@ choose_depth_test(struct quad_stage *qs,
boolean alpha = qs->softpipe->depth_stencil->alpha.enabled;
- boolean depth = (get_depth_bits(qs) > 0 &&
- qs->softpipe->depth_stencil->depth.enabled);
+ boolean depth = qs->softpipe->depth_stencil->depth.enabled;
unsigned depthfunc = qs->softpipe->depth_stencil->depth.func;