From e8fdb9fe5cb1cf65d6281561df78f3cd575bde6c Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 3 Jan 2025 16:36:16 +0200 Subject: [PATCH] anv: ensure null-rt bit in compiler isn't used when there is ds attachment Signed-off-by: Lionel Landwerlin Fixes: 15987f49bb ("anv: avoid setting up a null RT unless needed") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12396 Reviewed-by: Caio Oliveira (cherry picked from commit 98cdb9349a7fa181c3895655d217589f909a7beb) Part-of: --- .pick_status.json | 2 +- src/intel/vulkan/anv_pipeline.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index a120b8275ee..141b1611da8 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -204,7 +204,7 @@ "description": "anv: ensure null-rt bit in compiler isn't used when there is ds attachment", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "15987f49bb9ca105f7b252d90349f614c492c3d5", "notes": null diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 232a09649f5..f6dcab70617 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -531,6 +531,15 @@ rp_color_mask(const struct vk_render_pass_state *rp) color_mask |= BITFIELD_BIT(i); } + /* If there is depth/stencil attachment, even if the fragment shader + * doesn't write the depth/stencil output, we need a valid render target so + * that the compiler doesn't use the null-rt which would cull the + * depth/stencil output. + */ + if (rp->depth_attachment_format != VK_FORMAT_UNDEFINED || + rp->stencil_attachment_format != VK_FORMAT_UNDEFINED) + color_mask |= 1; + return color_mask; }