From 3f3c83a6b74859b391f33d7152b0ef9b627d861f Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Tue, 28 May 2024 11:25:14 +0200 Subject: [PATCH] v3dv: handle VkPipelineCreateFlags2CreateInfoKHR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is added with VK_KHR_maintenance5 to allow 64-bit for pipeline creation flags. The flags are backwards compatible so we don't need to change the flag enum values by the new ones. This patch also addresses a small issue where compute pipelines where not initializing the flags field in the pipeline object. Reviewed-by: Alejandro PiƱeiro Part-of: --- src/broadcom/vulkan/v3dv_pipeline.c | 24 +++++++++++++++++++----- src/broadcom/vulkan/v3dv_private.h | 2 +- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index 0df505f7255..9ef6f157de0 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -2461,7 +2461,7 @@ pipeline_compile_graphics(struct v3dv_pipeline *pipeline, * compile). */ bool needs_executable_info = - pCreateInfo->flags & VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR; + pipeline->flags & VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR; if (!needs_executable_info) { struct v3dv_pipeline_key pipeline_key; pipeline_populate_graphics_key(pipeline, &pipeline_key, pCreateInfo); @@ -2492,7 +2492,7 @@ pipeline_compile_graphics(struct v3dv_pipeline *pipeline, } } - if (pCreateInfo->flags & VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT) + if (pipeline->flags & VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT) return VK_PIPELINE_COMPILE_REQUIRED; /* Otherwise we try to get the NIR shaders (either from the original SPIR-V @@ -2848,7 +2848,14 @@ pipeline_init(struct v3dv_pipeline *pipeline, VkResult result = VK_SUCCESS; pipeline->device = device; - pipeline->flags = pCreateInfo->flags; + + const VkPipelineCreateFlags2CreateInfoKHR *flags2 = + vk_find_struct_const(pCreateInfo->pNext, + PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR); + if (flags2) + pipeline->flags = flags2->flags; + else + pipeline->flags = pCreateInfo->flags; V3DV_FROM_HANDLE(v3dv_pipeline_layout, layout, pCreateInfo->layout); pipeline->layout = layout; @@ -3125,7 +3132,7 @@ pipeline_compile_compute(struct v3dv_pipeline *pipeline, * compile). */ bool needs_executable_info = - info->flags & VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR; + pipeline->flags & VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR; if (!needs_executable_info) { struct v3dv_pipeline_key pipeline_key; pipeline_populate_compute_key(pipeline, &pipeline_key, info); @@ -3145,7 +3152,7 @@ pipeline_compile_compute(struct v3dv_pipeline *pipeline, } } - if (info->flags & VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT) + if (pipeline->flags & VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT) return VK_PIPELINE_COMPILE_REQUIRED; pipeline->shared_data = v3dv_pipeline_shared_data_new_empty(pipeline->sha1, @@ -3216,6 +3223,13 @@ compute_pipeline_init(struct v3dv_pipeline *pipeline, pipeline->layout = layout; v3dv_pipeline_layout_ref(pipeline->layout); + const VkPipelineCreateFlags2CreateInfoKHR *flags2 = + vk_find_struct_const(info->pNext, PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR); + if (flags2) + pipeline->flags = flags2->flags; + else + pipeline->flags = info->flags; + VkResult result = pipeline_compile_compute(pipeline, cache, info, alloc); if (result != VK_SUCCESS) return result; diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h index baefcb4ca51..a5938b72dcb 100644 --- a/src/broadcom/vulkan/v3dv_private.h +++ b/src/broadcom/vulkan/v3dv_private.h @@ -2234,7 +2234,7 @@ struct v3dv_pipeline { struct v3dv_device *device; VkShaderStageFlags active_stages; - VkPipelineCreateFlags flags; + VkPipelineCreateFlagBits2KHR flags; struct v3dv_render_pass *pass; struct v3dv_subpass *subpass;