zink: only try to create srgb mutable images if the vk format is supported

otherwise this is just a regular single-format image

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23626>
(cherry picked from commit 8f56228ace)
This commit is contained in:
Mike Blumenkrantz 2023-06-07 21:21:04 -04:00 committed by Eric Engestrom
parent 22ab43f3e8
commit 8259af094e
2 changed files with 12 additions and 7 deletions

View file

@ -1201,7 +1201,7 @@
"description": "zink: only try to create srgb mutable images if the vk format is supported",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -736,14 +736,19 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
VkFormat formats[2];
VkImageFormatListCreateInfo format_list;
if (srgb) {
format_list.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO;
format_list.pNext = NULL;
format_list.viewFormatCount = 2;
format_list.pViewFormats = formats;
formats[0] = zink_get_format(screen, templ->format);
formats[1] = zink_get_format(screen, srgb);
ici.pNext = &format_list;
/* only use format list if both formats have supported vk equivalents */
if (formats[0] && formats[1]) {
format_list.sType = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO;
format_list.pNext = NULL;
format_list.viewFormatCount = 2;
format_list.pViewFormats = formats;
ici.pNext = &format_list;
} else {
ici.pNext = NULL;
}
} else {
ici.pNext = NULL;
}