venus: extend VkPipelineLayout lifetime for batched VkCmdPushConstants()

Signed-off-by: Dawn Han <dawnhan@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18988>
This commit is contained in:
Dawn Han 2022-11-22 20:52:56 +00:00 committed by Marge Bot
parent 91966f2eff
commit 19f2b9d0bb
2 changed files with 7 additions and 2 deletions

View file

@ -133,6 +133,8 @@ vn_CreatePipelineLayout(VkDevice device,
break; break;
} }
layout->has_push_constant_ranges = pCreateInfo->pPushConstantRanges > 0;
VkPipelineLayout layout_handle = vn_pipeline_layout_to_handle(layout); VkPipelineLayout layout_handle = vn_pipeline_layout_to_handle(layout);
vn_async_vkCreatePipelineLayout(dev->instance, device, pCreateInfo, NULL, vn_async_vkCreatePipelineLayout(dev->instance, device, pCreateInfo, NULL,
&layout_handle); &layout_handle);
@ -747,7 +749,8 @@ vn_CreateGraphicsPipelines(VkDevice device,
struct vn_pipeline *pipeline = vn_pipeline_from_handle(pPipelines[i]); struct vn_pipeline *pipeline = vn_pipeline_from_handle(pPipelines[i]);
struct vn_pipeline_layout *layout = struct vn_pipeline_layout *layout =
vn_pipeline_layout_from_handle(pCreateInfos[i].layout); vn_pipeline_layout_from_handle(pCreateInfos[i].layout);
if (layout->push_descriptor_set_layout) { if (layout->push_descriptor_set_layout ||
layout->has_push_constant_ranges) {
pipeline->layout = vn_pipeline_layout_ref(dev, layout); pipeline->layout = vn_pipeline_layout_ref(dev, layout);
} }
if ((pCreateInfos[i].flags & VN_PIPELINE_CREATE_SYNC_MASK)) if ((pCreateInfos[i].flags & VN_PIPELINE_CREATE_SYNC_MASK))
@ -799,7 +802,8 @@ vn_CreateComputePipelines(VkDevice device,
struct vn_pipeline *pipeline = vn_pipeline_from_handle(pPipelines[i]); struct vn_pipeline *pipeline = vn_pipeline_from_handle(pPipelines[i]);
struct vn_pipeline_layout *layout = struct vn_pipeline_layout *layout =
vn_pipeline_layout_from_handle(pCreateInfos[i].layout); vn_pipeline_layout_from_handle(pCreateInfos[i].layout);
if (layout->push_descriptor_set_layout) { if (layout->push_descriptor_set_layout ||
layout->has_push_constant_ranges) {
pipeline->layout = vn_pipeline_layout_ref(dev, layout); pipeline->layout = vn_pipeline_layout_ref(dev, layout);
} }
if ((pCreateInfos[i].flags & VN_PIPELINE_CREATE_SYNC_MASK)) if ((pCreateInfos[i].flags & VN_PIPELINE_CREATE_SYNC_MASK))

View file

@ -25,6 +25,7 @@ struct vn_pipeline_layout {
struct vn_object_base base; struct vn_object_base base;
struct vn_descriptor_set_layout *push_descriptor_set_layout; struct vn_descriptor_set_layout *push_descriptor_set_layout;
bool has_push_constant_ranges;
struct vn_refcount refcount; struct vn_refcount refcount;
}; };
VK_DEFINE_NONDISP_HANDLE_CASTS(vn_pipeline_layout, VK_DEFINE_NONDISP_HANDLE_CASTS(vn_pipeline_layout,