vulkan: Allow pColorAttachmentLocations == NULL in CmdSetRenderingAttachmentLocationsKHR()

Fixes: fe19405c46 ("vulkan/runtime: handle new dynamic states for attachment remapping")
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31033>
(cherry picked from commit ea783a96b8)
This commit is contained in:
Faith Ekstrand 2024-09-04 13:39:13 -05:00 committed by Dylan Baker
parent 4bf6575129
commit 832fdfd7f2
2 changed files with 3 additions and 1 deletions

View file

@ -44,7 +44,7 @@
"description": "vulkan: Allow pColorAttachmentLocations == NULL in CmdSetRenderingAttachmentLocationsKHR()",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "fe19405c4640cdee88cf91a0faa13620090d5f70",
"notes": null

View file

@ -1073,6 +1073,7 @@ vk_color_attachment_location_state_init(struct vk_color_attachment_location_stat
for (uint32_t a = 0; a < MIN2(cal_info->colorAttachmentCount,
MESA_VK_MAX_COLOR_ATTACHMENTS); a++) {
cal->color_map[a] =
cal_info->pColorAttachmentLocations == NULL ? a :
cal_info->pColorAttachmentLocations[a] == VK_ATTACHMENT_UNUSED ?
MESA_VK_ATTACHMENT_UNUSED : cal_info->pColorAttachmentLocations[a];
}
@ -3103,6 +3104,7 @@ vk_common_CmdSetRenderingAttachmentLocationsKHR(
assert(pLocationInfo->colorAttachmentCount <= MESA_VK_MAX_COLOR_ATTACHMENTS);
for (uint32_t i = 0; i < pLocationInfo->colorAttachmentCount; i++) {
uint8_t val =
pLocationInfo->pColorAttachmentLocations == NULL ? i :
pLocationInfo->pColorAttachmentLocations[i] == VK_ATTACHMENT_UNUSED ?
MESA_VK_ATTACHMENT_UNUSED : pLocationInfo->pColorAttachmentLocations[i];
SET_DYN_VALUE(dyn, COLOR_ATTACHMENT_MAP, cal.color_map[i], val);