Mesa (staging/20.2): llvmpipe/blit: for 32-bit unorm depth blits just copy 32-bit

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 18 17:43:33 UTC 2020


Module: Mesa
Branch: staging/20.2
Commit: 81b1dcf83a9a708787d4c62b10caf987240d75f1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=81b1dcf83a9a708787d4c62b10caf987240d75f1

Author: Dave Airlie <airlied at redhat.com>
Date:   Mon Jul 20 13:41:34 2020 +1000

llvmpipe/blit: for 32-bit unorm depth blits just copy 32-bit

Don't have the shader do a 32-bit unorn to float conversion,
the values don't remain accurate then.

Fixes:
GTF-GL45.gtf30.GL3Tests.framebuffer_blit.framebuffer_blit_functionality_multisampled_to_singlesampled_blit
for 32-bit unorm depth buffers.

Cc: "20.2" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6044>
(cherry picked from commit 2e40b2c15503759b7320c79bfe7ae9b9dadfb43f)

---

 .pick_status.json                         | 2 +-
 src/gallium/drivers/llvmpipe/lp_surface.c | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index a872686f8b5..7bf5bc6d514 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -265,7 +265,7 @@
         "description": "llvmpipe/blit: for 32-bit unorm depth blits just copy 32-bit",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c
index c95892c6652..2a60d86c996 100644
--- a/src/gallium/drivers/llvmpipe/lp_surface.c
+++ b/src/gallium/drivers/llvmpipe/lp_surface.c
@@ -132,6 +132,15 @@ static void lp_blit(struct pipe_context *pipe,
       return;
    }
 
+   /* for 32-bit unorm depth, avoid the conversions to float and back,
+      which can introduce accuracy errors. */
+   if (blit_info->src.format == PIPE_FORMAT_Z32_UNORM &&
+       blit_info->dst.format == PIPE_FORMAT_Z32_UNORM && info.filter == PIPE_TEX_FILTER_NEAREST) {
+      info.src.format = PIPE_FORMAT_R32_UINT;
+      info.dst.format = PIPE_FORMAT_R32_UINT;
+      info.mask = PIPE_MASK_R;
+   }
+
    /* XXX turn off occlusion and streamout queries */
 
    util_blitter_save_vertex_buffer_slot(lp->blitter, lp->vertex_buffer);



More information about the mesa-commit mailing list