venus: Fix crash when VkGraphicsPipelineCreateInfo::layout is missing
With VK_EXT_graphics_pipeline_library, the layout may be omitted or ignored in incomplete pipelines. Signed-off-by: Lina Versace <linyaa@google.com> Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22419>
This commit is contained in:
@@ -781,12 +781,17 @@ vn_CreateGraphicsPipelines(VkDevice device,
|
||||
|
||||
for (uint32_t i = 0; i < createInfoCount; i++) {
|
||||
struct vn_pipeline *pipeline = vn_pipeline_from_handle(pPipelines[i]);
|
||||
|
||||
/* Grab a refcount on the pipeline layout when needed. Take care; the
|
||||
* pipeline layout may be omitted or ignored in incomplete pipelines.
|
||||
*/
|
||||
struct vn_pipeline_layout *layout =
|
||||
vn_pipeline_layout_from_handle(pCreateInfos[i].layout);
|
||||
if (layout->push_descriptor_set_layout ||
|
||||
layout->has_push_constant_ranges) {
|
||||
if (layout && (layout->push_descriptor_set_layout ||
|
||||
layout->has_push_constant_ranges)) {
|
||||
pipeline->layout = vn_pipeline_layout_ref(dev, layout);
|
||||
}
|
||||
|
||||
if ((pCreateInfos[i].flags & VN_PIPELINE_CREATE_SYNC_MASK))
|
||||
want_sync = true;
|
||||
|
||||
|
@@ -43,6 +43,22 @@ VK_DEFINE_NONDISP_HANDLE_CASTS(vn_pipeline_cache,
|
||||
|
||||
struct vn_pipeline {
|
||||
struct vn_object_base base;
|
||||
|
||||
/**
|
||||
* The VkPipelineLayout provided directly (without linking) at pipeline
|
||||
* creation. Null if none was provided.
|
||||
*
|
||||
* We track the pipeline layout here to extend its and its children's
|
||||
* lifetime, NOT because this is the actual layout used by the pipeline.
|
||||
*
|
||||
* WARNING. This may not be the actual layout used by the pipeline. The
|
||||
* Vulkan 1.3.254 spec says:
|
||||
*
|
||||
* The final effective pipeline layout is effectively the union of the
|
||||
* linked pipeline layouts. When binding descriptor sets for this
|
||||
* pipeline, the pipeline layout used must be compatible with this
|
||||
* union.
|
||||
*/
|
||||
struct vn_pipeline_layout *layout;
|
||||
};
|
||||
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_pipeline,
|
||||
|
Reference in New Issue
Block a user