Mesa (master): gallium/util: Clean up the Z/S tile write path.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 7 18:47:18 UTC 2020


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

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Jul  1 16:32:37 2020 -0700

gallium/util: Clean up the Z/S tile write path.

The switch statement is silly, we have a helper to detect all of Z/S.
And, take the time explain why all of Z/S tile writing is unimplemented.

Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5728>

---

 src/gallium/auxiliary/util/u_tile.c | 37 ++++++++++---------------------------
 1 file changed, 10 insertions(+), 27 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c
index daea31cfd56..c7cea07c870 100644
--- a/src/gallium/auxiliary/util/u_tile.c
+++ b/src/gallium/auxiliary/util/u_tile.c
@@ -365,6 +365,12 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
    if (u_clip_tile(x, y, &w, &h, &pt->box))
       return;
 
+   /* While we do generate RGBA tiles for z/s for softpipe's texture fetch
+    * path, we never have to store from "RGBA" to Z/S.
+    */
+   if (util_format_is_depth_or_stencil(format))
+      return;
+
    if (util_format_is_pure_uint(format)) {
       util_format_write_4ui(format,
                             p, src_stride * sizeof(float),
@@ -376,33 +382,10 @@ pipe_put_tile_rgba(struct pipe_transfer *pt,
                            dst, pt->stride,
                            x, y, w, h);
    } else {
-      switch (format) {
-      case PIPE_FORMAT_Z16_UNORM:
-         /*z16_put_tile_rgba((ushort *) dst, w, h, p, src_stride);*/
-         break;
-      case PIPE_FORMAT_Z32_UNORM:
-         /*z32_put_tile_rgba((unsigned *) dst, w, h, p, src_stride);*/
-         break;
-      case PIPE_FORMAT_Z24_UNORM_S8_UINT:
-      case PIPE_FORMAT_Z24X8_UNORM:
-         /*s8z24_put_tile_rgba((unsigned *) dst, w, h, p, src_stride);*/
-         break;
-      case PIPE_FORMAT_S8_UINT_Z24_UNORM:
-      case PIPE_FORMAT_X8Z24_UNORM:
-         /*z24s8_put_tile_rgba((unsigned *) dst, w, h, p, src_stride);*/
-         break;
-      case PIPE_FORMAT_Z32_FLOAT:
-         /*z32f_put_tile_rgba((unsigned *) dst, w, h, p, src_stride);*/
-         break;
-      case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
-         /*z32f_s8x24_put_tile_rgba((unsigned *) dst, w, h, p, src_stride);*/
-         break;
-      default:
-         util_format_write_4f(format,
-                              p, src_stride * sizeof(float),
-                              dst, pt->stride,
-                              x, y, w, h);
-      }
+      util_format_write_4f(format,
+                           p, src_stride * sizeof(float),
+                           dst, pt->stride,
+                           x, y, w, h);
    }
 }
 



More information about the mesa-commit mailing list