zink: strip format list when disabling mutable during image creation

drivers shouldn't be getting a format list if it won't be used

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23514>
(cherry picked from commit ff1e667e45)
This commit is contained in:
Mike Blumenkrantz 2023-06-13 11:35:04 -04:00 committed by Eric Engestrom
parent 17663b7111
commit 86aba43272
2 changed files with 18 additions and 3 deletions

View file

@ -436,7 +436,7 @@
"description": "zink: strip format list when disabling mutable during image creation",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -363,11 +363,26 @@ double_check_ici(struct zink_screen *screen, VkImageCreateInfo *ici, VkImageUsag
if (check_ici(screen, ici, *mod))
return true;
if (pNext) {
ici->pNext = NULL;
VkBaseOutStructure *prev = NULL;
VkBaseOutStructure *fmt_list = NULL;
vk_foreach_struct(strct, (void*)ici->pNext) {
if (strct->sType == VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO) {
fmt_list = strct;
if (prev) {
prev->pNext = strct->pNext;
} else {
ici->pNext = strct->pNext;
}
fmt_list->pNext = NULL;
break;
}
prev = strct;
}
ici->flags &= ~VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
if (check_ici(screen, ici, *mod))
return true;
ici->pNext = pNext;
fmt_list->pNext = (void*)ici->pNext;
ici->pNext = fmt_list;
ici->flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
}
return false;