cell: Minor changes to make stencil not crash
authorIan Romanick <idr@us.ibm.com>
Tue, 18 Mar 2008 17:26:45 +0000 (10:26 -0700)
committerIan Romanick <idr@us.ibm.com>
Tue, 18 Mar 2008 17:28:39 +0000 (10:28 -0700)
I'm not sure these are quite correct.  The reflect demo doesn't assert
anymore, but it doesn't produce correct results either.  SPE-based
vertex shader code needs to be disabled for relfect to run.

src/gallium/drivers/cell/spu/spu_main.c
src/gallium/drivers/cell/spu/spu_tile.h

index b8bb8e9..122cf33 100644 (file)
@@ -218,12 +218,18 @@ cmd_state_framebuffer(const struct cell_command_framebuffer *cmd)
    spu.fb.width_tiles = (spu.fb.width + TILE_SIZE - 1) / TILE_SIZE;
    spu.fb.height_tiles = (spu.fb.height + TILE_SIZE - 1) / TILE_SIZE;
 
-   if (spu.fb.depth_format == PIPE_FORMAT_Z32_UNORM)
+   switch (spu.fb.depth_format) {
+   case PIPE_FORMAT_Z32_UNORM:
+   case PIPE_FORMAT_Z24S8_UNORM:
       spu.fb.zsize = 4;
-   else if (spu.fb.depth_format == PIPE_FORMAT_Z16_UNORM)
+      break;
+   case PIPE_FORMAT_Z16_UNORM:
       spu.fb.zsize = 2;
-   else
+      break;
+   default:
       spu.fb.zsize = 0;
+      break;
+   }
 
    if (spu.fb.color_format == PIPE_FORMAT_A8R8G8B8_UNORM)
       spu.color_shuffle = ((vector unsigned char) {
index 3105b84..1b54911 100644 (file)
@@ -56,13 +56,13 @@ clear_c_tile(tile_t *ctile)
 static INLINE void
 clear_z_tile(tile_t *ztile)
 {
-   if (spu.fb.depth_format == PIPE_FORMAT_Z16_UNORM) {
+   if (spu.fb.zsize == 2) {
       memset16((ushort*) ztile->us,
                spu.fb.depth_clear_value,
                TILE_SIZE * TILE_SIZE);
    }
    else {
-      ASSERT(spu.fb.depth_format == PIPE_FORMAT_Z32_UNORM);
+      ASSERT(spu.fb.zsize != 0);
       memset32((uint*) ztile->ui,
                spu.fb.depth_clear_value,
                TILE_SIZE * TILE_SIZE);