diff --git a/src/vulkan/runtime/vk_graphics_state.c b/src/vulkan/runtime/vk_graphics_state.c index ff171dfdbdb..73be9e15a5b 100644 --- a/src/vulkan/runtime/vk_graphics_state.c +++ b/src/vulkan/runtime/vk_graphics_state.c @@ -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); }