venus: Fix detection of push descriptor set

- Fix null deref. VkPipelineLayoutCreateInfo::pSetLayouts is allowed to
  contain VK_NULL_HANDLE.
- The loop 'break' was misplaced.

Fixes crash in
dEQP-VK.pipeline.pipeline_library.graphics_library.fast.0_00_11_11 after
VK_EXT_graphics_pipeline_library is enabled in a later patch.

Fixes: 91966f2eff ("venus: extend lifetime of push descriptor set layout")
Signed-off-by: Lina Versace <linyaa@google.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Dawn Han <dawnhan@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23810>
This commit is contained in:
Lina Versace 2023-06-20 16:43:46 -07:00 committed by Marge Bot
parent f278b30e94
commit 98c8d7b7cf

View file

@ -126,11 +126,22 @@ vn_CreatePipelineLayout(VkDevice device,
for (uint32_t i = 0; i < pCreateInfo->setLayoutCount; i++) {
struct vn_descriptor_set_layout *descriptor_set_layout =
vn_descriptor_set_layout_from_handle(pCreateInfo->pSetLayouts[i]);
if (descriptor_set_layout->is_push_descriptor) {
/* Avoid null derefs. pSetLayouts may contain VK_NULL_HANDLE.
*
* From the Vulkan 1.3.254 spec:
* VUID-VkPipelineLayoutCreateInfo-pSetLayouts-parameter
*
* If setLayoutCount is not 0, pSetLayouts must be a valid pointer to
* an array of setLayoutCount valid or VK_NULL_HANDLE
* VkDescriptorSetLayout handles
*/
if (descriptor_set_layout &&
descriptor_set_layout->is_push_descriptor) {
layout->push_descriptor_set_layout =
vn_descriptor_set_layout_ref(dev, descriptor_set_layout);
break;
}
break;
}
layout->has_push_constant_ranges = pCreateInfo->pPushConstantRanges > 0;