From 08af5f2703ae21522aca2ec353f4ff8288e1fe5e Mon Sep 17 00:00:00 2001 From: "Juan A. Suarez Romero" Date: Mon, 26 Feb 2024 13:50:17 +0100 Subject: [PATCH] v3dv: disable Early Z for multisampled 16-bit depth buffers Besides disabling early-z when a frame is an odd width or height, we need to disable it if the buffer is 16-bit and multisampled. Reviewed-by: Iago Toral Quiroga Signed-off-by: Juan A. Suarez Romero Part-of: --- src/broadcom/vulkan/v3dvx_cmd_buffer.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/broadcom/vulkan/v3dvx_cmd_buffer.c b/src/broadcom/vulkan/v3dvx_cmd_buffer.c index 7e6c8132865..6862a6e4766 100644 --- a/src/broadcom/vulkan/v3dvx_cmd_buffer.c +++ b/src/broadcom/vulkan/v3dvx_cmd_buffer.c @@ -1826,10 +1826,11 @@ job_update_ez_state(struct v3dv_job *job, return false; } - /* GFXH-1918: the early-z buffer may load incorrect depth values - * if the frame has odd width or height. + /* GFXH-1918: the early-z buffer may load incorrect depth values if the + * frame has odd width or height, or if the buffer is 16-bit and + * multisampled. * - * So we need to disable EZ in this case. + * So we need to disable EZ in these cases. */ const struct v3dv_render_pass_attachment *ds_attachment = &state->pass->attachments[subpass->ds_attachment.attachment]; @@ -1846,6 +1847,15 @@ job_update_ez_state(struct v3dv_job *job, ds_attachment->desc.storeOp); if (needs_depth_load) { + if (ds_attachment->desc.format == VK_FORMAT_D16_UNORM && + ds_attachment->desc.samples != VK_SAMPLE_COUNT_1_BIT) { + perf_debug("Loading depth aspect from a multisampled 16-bit " + "depth buffer disables early-Z tests.\n"); + job->first_ez_state = V3D_EZ_DISABLED; + job->ez_state = V3D_EZ_DISABLED; + return false; + } + struct v3dv_framebuffer *fb = state->framebuffer; if (!fb) {