From af76f48fc25e141a25fb74f9eafbf43494c8e1ed Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 25 Apr 2024 14:16:37 +0200 Subject: [PATCH] radv: make pipeline hashing functions non-static They will be used to generate pipeline hashes from pCreateInfo. Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_pipeline_compute.c | 2 +- src/amd/vulkan/radv_pipeline_compute.h | 3 +++ src/amd/vulkan/radv_pipeline_graphics.c | 19 +++---------------- src/amd/vulkan/radv_pipeline_graphics.h | 22 ++++++++++++++++++++++ src/amd/vulkan/radv_pipeline_rt.c | 16 +++------------- src/amd/vulkan/radv_pipeline_rt.h | 20 ++++++++++++++++++++ 6 files changed, 52 insertions(+), 30 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline_compute.c b/src/amd/vulkan/radv_pipeline_compute.c index 0fd40d67303..4888b781722 100644 --- a/src/amd/vulkan/radv_pipeline_compute.c +++ b/src/amd/vulkan/radv_pipeline_compute.c @@ -154,7 +154,7 @@ radv_compile_cs(struct radv_device *device, struct vk_pipeline_cache *cache, str return cs_shader; } -static void +void radv_compute_pipeline_hash(const struct radv_device *device, const VkComputePipelineCreateInfo *pCreateInfo, unsigned char *hash) { diff --git a/src/amd/vulkan/radv_pipeline_compute.h b/src/amd/vulkan/radv_pipeline_compute.h index 559a6d5d8fc..b86089ed353 100644 --- a/src/amd/vulkan/radv_pipeline_compute.h +++ b/src/amd/vulkan/radv_pipeline_compute.h @@ -62,4 +62,7 @@ VkResult radv_compute_pipeline_create(VkDevice _device, VkPipelineCache _cache, void radv_destroy_compute_pipeline(struct radv_device *device, struct radv_compute_pipeline *pipeline); +void radv_compute_pipeline_hash(const struct radv_device *device, const VkComputePipelineCreateInfo *pCreateInfo, + unsigned char *hash); + #endif /* RADV_PIPELINE_COMPUTE_H */ diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index bd2cc295f07..caa17d546ae 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -2750,20 +2750,7 @@ radv_should_compute_pipeline_hash(const struct radv_device *device, const enum r ((instance->vk.trace_mode & RADV_TRACE_MODE_RGP) && pipeline_type == RADV_PIPELINE_GRAPHICS); } -struct radv_graphics_pipeline_state { - struct vk_graphics_pipeline_state vk; - void *vk_data; - - bool compilation_required; - - struct radv_shader_stage *stages; - - struct radv_graphics_pipeline_key key; - - struct radv_pipeline_layout layout; -}; - -static void +void radv_graphics_pipeline_state_finish(struct radv_device *device, struct radv_graphics_pipeline_state *gfx_state) { radv_pipeline_layout_finish(device, &gfx_state->layout); @@ -2776,7 +2763,7 @@ radv_graphics_pipeline_state_finish(struct radv_device *device, struct radv_grap } } -static VkResult +VkResult radv_generate_graphics_pipeline_state(struct radv_device *device, const VkGraphicsPipelineCreateInfo *pCreateInfo, struct radv_graphics_pipeline_state *gfx_state) { @@ -2860,7 +2847,7 @@ fail: return result; } -static void +void radv_graphics_pipeline_hash(const struct radv_device *device, const struct radv_graphics_pipeline_state *gfx_state, unsigned char *hash) { diff --git a/src/amd/vulkan/radv_pipeline_graphics.h b/src/amd/vulkan/radv_pipeline_graphics.h index 5199207378a..ba87a5513ee 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.h +++ b/src/amd/vulkan/radv_pipeline_graphics.h @@ -638,4 +638,26 @@ void radv_destroy_graphics_pipeline(struct radv_device *device, struct radv_grap void radv_destroy_graphics_lib_pipeline(struct radv_device *device, struct radv_graphics_lib_pipeline *pipeline); +struct radv_graphics_pipeline_state { + struct vk_graphics_pipeline_state vk; + void *vk_data; + + bool compilation_required; + + struct radv_shader_stage *stages; + + struct radv_graphics_pipeline_key key; + + struct radv_pipeline_layout layout; +}; + +void radv_graphics_pipeline_hash(const struct radv_device *device, const struct radv_graphics_pipeline_state *gfx_state, + unsigned char *hash); + +VkResult radv_generate_graphics_pipeline_state(struct radv_device *device, + const VkGraphicsPipelineCreateInfo *pCreateInfo, + struct radv_graphics_pipeline_state *gfx_state); + +void radv_graphics_pipeline_state_finish(struct radv_device *device, struct radv_graphics_pipeline_state *gfx_state); + #endif /* RADV_PIPELINE_GRAPHICS_H */ diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index 22f0a8dd51b..9565d5ebc7e 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -18,16 +18,6 @@ #include "radv_rmv.h" #include "radv_shader.h" -struct radv_ray_tracing_state_key { - uint32_t stage_count; - struct radv_ray_tracing_stage *stages; - - uint32_t group_count; - struct radv_ray_tracing_group *groups; - - struct radv_shader_stage_key stage_keys[MESA_VULKAN_SHADER_STAGES]; -}; - struct rt_handle_hash_entry { uint32_t key; char hash[20]; @@ -833,7 +823,7 @@ compile_rt_prolog(struct radv_device *device, struct radv_ray_tracing_pipeline * pipeline->prolog->max_waves = radv_get_max_waves(device, config, &pipeline->prolog->info); } -static void +void radv_ray_tracing_pipeline_hash(const struct radv_device *device, const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, const struct radv_ray_tracing_state_key *rt_state, unsigned char *hash) { @@ -933,14 +923,14 @@ done: return result; } -static void +void radv_ray_tracing_state_key_finish(struct radv_ray_tracing_state_key *rt_state) { free(rt_state->stages); free(rt_state->groups); } -static VkResult +VkResult radv_generate_ray_tracing_state_key(struct radv_device *device, const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, struct radv_ray_tracing_state_key *rt_state) { diff --git a/src/amd/vulkan/radv_pipeline_rt.h b/src/amd/vulkan/radv_pipeline_rt.h index baab7aacd99..1f5bfee9c2e 100644 --- a/src/amd/vulkan/radv_pipeline_rt.h +++ b/src/amd/vulkan/radv_pipeline_rt.h @@ -99,6 +99,26 @@ struct radv_ray_tracing_stage { uint8_t sha1[SHA1_DIGEST_LENGTH]; }; +struct radv_ray_tracing_state_key { + uint32_t stage_count; + struct radv_ray_tracing_stage *stages; + + uint32_t group_count; + struct radv_ray_tracing_group *groups; + + struct radv_shader_stage_key stage_keys[MESA_VULKAN_SHADER_STAGES]; +}; + void radv_destroy_ray_tracing_pipeline(struct radv_device *device, struct radv_ray_tracing_pipeline *pipeline); +void radv_ray_tracing_pipeline_hash(const struct radv_device *device, + const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, + const struct radv_ray_tracing_state_key *rt_state, unsigned char *hash); + +VkResult radv_generate_ray_tracing_state_key(struct radv_device *device, + const VkRayTracingPipelineCreateInfoKHR *pCreateInfo, + struct radv_ray_tracing_state_key *rt_state); + +void radv_ray_tracing_state_key_finish(struct radv_ray_tracing_state_key *rt_state); + #endif /* RADV_PIPELINE_RT */