Mesa (master): vc4: Flip around the depth/stencil fields.

Eric Anholt anholt at kemper.freedesktop.org
Tue Sep 9 14:30:30 UTC 2014


Module: Mesa
Branch: master
Commit: fd6e4fccade0a5e2a4877d01a57c255a47a06200
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fd6e4fccade0a5e2a4877d01a57c255a47a06200

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Sep  5 14:23:04 2014 -0700

vc4: Flip around the depth/stencil fields.

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    |    6 +++++-
 src/gallium/drivers/vc4/vc4_formats.c |    4 ++--
 src/gallium/drivers/vc4/vc4_screen.c  |    4 ++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/vc4/vc4_draw.c b/src/gallium/drivers/vc4/vc4_draw.c
index 311be6b..d1035bb 100644
--- a/src/gallium/drivers/vc4/vc4_draw.c
+++ b/src/gallium/drivers/vc4/vc4_draw.c
@@ -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;
diff --git a/src/gallium/drivers/vc4/vc4_formats.c b/src/gallium/drivers/vc4/vc4_formats.c
index 770f8fb..004bac7 100644
--- a/src/gallium/drivers/vc4/vc4_formats.c
+++ b/src/gallium/drivers/vc4/vc4_formats.c
@@ -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)),
diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
index 49f5228..b2fa623 100644
--- a/src/gallium/drivers/vc4/vc4_screen.c
+++ b/src/gallium/drivers/vc4/vc4_screen.c
@@ -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;
         }
 




More information about the mesa-commit mailing list