vc4: Flip around the depth/stencil fields.
authorEric Anholt <eric@anholt.net>
Fri, 5 Sep 2014 21:23:04 +0000 (14:23 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 9 Sep 2014 14:29:16 +0000 (07:29 -0700)
After implementing depth stores, it looks like this is the way things
actually are, according to hiz-depth-read-fbo-d24-s0's probes.

src/gallium/drivers/vc4/vc4_draw.c
src/gallium/drivers/vc4/vc4_formats.c
src/gallium/drivers/vc4/vc4_screen.c

index 311be6b7ec41fcec5a726ba4a01ce2c4d0f5107c..d1035bb30ab65cc42aebf4143b8f859e2579e1eb 100644 (file)
@@ -224,8 +224,12 @@ vc4_clear(struct pipe_context *pctx, unsigned buffers,
                                   color->f);
         }
 
-        if (buffers & PIPE_CLEAR_DEPTH)
+        if (buffers & PIPE_CLEAR_DEPTH) {
+                /* Though the depth buffer is stored with Z in the high 24,
+                 * for this field we just need to store it in the low 24.
+                 */
                 vc4->clear_depth = util_pack_z(PIPE_FORMAT_Z24X8_UNORM, depth);
+        }
 
         vc4->cleared |= buffers;
         vc4->resolve |= buffers;
index 770f8fb3311a60c4bace7740c6be6ffe36d4d582..004bac70c67e45674dd36efa6519303db0030540 100644 (file)
@@ -86,8 +86,8 @@ static const struct vc4_format vc4_format_table[] = {
         /* Depth sampling will be handled by doing nearest filtering and not
          * unpacking the RGBA value.
          */
-        FORMAT(Z24_UNORM_S8_UINT, NO, RGBA8888, SWIZ(X, Y, Z, W)),
-        FORMAT(Z24X8_UNORM,       NO, RGBA8888, SWIZ(X, Y, Z, W)),
+        FORMAT(S8_UINT_Z24_UNORM, NO, RGBA8888, SWIZ(X, Y, Z, W)),
+        FORMAT(X8Z24_UNORM,       NO, RGBA8888, SWIZ(X, Y, Z, W)),
 
         FORMAT(B4G4R4A4_UNORM, NO, RGBA4444, SWIZ(Y, Z, W, X)),
         FORMAT(B4G4R4X4_UNORM, NO, RGBA4444, SWIZ(Y, Z, W, 1)),
index 49f5228ab395ecfe0db621e28547a5a843c946fc..b2fa623d9c170fdb399c41aa4fef7ab22bed852a 100644 (file)
@@ -343,8 +343,8 @@ vc4_screen_is_format_supported(struct pipe_screen *pscreen,
         }
 
         if ((usage & PIPE_BIND_DEPTH_STENCIL) &&
-            (format == PIPE_FORMAT_Z24_UNORM_S8_UINT ||
-             format == PIPE_FORMAT_Z24X8_UNORM)) {
+            (format == PIPE_FORMAT_S8_UINT_Z24_UNORM ||
+             format == PIPE_FORMAT_X8Z24_UNORM)) {
                 retval |= PIPE_BIND_DEPTH_STENCIL;
         }