zink: check descriptor layout support before creating it

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9965>
This commit is contained in:
Mike Blumenkrantz 2021-01-08 07:59:51 -05:00 committed by Marge Bot
parent 75068967ee
commit d7a1bd94fb
4 changed files with 17 additions and 0 deletions

View File

@ -191,6 +191,17 @@ descriptor_layout_create(struct zink_screen *screen, VkDescriptorSetLayoutBindin
dcslci.flags = 0;
dcslci.bindingCount = num_bindings;
dcslci.pBindings = bindings;
VkDescriptorSetLayoutSupport supp;
supp.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT;
supp.pNext = NULL;
supp.supported = VK_FALSE;
if (screen->vk_GetDescriptorSetLayoutSupport) {
screen->vk_GetDescriptorSetLayoutSupport(screen->dev, &dcslci, &supp);
if (supp.supported == VK_FALSE) {
debug_printf("vkGetDescriptorSetLayoutSupport claims layout is unsupported\n");
return VK_NULL_HANDLE;
}
}
if (vkCreateDescriptorSetLayout(screen->dev, &dcslci, 0, &dsl) != VK_SUCCESS)
debug_printf("vkCreateDescriptorSetLayout failed\n");
return dsl;

View File

@ -62,6 +62,7 @@ EXTENSIONS = [
Extension("VK_KHR_maintenance1",
required=True),
Extension("VK_KHR_maintenance2"),
Extension("VK_KHR_maintenance3"),
Extension("VK_KHR_external_memory"),
Extension("VK_KHR_external_memory_fd"),
Extension("VK_EXT_provoking_vertex",

View File

@ -1215,6 +1215,9 @@ load_device_extensions(struct zink_screen *screen)
if (screen->info.have_KHR_timeline_semaphore)
GET_PROC_ADDR_KHR(WaitSemaphores);
if (screen->info.have_KHR_maintenance3)
GET_PROC_ADDR_KHR(GetDescriptorSetLayoutSupport);
screen->have_triangle_fans = true;
#if defined(VK_EXTX_PORTABILITY_SUBSET_EXTENSION_NAME)
if (screen->info.have_EXTX_portability_subset) {

View File

@ -116,6 +116,8 @@ struct zink_screen {
PFN_vkWaitSemaphores vk_WaitSemaphores;
PFN_vkGetDescriptorSetLayoutSupport vk_GetDescriptorSetLayoutSupport;
PFN_vkGetMemoryFdKHR vk_GetMemoryFdKHR;
PFN_vkCmdBeginConditionalRenderingEXT vk_CmdBeginConditionalRenderingEXT;
PFN_vkCmdEndConditionalRenderingEXT vk_CmdEndConditionalRenderingEXT;