From 302186957be44b830fe70da191cce4ec1f540815 Mon Sep 17 00:00:00 2001 From: Hyunjun Ko Date: Tue, 31 Jan 2023 16:30:03 +0900 Subject: [PATCH] vulkan/runtime: match the spec when taking pipeline subsets. Signed-off-by: Hyunjun Ko Part-of: (cherry picked from commit c489b3eadb1570762fe2362b9c0e78090ee8c127) --- .pick_status.json | 2 +- src/vulkan/runtime/vk_graphics_state.c | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 51e0b3c99ca..ebdde91b9f9 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4207,7 +4207,7 @@ "description": "vulkan/runtime: match the spec when taking pipeline subsets.", "nominated": false, "nomination_type": null, - "resolution": 4, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/vulkan/runtime/vk_graphics_state.c b/src/vulkan/runtime/vk_graphics_state.c index 80889b6ede0..36fb0be59d6 100644 --- a/src/vulkan/runtime/vk_graphics_state.c +++ b/src/vulkan/runtime/vk_graphics_state.c @@ -1156,10 +1156,25 @@ vk_graphics_pipeline_state_fill(const struct vk_device *device, */ VkGraphicsPipelineLibraryFlagsEXT lib; - if (info->flags & VK_PIPELINE_CREATE_LIBRARY_BIT_KHR) { - const VkGraphicsPipelineLibraryCreateInfoEXT *gfx_lib_info = - vk_find_struct_const(info->pNext, GRAPHICS_PIPELINE_LIBRARY_CREATE_INFO_EXT); - lib = gfx_lib_info->flags; + const VkGraphicsPipelineLibraryCreateInfoEXT *gpl_info = + vk_find_struct_const(info->pNext, GRAPHICS_PIPELINE_LIBRARY_CREATE_INFO_EXT); + const VkPipelineLibraryCreateInfoKHR *lib_info = + vk_find_struct_const(info->pNext, PIPELINE_LIBRARY_CREATE_INFO_KHR); + + if (gpl_info) { + lib = gpl_info->flags; + } else if ((lib_info && lib_info->libraryCount > 0) || + (info->flags & VK_PIPELINE_CREATE_LIBRARY_BIT_KHR)) { + /* + * From the Vulkan 1.3.210 spec: + * "If this structure is omitted, and either VkGraphicsPipelineCreateInfo::flags + * includes VK_PIPELINE_CREATE_LIBRARY_BIT_KHR or the + * VkGraphicsPipelineCreateInfo::pNext chain includes a + * VkPipelineLibraryCreateInfoKHR structure with a libraryCount greater than 0, + * it is as if flags is 0. Otherwise if this structure is omitted, it is as if + * flags includes all possible subsets of the graphics pipeline." + */ + lib = 0; } else { /* We're building a complete pipeline. From the Vulkan 1.3.218 spec: *