vulkan/runtime: pColorAttachmentInputIndices is allowed to be NULL

The Vulkan spec says:
"If pColorAttachmentInputIndices is NULL, it is equivalent to setting
each element to its index within the array."

Fix updated dEQP-VK.dynamic_rendering.primary_cmd_buff.local_read.*.

v2: Fix it correctly (Samuel)

Fixes: 03490ec019 ("vulkan/runtime: rework VK_KHR_dynamic_rendering_local_read state tracking")

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29703>
This commit is contained in:
Iván Briano
2024-06-12 16:49:12 -07:00
committed by Marge Bot
parent 2498d67382
commit 51f410f621

View File

@@ -1045,9 +1045,13 @@ vk_input_attachment_location_state_init(struct vk_input_attachment_location_stat
for (uint32_t a = 0; a < MIN2(ial_info->colorAttachmentCount,
MESA_VK_MAX_COLOR_ATTACHMENTS); a++) {
ial->color_map[a] =
ial_info->pColorAttachmentInputIndices[a] == VK_ATTACHMENT_UNUSED ?
MESA_VK_ATTACHMENT_UNUSED : ial_info->pColorAttachmentInputIndices[a];
if (!ial_info->pColorAttachmentInputIndices) {
ial->color_map[a] = a;
} else if (ial_info->pColorAttachmentInputIndices[a] == VK_ATTACHMENT_UNUSED) {
ial->color_map[a] = MESA_VK_ATTACHMENT_UNUSED;
} else {
ial->color_map[a] = ial_info->pColorAttachmentInputIndices[a];
}
}
ial->depth_att = ial_info->pDepthInputAttachmentIndex != NULL ?
*ial_info->pDepthInputAttachmentIndex : MESA_VK_ATTACHMENT_UNUSED;
@@ -3115,9 +3119,16 @@ vk_common_CmdSetRenderingInputAttachmentIndicesKHR(
assert(pLocationInfo->colorAttachmentCount <= MESA_VK_MAX_COLOR_ATTACHMENTS);
for (uint32_t i = 0; i < pLocationInfo->colorAttachmentCount; i++) {
uint8_t val =
pLocationInfo->pColorAttachmentInputIndices[i] == VK_ATTACHMENT_UNUSED ?
MESA_VK_ATTACHMENT_UNUSED : pLocationInfo->pColorAttachmentInputIndices[i];
uint8_t val;
if (!pLocationInfo->pColorAttachmentInputIndices) {
val = i;
} else if (pLocationInfo->pColorAttachmentInputIndices[i] == VK_ATTACHMENT_UNUSED) {
val = MESA_VK_ATTACHMENT_UNUSED;
} else {
val = pLocationInfo->pColorAttachmentInputIndices[i];
}
SET_DYN_VALUE(dyn, INPUT_ATTACHMENT_MAP,
ial.color_map[i], val);
}