nvk: Use rendering state attachment count when setting SET_CT_SELECT

In case vk_color_attachment_location_state is in its default state, we
would end up with an identity mapping for color_map resulting in 8 RTs
being selected instead of what is really required.

This now use the rendering state attachment count to properly emit
SET_CT_SELECT.

Found while debugging MRT on
"dEQP-VK.shader_object.rendering.color_attachment_count_1.extra_attachment_after_1.none.none.same_color_formats.after.none.r16g16_sint_d32_sfloat_s8_uint"
and while comparing with the proprietary driver.

Signed-off-by: Mary Guillemard <mary@mary.zone>
Fixes: 84de6c12b2 ("nvk: Emit SET_CT_SELECT based on the dynamic color location map")
Reviewed-by: Mel Henning <mhenning@darkrefraction.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38946>
This commit is contained in:
Mary Guillemard
2025-11-25 17:55:02 +01:00
committed by Marge Bot
parent e241e30986
commit 86d190e158

View File

@@ -3459,7 +3459,7 @@ nvk_flush_cb_state(struct nvk_cmd_buffer *cmd)
int8_t loc_att[NVK_MAX_RTS] = { -1, -1, -1, -1, -1, -1, -1, -1};
uint8_t max_loc = 0;
uint32_t att_used = 0;
for (uint8_t a = 0; a < MESA_VK_MAX_COLOR_ATTACHMENTS; a++) {
for (uint8_t a = 0; a < render->color_att_count; a++) {
if (dyn->cal.color_map[a] == MESA_VK_ATTACHMENT_UNUSED)
continue;