summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/cell
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
parentf3e686d24a54f65b98c9a61a952577faaf451148 (diff)
cell: Fix depth read / write for s8z24.
Stencil is still broken.
Diffstat (limited to 'src/gallium/drivers/cell')
-rw-r--r--src/gallium/drivers/cell/spu/spu_main.c1
-rw-r--r--src/gallium/drivers/cell/spu/spu_per_fragment_op.c25
2 files changed, 24 insertions, 2 deletions
diff --git a/src/gallium/drivers/cell/spu/spu_main.c b/src/gallium/drivers/cell/spu/spu_main.c
index 122cf337a6..937962285d 100644
--- a/src/gallium/drivers/cell/spu/spu_main.c
+++ b/src/gallium/drivers/cell/spu/spu_main.c
@@ -221,6 +221,7 @@ cmd_state_framebuffer(const struct cell_command_framebuffer *cmd)
switch (spu.fb.depth_format) {
case PIPE_FORMAT_Z32_UNORM:
case PIPE_FORMAT_Z24S8_UNORM:
+ case PIPE_FORMAT_S8Z24_UNORM:
spu.fb.zsize = 4;
break;
case PIPE_FORMAT_Z16_UNORM:
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;
}