radv: fix RB+ for depth-only with unused attachments

When there are no color outputs in the rendering state, but color write
enable/write aren't masked out (which seems legal with
VK_EXT_dynamic_rendering_unused_attachments), the driver must emit
CB_DISABLE to disable CB rendering completely.

Otherwise, if there is also a depth/stencil attachment in the rendering
state, CB0 is always set to 32_R for RB+. That means, the pixel shader
would still export fragments but to the previously bound color
attachment.

VKCTS is missing coverage.

Fixes: 4580293ab2 ("radv: implement RB+ depth-only rendering for better perf")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14319
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38509>
This commit is contained in:
Samuel Pitoiset 2025-11-18 16:14:53 +01:00 committed by Marge Bot
parent 5db246a5ba
commit 168a8d0b52

View file

@ -12039,7 +12039,7 @@ radv_emit_cb_render_state(struct radv_cmd_buffer *cmd_buffer)
if (cmd_buffer->state.custom_blend_mode) {
cb_color_control |= S_028808_MODE(cmd_buffer->state.custom_blend_mode);
} else {
if (d->color_write_mask) {
if (render->color_att_count > 0 && d->color_write_mask) {
cb_color_control |= S_028808_MODE(V_028808_CB_NORMAL);
} else {
cb_color_control |= S_028808_MODE(V_028808_CB_DISABLE);