summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/cell/spu/spu_per_fragment_op.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/cell/spu/spu_per_fragment_op.c')
-rw-r--r--src/gallium/drivers/cell/spu/spu_per_fragment_op.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/src/gallium/drivers/cell/spu/spu_per_fragment_op.c b/src/gallium/drivers/cell/spu/spu_per_fragment_op.c
index db88735226..29dc07a2e8 100644
--- a/src/gallium/drivers/cell/spu/spu_per_fragment_op.c
+++ b/src/gallium/drivers/cell/spu/spu_per_fragment_op.c
@@ -144,18 +144,22 @@ write_ds_quad(tile_t *buffer, unsigned x, unsigned y,
case PIPE_FORMAT_Z24S8_UNORM: {
qword *ptr = (qword *) &buffer->ui4[iy][ix];
+ /* form select mask = 1110,1110,1110,1110 */
qword mask = si_fsmbi(0xEEEE);
-
+ /* depth[i] = depth[i] << 8 */
depth = si_shli(depth, 8);
+ /* *ptr[i] = depth[i][31:8] | stencil[i][7:0] */
*ptr = si_selb(stencil, depth, mask);
break;
}
case PIPE_FORMAT_S8Z24_UNORM: {
qword *ptr = (qword *) &buffer->ui4[iy][ix];
+ /* form select mask = 0111,0111,0111,0111 */
qword mask = si_fsmbi(0x7777);
-
+ /* stencil[i] = stencil[i] << 24 */
stencil = si_shli(stencil, 24);
+ /* *ptr[i] = stencil[i][31:24] | depth[i][23:0] */
*ptr = si_selb(stencil, depth, mask);
break;
}
@@ -191,25 +195,13 @@ spu_do_depth_stencil(int x, int y,
read_ds_quad(&spu.ztile, x, y, spu.fb.depth_format,
&pixel_depth, &pixel_stencil);
}
-
- switch (spu.fb.depth_format) {
- case PIPE_FORMAT_Z16_UNORM:
- frag_depth = si_fm(frag_depth, (qword)spu_splats((float)(0x0000ffffu)));
- frag_depth = si_cfltu(frag_depth, 0);
- break;
- case PIPE_FORMAT_Z32_UNORM:
- frag_depth = si_fm(frag_depth, (qword)spu_splats((float)(0xffffffffu)));
- frag_depth = si_cfltu(frag_depth, 0);
- break;
- case PIPE_FORMAT_Z24S8_UNORM:
- case PIPE_FORMAT_S8Z24_UNORM:
- frag_depth = si_fm(frag_depth, (qword)spu_splats((float)(0x00ffffffu)));
- frag_depth = si_cfltu(frag_depth, 0);
- break;
- default:
- ASSERT(0);
- break;
- }
+
+ /* convert floating point Z values to 32-bit uint */
+
+ /* frag_depth *= spu.fb.zscale */
+ frag_depth = si_fm(frag_depth, (qword)spu_splats(spu.fb.zscale));
+ /* frag_depth = uint(frag_depth) */
+ frag_depth = si_cfltu(frag_depth, 0);
result = (*spu.frag_test)(frag_mask, pixel_depth, pixel_stencil,
frag_depth, frag_alpha, facing);