From 2e40b2c15503759b7320c79bfe7ae9b9dadfb43f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 20 Jul 2020 13:41:34 +1000 Subject: [PATCH] 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" Reviewed-by: Roland Scheidegger Part-of: --- src/gallium/drivers/llvmpipe/lp_surface.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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); -- 2.30.2