Mesa (main): freedreno: Fix layered rendering to just Z/S and not color.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 3 21:34:46 UTC 2021


Module: Mesa
Branch: main
Commit: 14fca01b32958b827dcce63ffa9fd66c039a7cc4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=14fca01b32958b827dcce63ffa9fd66c039a7cc4

Author: Emma Anholt <emma at anholt.net>
Date:   Wed Nov  3 12:00:09 2021 -0700

freedreno: Fix layered rendering to just Z/S and not color.

We would try to take the gmem path which can't do layered rendering.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13653>

---

 src/freedreno/ci/freedreno-a630-fails.txt      | 7 -------
 src/gallium/drivers/freedreno/a6xx/fd6_gmem.c  | 6 ++++++
 src/gallium/drivers/freedreno/freedreno_gmem.c | 2 ++
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/freedreno/ci/freedreno-a630-fails.txt b/src/freedreno/ci/freedreno-a630-fails.txt
index 7db977aa3b7..cb9a33ab795 100644
--- a/src/freedreno/ci/freedreno-a630-fails.txt
+++ b/src/freedreno/ci/freedreno-a630-fails.txt
@@ -313,10 +313,6 @@ spec at ext_packed_float@query-rgba-signed-components,Fail
 spec at ext_packed_float@texwrap formats bordercolor-swizzled,Fail
 spec at ext_packed_float@texwrap formats bordercolor-swizzled at GL_R11F_G11F_B10F- swizzled- border color only,Fail
 
-# "../src/gallium/drivers/freedreno/a6xx/fd6_gmem.c:976:emit_blit: Assertion `psurf->u.tex.first_layer == psurf->u.tex.last_layer' failed."
-spec at ext_texture_array@fbo-depth-array depth-layered-clear,Crash
-spec at ext_texture_array@fbo-depth-array stencil-layered-clear,Crash
-
 spec at ext_texture_compression_rgtc@texwrap formats bordercolor-swizzled,Fail
 spec at ext_texture_compression_rgtc@texwrap formats bordercolor-swizzled at GL_COMPRESSED_RED_RGTC1- swizzled- border color only,Fail
 spec at ext_texture_compression_rgtc@texwrap formats bordercolor-swizzled at GL_COMPRESSED_RG_RGTC2- swizzled- border color only,Fail
@@ -606,6 +602,3 @@ spec@!opengl 3.0 at clearbuffer-depth-cs-probe,Timeout
 spec@!opengl 3.0 at clearbuffer-depth,Fail
 spec@!opengl 3.0 at clearbuffer-stencil,Fail
 spec@!opengl 3.1 at primitive-restart-xfb generated,Fail
-
-# "../src/gallium/drivers/freedreno/a6xx/fd6_gmem.c:976:emit_blit: Assertion `psurf->u.tex.first_layer == psurf->u.tex.last_layer' failed."
-spec@!opengl 3.2 at layered-rendering@clear-depth,Crash
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
index ed8f4f387ca..d6a316c1843 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_gmem.c
@@ -78,6 +78,10 @@ emit_mrt(struct fd_ringbuffer *ring, struct pipe_framebuffer_state *pfb,
    unsigned srgb_cntl = 0;
    unsigned i;
 
+   /* Note, GLES 3.2 says "If the fragment’s layer number is negative, or
+    * greater than or equal to the minimum number of layers of any attachment,
+    * the effects of the fragment on the framebuffer contents are undefined."
+    */
    unsigned max_layer_index = 0;
    enum a6xx_format mrt0_format = 0;
 
@@ -139,6 +143,8 @@ emit_mrt(struct fd_ringbuffer *ring, struct pipe_framebuffer_state *pfb,
       if (i == 0)
          mrt0_format = format;
    }
+   if (pfb->zsbuf)
+      max_layer_index = pfb->zsbuf->u.tex.last_layer - pfb->zsbuf->u.tex.first_layer;
 
    OUT_REG(ring, A6XX_GRAS_LRZ_MRT_BUF_INFO_0(.color_format = mrt0_format));
 
diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c
index dbdc63faec0..f55ad42021c 100644
--- a/src/gallium/drivers/freedreno/freedreno_gmem.c
+++ b/src/gallium/drivers/freedreno/freedreno_gmem.c
@@ -709,6 +709,8 @@ fd_gmem_render_tiles(struct fd_batch *batch)
       if (psurf->u.tex.first_layer < psurf->u.tex.last_layer)
          sysmem = true;
    }
+   if (pfb->zsbuf && pfb->zsbuf->u.tex.first_layer < pfb->zsbuf->u.tex.last_layer)
+      sysmem = true;
 
    /* Tessellation doesn't seem to support tiled rendering so fall back to
     * bypass.



More information about the mesa-commit mailing list