Module: Mesa Branch: main Commit: e6f5d7222c4ce9176c2e508e6abcab542aabc03e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e6f5d7222c4ce9176c2e508e6abcab542aabc03e
Author: Connor Abbott <cwabbo...@gmail.com> Date: Thu Sep 28 12:31:18 2023 +0200 vk,lvp,tu,radv,anv: Add common vk_*_pipeline_create_flags() helper And replace the various homegrown or copy-pasted helpers in drivers. Reviewed-by: Samuel Pitoiset <samuel.pitoi...@gmail.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwer...@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25436> --- src/amd/vulkan/layers/radv_sqtt_layer.c | 6 ++-- src/amd/vulkan/radv_pipeline_cache.c | 2 +- src/amd/vulkan/radv_pipeline_compute.c | 4 +-- src/amd/vulkan/radv_pipeline_graphics.c | 6 ++-- src/amd/vulkan/radv_pipeline_rt.c | 4 +-- src/amd/vulkan/radv_private.h | 30 ---------------- src/amd/vulkan/radv_rt_shader.c | 6 ++-- src/freedreno/vulkan/tu_pipeline.cc | 16 +++------ src/gallium/frontends/lavapipe/lvp_pipeline.c | 42 ++-------------------- src/intel/vulkan/anv_pipeline.c | 28 ++++----------- src/vulkan/runtime/vk_pipeline.h | 51 +++++++++++++++++++++++++++ 11 files changed, 81 insertions(+), 114 deletions(-) diff --git a/src/amd/vulkan/layers/radv_sqtt_layer.c b/src/amd/vulkan/layers/radv_sqtt_layer.c index 7584d624839..8ea977c18d8 100644 --- a/src/amd/vulkan/layers/radv_sqtt_layer.c +++ b/src/amd/vulkan/layers/radv_sqtt_layer.c @@ -30,6 +30,8 @@ #include "ac_rgp.h" #include "ac_sqtt.h" +#include "vk_pipeline.h" + void radv_sqtt_emit_relocated_shaders(struct radv_cmd_buffer *cmd_buffer, struct radv_graphics_pipeline *pipeline) { @@ -1403,7 +1405,7 @@ sqtt_CreateGraphicsPipelines(VkDevice _device, VkPipelineCache pipelineCache, ui if (!pipeline) continue; - const VkPipelineCreateFlagBits2KHR create_flags = radv_get_pipeline_create_flags(&pCreateInfos[i]); + const VkPipelineCreateFlagBits2KHR create_flags = vk_graphics_pipeline_create_flags(&pCreateInfos[i]); if (create_flags & VK_PIPELINE_CREATE_2_LIBRARY_BIT_KHR) continue; @@ -1480,7 +1482,7 @@ sqtt_CreateRayTracingPipelinesKHR(VkDevice _device, VkDeferredOperationKHR defer if (!pipeline) continue; - const VkPipelineCreateFlagBits2KHR create_flags = radv_get_pipeline_create_flags(&pCreateInfos[i]); + const VkPipelineCreateFlagBits2KHR create_flags = vk_rt_pipeline_create_flags(&pCreateInfos[i]); if (create_flags & VK_PIPELINE_CREATE_2_LIBRARY_BIT_KHR) continue; diff --git a/src/amd/vulkan/radv_pipeline_cache.c b/src/amd/vulkan/radv_pipeline_cache.c index 7e4c6f88981..3fc10df8b5d 100644 --- a/src/amd/vulkan/radv_pipeline_cache.c +++ b/src/amd/vulkan/radv_pipeline_cache.c @@ -112,7 +112,7 @@ radv_hash_rt_shaders(unsigned char *hash, const VkRayTracingPipelineCreateInfoKH } const uint64_t pipeline_flags = - radv_get_pipeline_create_flags(pCreateInfo) & + vk_rt_pipeline_create_flags(pCreateInfo) & (VK_PIPELINE_CREATE_2_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR | VK_PIPELINE_CREATE_2_RAY_TRACING_SKIP_AABBS_BIT_KHR | VK_PIPELINE_CREATE_2_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR | VK_PIPELINE_CREATE_2_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR | diff --git a/src/amd/vulkan/radv_pipeline_compute.c b/src/amd/vulkan/radv_pipeline_compute.c index 26498998747..f005df8adce 100644 --- a/src/amd/vulkan/radv_pipeline_compute.c +++ b/src/amd/vulkan/radv_pipeline_compute.c @@ -266,7 +266,7 @@ radv_compute_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkC } radv_pipeline_init(device, &pipeline->base, RADV_PIPELINE_COMPUTE); - pipeline->base.create_flags = radv_get_pipeline_create_flags(pCreateInfo); + pipeline->base.create_flags = vk_compute_pipeline_create_flags(pCreateInfo); pipeline->base.is_internal = _cache == device->meta_state.cache; const VkPipelineCreationFeedbackCreateInfo *creation_feedback = @@ -303,7 +303,7 @@ radv_create_compute_pipelines(VkDevice _device, VkPipelineCache pipelineCache, u result = r; pPipelines[i] = VK_NULL_HANDLE; - VkPipelineCreateFlagBits2KHR create_flags = radv_get_pipeline_create_flags(&pCreateInfos[i]); + VkPipelineCreateFlagBits2KHR create_flags = vk_compute_pipeline_create_flags(&pCreateInfos[i]); if (create_flags & VK_PIPELINE_CREATE_2_EARLY_RETURN_ON_FAILURE_BIT_KHR) break; } diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index 433f21ad466..4aa32bec6bc 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -4078,7 +4078,7 @@ radv_graphics_pipeline_create(VkDevice _device, VkPipelineCache _cache, const Vk return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY); radv_pipeline_init(device, &pipeline->base, RADV_PIPELINE_GRAPHICS); - pipeline->base.create_flags = radv_get_pipeline_create_flags(pCreateInfo); + pipeline->base.create_flags = vk_graphics_pipeline_create_flags(pCreateInfo); pipeline->base.is_internal = _cache == device->meta_state.cache; result = radv_graphics_pipeline_init(pipeline, device, cache, pCreateInfo, extra); @@ -4179,7 +4179,7 @@ radv_graphics_lib_pipeline_create(VkDevice _device, VkPipelineCache _cache, return vk_error(device, VK_ERROR_OUT_OF_HOST_MEMORY); radv_pipeline_init(device, &pipeline->base.base, RADV_PIPELINE_GRAPHICS_LIB); - pipeline->base.base.create_flags = radv_get_pipeline_create_flags(pCreateInfo); + pipeline->base.base.create_flags = vk_graphics_pipeline_create_flags(pCreateInfo); pipeline->mem_ctx = ralloc_context(NULL); @@ -4219,7 +4219,7 @@ radv_CreateGraphicsPipelines(VkDevice _device, VkPipelineCache pipelineCache, ui unsigned i = 0; for (; i < count; i++) { - const VkPipelineCreateFlagBits2KHR create_flags = radv_get_pipeline_create_flags(&pCreateInfos[i]); + const VkPipelineCreateFlagBits2KHR create_flags = vk_graphics_pipeline_create_flags(&pCreateInfos[i]); VkResult r; if (create_flags & VK_PIPELINE_CREATE_2_LIBRARY_BIT_KHR) { r = radv_graphics_lib_pipeline_create(_device, pipelineCache, &pCreateInfos[i], pAllocator, &pPipelines[i]); diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index 810f6041b1d..21e2cbec28d 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -743,7 +743,7 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra return VK_ERROR_OUT_OF_HOST_MEMORY; radv_pipeline_init(device, &pipeline->base.base, RADV_PIPELINE_RAY_TRACING); - pipeline->base.base.create_flags = radv_get_pipeline_create_flags(pCreateInfo); + pipeline->base.base.create_flags = vk_rt_pipeline_create_flags(pCreateInfo); pipeline->stage_count = local_create_info.stageCount; pipeline->group_count = local_create_info.groupCount; pipeline->stages = stages; @@ -847,7 +847,7 @@ radv_CreateRayTracingPipelinesKHR(VkDevice _device, VkDeferredOperationKHR defer result = r; pPipelines[i] = VK_NULL_HANDLE; - const VkPipelineCreateFlagBits2KHR create_flags = radv_get_pipeline_create_flags(&pCreateInfos[i]); + const VkPipelineCreateFlagBits2KHR create_flags = vk_rt_pipeline_create_flags(&pCreateInfos[i]); if (create_flags & VK_PIPELINE_CREATE_2_EARLY_RETURN_ON_FAILURE_BIT_KHR) break; } diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 16ec1d65f79..69d601c45b4 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -1926,36 +1926,6 @@ struct radv_dispatch_info { void radv_compute_dispatch(struct radv_cmd_buffer *cmd_buffer, const struct radv_dispatch_info *info); -static VkPipelineCreateFlagBits2KHR -radv_get_pipeline_create_flags(const void *pCreateInfo) -{ - const VkBaseInStructure *base = pCreateInfo; - const VkPipelineCreateFlags2CreateInfoKHR *flags2 = - vk_find_struct_const(base->pNext, PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR); - - if (flags2) - return flags2->flags; - - switch (((VkBaseInStructure *)pCreateInfo)->sType) { - case VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO: { - const VkGraphicsPipelineCreateInfo *create_info = (VkGraphicsPipelineCreateInfo *)pCreateInfo; - return create_info->flags; - } - case VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO: { - const VkComputePipelineCreateInfo *create_info = (VkComputePipelineCreateInfo *)pCreateInfo; - return create_info->flags; - } - case VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_KHR: { - const VkRayTracingPipelineCreateInfoKHR *create_info = (VkRayTracingPipelineCreateInfoKHR *)pCreateInfo; - return create_info->flags; - } - default: - unreachable("invalid pCreateInfo pipeline struct"); - } - - return 0; -} - struct radv_image; struct radv_image_view; diff --git a/src/amd/vulkan/radv_rt_shader.c b/src/amd/vulkan/radv_rt_shader.c index 979e34d5317..dbc29d8573e 100644 --- a/src/amd/vulkan/radv_rt_shader.c +++ b/src/amd/vulkan/radv_rt_shader.c @@ -32,6 +32,8 @@ #include "radv_rt_common.h" #include "radv_shader.h" +#include "vk_pipeline.h" + /* Traversal stack size. This stack is put in LDS and experimentally 16 entries results in best * performance. */ #define MAX_STACK_ENTRY_COUNT 16 @@ -1437,7 +1439,7 @@ nir_shader * radv_build_traversal_shader(struct radv_device *device, struct radv_ray_tracing_pipeline *pipeline, const VkRayTracingPipelineCreateInfoKHR *pCreateInfo) { - const VkPipelineCreateFlagBits2KHR create_flags = radv_get_pipeline_create_flags(pCreateInfo); + const VkPipelineCreateFlagBits2KHR create_flags = vk_rt_pipeline_create_flags(pCreateInfo); /* Create the traversal shader as an intersection shader to prevent validation failures due to * invalid variable modes.*/ @@ -1612,7 +1614,7 @@ radv_nir_lower_rt_abi(nir_shader *shader, const VkRayTracingPipelineCreateInfoKH { nir_function_impl *impl = nir_shader_get_entrypoint(shader); - const VkPipelineCreateFlagBits2KHR create_flags = radv_get_pipeline_create_flags(pCreateInfo); + const VkPipelineCreateFlagBits2KHR create_flags = vk_rt_pipeline_create_flags(pCreateInfo); struct rt_variables vars = create_rt_variables(shader, create_flags); diff --git a/src/freedreno/vulkan/tu_pipeline.cc b/src/freedreno/vulkan/tu_pipeline.cc index abed3318dc6..5745930e66b 100644 --- a/src/freedreno/vulkan/tu_pipeline.cc +++ b/src/freedreno/vulkan/tu_pipeline.cc @@ -4221,12 +4221,8 @@ tu_CreateGraphicsPipelines(VkDevice device, uint32_t i = 0; for (; i < count; i++) { - VkPipelineCreateFlags2KHR flags = pCreateInfos[i].flags; - const VkPipelineCreateFlags2CreateInfoKHR *flags2 = - vk_find_struct_const(pCreateInfos[i].pNext, - PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR); - if (flags2) - flags = flags2->flags; + VkPipelineCreateFlags2KHR flags = + vk_graphics_pipeline_create_flags(&pCreateInfos[i]); VkResult result = tu_graphics_pipeline_create<CHIP>(device, pipelineCache, @@ -4406,12 +4402,8 @@ tu_CreateComputePipelines(VkDevice device, uint32_t i = 0; for (; i < count; i++) { - VkPipelineCreateFlags2KHR flags = pCreateInfos[i].flags; - const VkPipelineCreateFlags2CreateInfoKHR *flags2 = - vk_find_struct_const(pCreateInfos[i].pNext, - PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR); - if (flags2) - flags = flags2->flags; + VkPipelineCreateFlags2KHR flags = + vk_compute_pipeline_create_flags(&pCreateInfos[i]); VkResult result = tu_compute_pipeline_create<CHIP>(device, pipelineCache, diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c b/src/gallium/frontends/lavapipe/lvp_pipeline.c index 0f9b000e2f3..dc228357b39 100644 --- a/src/gallium/frontends/lavapipe/lvp_pipeline.c +++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c @@ -1032,42 +1032,6 @@ lvp_graphics_pipeline_create( return VK_SUCCESS; } -static VkPipelineCreateFlagBits2KHR -get_pipeline_create_flags(const void *pCreateInfo) -{ - const VkBaseInStructure *base = pCreateInfo; - const VkPipelineCreateFlags2CreateInfoKHR *flags2 = - vk_find_struct_const(base->pNext, PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR); - - if (flags2) - return flags2->flags; - - switch (((VkBaseInStructure *)pCreateInfo)->sType) { - case VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO: { - const VkGraphicsPipelineCreateInfo *create_info = (VkGraphicsPipelineCreateInfo *)pCreateInfo; - return create_info->flags; - } - case VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO: { - const VkComputePipelineCreateInfo *create_info = (VkComputePipelineCreateInfo *)pCreateInfo; - return create_info->flags; - } - case VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_KHR: { - const VkRayTracingPipelineCreateInfoKHR *create_info = (VkRayTracingPipelineCreateInfoKHR *)pCreateInfo; - return create_info->flags; - } -#ifdef VK_ENABLE_BETA_EXTENSIONS - case VK_STRUCTURE_TYPE_EXECUTION_GRAPH_PIPELINE_CREATE_INFO_AMDX: { - const VkExecutionGraphPipelineCreateInfoAMDX *create_info = (VkExecutionGraphPipelineCreateInfoAMDX *)pCreateInfo; - return create_info->flags; - } -#endif - default: - unreachable("invalid pCreateInfo pipeline struct"); - } - - return 0; -} - VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateGraphicsPipelines( VkDevice _device, VkPipelineCache pipelineCache, @@ -1081,7 +1045,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateGraphicsPipelines( for (; i < count; i++) { VkResult r = VK_PIPELINE_COMPILE_REQUIRED; - VkPipelineCreateFlagBits2KHR flags = get_pipeline_create_flags(&pCreateInfos[i]); + VkPipelineCreateFlagBits2KHR flags = vk_graphics_pipeline_create_flags(&pCreateInfos[i]); if (!(flags & VK_PIPELINE_CREATE_2_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_KHR)) r = lvp_graphics_pipeline_create(_device, @@ -1183,7 +1147,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateComputePipelines( for (; i < count; i++) { VkResult r = VK_PIPELINE_COMPILE_REQUIRED; - VkPipelineCreateFlagBits2KHR flags = get_pipeline_create_flags(&pCreateInfos[i]); + VkPipelineCreateFlagBits2KHR flags = vk_compute_pipeline_create_flags(&pCreateInfos[i]); if (!(flags & VK_PIPELINE_CREATE_2_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_KHR)) r = lvp_compute_pipeline_create(_device, @@ -1491,7 +1455,7 @@ lvp_CreateExecutionGraphPipelinesAMDX(VkDevice device, VkPipelineCache pipelineC uint32_t i = 0; for (; i < createInfoCount; i++) { - VkPipelineCreateFlagBits2KHR flags = get_pipeline_create_flags(&pCreateInfos[i]); + VkPipelineCreateFlagBits2KHR flags = vk_graph_pipeline_create_flags(&pCreateInfos[i]); VkResult r = VK_PIPELINE_COMPILE_REQUIRED; if (!(flags & VK_PIPELINE_CREATE_2_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_KHR)) diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 52f97aec312..1034fc44e78 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -2676,18 +2676,6 @@ anv_pipeline_compile_cs(struct anv_compute_pipeline *pipeline, return VK_SUCCESS; } -static VkPipelineCreateFlags2KHR -get_pipeline_flags(VkPipelineCreateFlags flags, const void *pNext) -{ - const VkPipelineCreateFlags2CreateInfoKHR *flags2 = - vk_find_struct_const(pNext, PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR); - - if (flags2) - return flags2->flags; - - return (VkPipelineCreateFlags2KHR)flags; -} - static VkResult anv_compute_pipeline_create(struct anv_device *device, struct vk_pipeline_cache *cache, @@ -2707,8 +2695,7 @@ anv_compute_pipeline_create(struct anv_device *device, result = anv_pipeline_init(&pipeline->base, device, ANV_PIPELINE_COMPUTE, - get_pipeline_flags(pCreateInfo->flags, - pCreateInfo->pNext), + vk_compute_pipeline_create_flags(pCreateInfo), pAllocator); if (result != VK_SUCCESS) { vk_free2(&device->vk.alloc, pAllocator, pipeline); @@ -2754,7 +2741,7 @@ VkResult anv_CreateComputePipelines( unsigned i; for (i = 0; i < count; i++) { const VkPipelineCreateFlags2KHR flags = - get_pipeline_flags(pCreateInfos[i].flags, pCreateInfos[i].pNext); + vk_compute_pipeline_create_flags(&pCreateInfos[i]); VkResult res = anv_compute_pipeline_create(device, pipeline_cache, &pCreateInfos[i], pAllocator, &pPipelines[i]); @@ -3020,7 +3007,7 @@ anv_graphics_lib_pipeline_create(struct anv_device *device, VkResult result; const VkPipelineCreateFlags2KHR flags = - get_pipeline_flags(pCreateInfo->flags, pCreateInfo->pNext); + vk_graphics_pipeline_create_flags(pCreateInfo); assert(flags & VK_PIPELINE_CREATE_2_LIBRARY_BIT_KHR); const VkPipelineLibraryCreateInfoKHR *libs_info = @@ -3129,7 +3116,7 @@ anv_graphics_pipeline_create(struct anv_device *device, VkResult result; const VkPipelineCreateFlags2KHR flags = - get_pipeline_flags(pCreateInfo->flags, pCreateInfo->pNext); + vk_graphics_pipeline_create_flags(pCreateInfo); assert((flags & VK_PIPELINE_CREATE_2_LIBRARY_BIT_KHR) == 0); const VkPipelineLibraryCreateInfoKHR *libs_info = @@ -3266,7 +3253,7 @@ VkResult anv_CreateGraphicsPipelines( assert(pCreateInfos[i].sType == VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO); const VkPipelineCreateFlags2KHR flags = - get_pipeline_flags(pCreateInfos[i].flags, pCreateInfos[i].pNext); + vk_graphics_pipeline_create_flags(&pCreateInfos[i]); VkResult res; if (flags & VK_PIPELINE_CREATE_2_LIBRARY_BIT_KHR) { res = anv_graphics_lib_pipeline_create(device, pipeline_cache, @@ -4018,8 +4005,7 @@ anv_ray_tracing_pipeline_create( result = anv_pipeline_init(&pipeline->base, device, ANV_PIPELINE_RAY_TRACING, - get_pipeline_flags(pCreateInfo->flags, - pCreateInfo->pNext), + vk_rt_pipeline_create_flags(pCreateInfo), pAllocator); if (result != VK_SUCCESS) { vk_free2(&device->vk.alloc, pAllocator, pipeline); @@ -4135,7 +4121,7 @@ anv_CreateRayTracingPipelinesKHR( unsigned i; for (i = 0; i < createInfoCount; i++) { const VkPipelineCreateFlags2KHR flags = - get_pipeline_flags(pCreateInfos[i].flags, pCreateInfos[i].pNext); + vk_rt_pipeline_create_flags(&pCreateInfos[i]); VkResult res = anv_ray_tracing_pipeline_create(_device, pipeline_cache, &pCreateInfos[i], pAllocator, &pPipelines[i]); diff --git a/src/vulkan/runtime/vk_pipeline.h b/src/vulkan/runtime/vk_pipeline.h index ce037ebacd6..1ca32a1428e 100644 --- a/src/vulkan/runtime/vk_pipeline.h +++ b/src/vulkan/runtime/vk_pipeline.h @@ -25,6 +25,7 @@ #define VK_PIPELINE_H #include "vulkan/vulkan_core.h" +#include "vk_util.h" #include <stdbool.h> @@ -88,6 +89,56 @@ vk_pipeline_robustness_state_fill(const struct vk_device *device, const void *pipeline_pNext, const void *shader_stage_pNext); +static inline VkPipelineCreateFlags2KHR +vk_compute_pipeline_create_flags(const VkComputePipelineCreateInfo *info) +{ + const VkPipelineCreateFlags2CreateInfoKHR *flags2 = + vk_find_struct_const(info->pNext, + PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR); + if (flags2) + return flags2->flags; + else + return info->flags; +} + +static inline VkPipelineCreateFlags2KHR +vk_graphics_pipeline_create_flags(const VkGraphicsPipelineCreateInfo *info) +{ + const VkPipelineCreateFlags2CreateInfoKHR *flags2 = + vk_find_struct_const(info->pNext, + PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR); + if (flags2) + return flags2->flags; + else + return info->flags; +} + +static inline VkPipelineCreateFlags2KHR +vk_rt_pipeline_create_flags(const VkRayTracingPipelineCreateInfoKHR *info) +{ + const VkPipelineCreateFlags2CreateInfoKHR *flags2 = + vk_find_struct_const(info->pNext, + PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR); + if (flags2) + return flags2->flags; + else + return info->flags; +} + +#ifdef VK_ENABLE_BETA_EXTENSIONS +static inline VkPipelineCreateFlags2KHR +vk_graph_pipeline_create_flags(const VkExecutionGraphPipelineCreateInfoAMDX *info) +{ + const VkPipelineCreateFlags2CreateInfoKHR *flags2 = + vk_find_struct_const(info->pNext, + PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR); + if (flags2) + return flags2->flags; + else + return info->flags; +} +#endif + #ifdef __cplusplus } #endif