xref: /aosp_15_r20/external/mesa3d/src/amd/vulkan/radv_pipeline_binary.h (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1 /*
2  * Copyright © 2024 Valve Corporation
3  *
4  * SPDX-License-Identifier: MIT
5  */
6 
7 #ifndef RADV_PIPELINE_BINARY_H
8 #define RADV_PIPELINE_BINARY_H
9 
10 #include "vk_object.h"
11 
12 #include "util/mesa-blake3.h"
13 #include "util/mesa-sha1.h"
14 
15 struct radv_device;
16 struct radv_ray_tracing_stage_info;
17 struct radv_shader;
18 struct util_dynarray;
19 struct vk_pipeline_cache_object;
20 
21 struct radv_pipeline_binary {
22    struct vk_object_base base;
23 
24    blake3_hash key;
25    void *data;
26    size_t size;
27 };
28 
29 VK_DEFINE_NONDISP_HANDLE_CASTS(radv_pipeline_binary, base, VkPipelineBinaryKHR, VK_OBJECT_TYPE_PIPELINE_BINARY_KHR)
30 
31 VkResult radv_create_pipeline_binary_from_shader(struct radv_device *device, const VkAllocationCallbacks *pAllocator,
32                                                  struct radv_shader *shader, struct util_dynarray *pipeline_binaries,
33                                                  uint32_t *num_binaries);
34 
35 VkResult radv_create_pipeline_binary_from_rt_shader(struct radv_device *device, const VkAllocationCallbacks *pAllocator,
36                                                     struct radv_shader *shader, bool is_traversal_shader,
37                                                     const uint8_t stage_sha1[SHA1_DIGEST_LENGTH],
38                                                     const struct radv_ray_tracing_stage_info *rt_stage_info,
39                                                     uint32_t stack_size, struct vk_pipeline_cache_object *nir,
40                                                     struct util_dynarray *pipeline_binaries, uint32_t *num_binaries);
41 
42 #endif /* RADV_PIPELINE_BINARY_H */
43