softpipe: add support for PIPE_FORMAT_X8Z24_UNORM, PIPE_FORMAT_Z24X8_UNORM
authorBrian Paul <brian.paul@tungstengraphics.com>
Thu, 7 Aug 2008 21:05:13 +0000 (15:05 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Thu, 7 Aug 2008 21:14:52 +0000 (15:14 -0600)
src/gallium/drivers/softpipe/sp_quad_depth_test.c
src/gallium/drivers/softpipe/sp_tile_cache.c

index 33888abcc5ecbc0987a85907bfb8c232f690fe33..0c82692c6ee40c90f1e2efc928a0318cd960fcc4 100644 (file)
@@ -104,6 +104,8 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
          }
       }
       break;
+   case PIPE_FORMAT_X8Z24_UNORM:
+      /* fall-through */
    case PIPE_FORMAT_S8Z24_UNORM:
       {
          float scale = (float) ((1 << 24) - 1);
@@ -119,6 +121,8 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
          }
       }
       break;
+   case PIPE_FORMAT_Z24X8_UNORM:
+      /* fall-through */
    case PIPE_FORMAT_Z24S8_UNORM:
       {
          float scale = (float) ((1 << 24) - 1);
@@ -209,6 +213,9 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
             tile->data.depth16[y][x] = (ushort) bzzzz[j];
          }
          break;
+      case PIPE_FORMAT_X8Z24_UNORM:
+         /* fall-through */
+         /* (yes, this falls through to a different case than above) */
       case PIPE_FORMAT_Z32_UNORM:
          for (j = 0; j < QUAD_SIZE; j++) {
             int x = quad->x0 % TILE_SIZE + (j & 1);
@@ -234,6 +241,13 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
             tile->data.depth32[y][x] = z24s8;
          }
          break;
+      case PIPE_FORMAT_Z24X8_UNORM:
+         for (j = 0; j < QUAD_SIZE; j++) {
+            int x = quad->x0 % TILE_SIZE + (j & 1);
+            int y = quad->y0 % TILE_SIZE + (j >> 1);
+            tile->data.depth32[y][x] = bzzzz[j] << 8;
+         }
+         break;
       default:
          assert(0);
       }
index 5d10234945fc4a3077f7246398aa0ea1e2b9e498..57c12ffe335a41f6a9a64bee5748ca50719f4444 100644 (file)
@@ -170,7 +170,9 @@ sp_tile_cache_set_surface(struct softpipe_tile_cache *tc,
                                                    PIPE_BUFFER_USAGE_CPU_WRITE);
 
       tc->depth_stencil = (ps->format == PIPE_FORMAT_S8Z24_UNORM ||
+                           ps->format == PIPE_FORMAT_X8Z24_UNORM ||
                            ps->format == PIPE_FORMAT_Z24S8_UNORM ||
+                           ps->format == PIPE_FORMAT_Z24X8_UNORM ||
                            ps->format == PIPE_FORMAT_Z16_UNORM ||
                            ps->format == PIPE_FORMAT_Z32_UNORM ||
                            ps->format == PIPE_FORMAT_S8_UNORM);