summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/cell/spu/spu_per_fragment_op.c
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2008-03-18 11:47:37 -0700
committerIan Romanick <idr@us.ibm.com>2008-03-18 11:47:37 -0700
commit17b234ae3319d8a36afc44d0cceb30fea6b42d67 (patch)
tree972c26e7e484b23aa2d6e80ea41c98d5edc1d5c4 /src/gallium/drivers/cell/spu/spu_per_fragment_op.c
parentf3e686d24a54f65b98c9a61a952577faaf451148 (diff)
cell: Fix depth read / write for s8z24.
Stencil is still broken.
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.c25
1 files changed, 23 insertions, 2 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 d42b522b41..06d68f5604 100644
--- a/src/gallium/drivers/cell/spu/spu_per_fragment_op.c
+++ b/src/gallium/drivers/cell/spu/spu_per_fragment_op.c
@@ -77,6 +77,16 @@ read_ds_quad(tile_t *buffer, unsigned x, unsigned y,
case PIPE_FORMAT_Z24S8_UNORM: {
qword *ptr = (qword *) &buffer->ui4[iy][ix];
+ qword mask = si_fsmbi(0xEEEE);
+
+ *depth = si_rotmai(si_and(*ptr, mask), -8);
+ *stencil = si_andc(*ptr, mask);
+ break;
+ }
+
+
+ case PIPE_FORMAT_S8Z24_UNORM: {
+ qword *ptr = (qword *) &buffer->ui4[iy][ix];
qword mask = si_fsmbi(0x7777);
*depth = si_and(*ptr, mask);
@@ -125,9 +135,19 @@ write_ds_quad(tile_t *buffer, unsigned x, unsigned y,
case PIPE_FORMAT_Z24S8_UNORM: {
qword *ptr = (qword *) &buffer->ui4[iy][ix];
+ qword mask = si_fsmbi(0xEEEE);
+
+ depth = si_shli(depth, 8);
+ *ptr = si_selb(stencil, depth, mask);
+ break;
+ }
+
+
+ case PIPE_FORMAT_S8Z24_UNORM: {
+ qword *ptr = (qword *) &buffer->ui4[iy][ix];
qword mask = si_fsmbi(0x7777);
- stencil = si_rotmai(stencil, 24);
+ stencil = si_shli(stencil, 24);
*ptr = si_selb(stencil, depth, mask);
break;
}
@@ -167,11 +187,12 @@ spu_do_depth_stencil(int x, int y,
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);
+ ASSERT(0);
break;
}