mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-22 22:50:32 +01:00
vulkan: Stop using strings for BVH build pipeline keys
The intended use is to pass a keys struct with vk_meta_object_key_type as its first member. Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32881>
This commit is contained in:
parent
5572e274e2
commit
3319e496f7
2 changed files with 18 additions and 12 deletions
|
|
@ -303,24 +303,22 @@ struct bvh_batch_state {
|
|||
|
||||
static VkResult
|
||||
get_pipeline_spv(struct vk_device *device, struct vk_meta_device *meta,
|
||||
const char *name, const uint32_t *spv, uint32_t spv_size,
|
||||
enum vk_meta_object_key_type key, const uint32_t *spv, uint32_t spv_size,
|
||||
unsigned push_constant_size,
|
||||
const struct vk_acceleration_structure_build_args *args,
|
||||
VkPipeline *pipeline, VkPipelineLayout *layout)
|
||||
{
|
||||
size_t key_size = strlen(name);
|
||||
|
||||
VkResult result = vk_meta_get_pipeline_layout(
|
||||
device, meta, NULL,
|
||||
&(VkPushConstantRange){
|
||||
VK_SHADER_STAGE_COMPUTE_BIT, 0, push_constant_size
|
||||
},
|
||||
name, key_size, layout);
|
||||
&key, sizeof(key), layout);
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
return result;
|
||||
|
||||
VkPipeline pipeline_from_cache = vk_meta_lookup_pipeline(meta, name, key_size);
|
||||
VkPipeline pipeline_from_cache = vk_meta_lookup_pipeline(meta, &key, sizeof(key));
|
||||
if (pipeline_from_cache != VK_NULL_HANDLE) {
|
||||
*pipeline = pipeline_from_cache;
|
||||
return VK_SUCCESS;
|
||||
|
|
@ -382,7 +380,7 @@ get_pipeline_spv(struct vk_device *device, struct vk_meta_device *meta,
|
|||
};
|
||||
|
||||
return vk_meta_create_compute_pipeline(device, meta, &pipeline_info,
|
||||
name, key_size, pipeline);
|
||||
&key, sizeof(key), pipeline);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
|
|
@ -508,12 +506,12 @@ build_leaves(VkCommandBuffer commandBuffer,
|
|||
*/
|
||||
VkResult result;
|
||||
if (updateable) {
|
||||
result = get_pipeline_spv(device, meta, "leaves_always_active",
|
||||
result = get_pipeline_spv(device, meta, VK_META_OBJECT_KEY_LEAF_ALWAYS_ACTIVE,
|
||||
leaf_always_active_spv,
|
||||
sizeof(leaf_always_active_spv),
|
||||
sizeof(struct leaf_args), args, &pipeline, &layout);
|
||||
} else {
|
||||
result = get_pipeline_spv(device, meta, "leaves", leaf_spv, sizeof(leaf_spv),
|
||||
result = get_pipeline_spv(device, meta, VK_META_OBJECT_KEY_LEAF, leaf_spv, sizeof(leaf_spv),
|
||||
sizeof(struct leaf_args), args, &pipeline, &layout);
|
||||
}
|
||||
|
||||
|
|
@ -579,7 +577,7 @@ morton_generate(VkCommandBuffer commandBuffer, struct vk_device *device,
|
|||
VkPipelineLayout layout;
|
||||
|
||||
VkResult result =
|
||||
get_pipeline_spv(device, meta, "morton", morton_spv, sizeof(morton_spv),
|
||||
get_pipeline_spv(device, meta, VK_META_OBJECT_KEY_MORTON, morton_spv, sizeof(morton_spv),
|
||||
sizeof(struct morton_args), args, &pipeline, &layout);
|
||||
|
||||
if (result != VK_SUCCESS)
|
||||
|
|
@ -864,7 +862,7 @@ lbvh_build_internal(VkCommandBuffer commandBuffer,
|
|||
VkPipelineLayout layout;
|
||||
|
||||
VkResult result =
|
||||
get_pipeline_spv(device, meta, "lbvh_main", lbvh_main_spv,
|
||||
get_pipeline_spv(device, meta, VK_META_OBJECT_KEY_LBVH_MAIN, lbvh_main_spv,
|
||||
sizeof(lbvh_main_spv),
|
||||
sizeof(struct lbvh_main_args), args, &pipeline, &layout);
|
||||
|
||||
|
|
@ -905,7 +903,7 @@ lbvh_build_internal(VkCommandBuffer commandBuffer,
|
|||
vk_barrier_compute_w_to_compute_r(commandBuffer);
|
||||
|
||||
result =
|
||||
get_pipeline_spv(device, meta, "lbvh_generate_ir", lbvh_generate_ir_spv,
|
||||
get_pipeline_spv(device, meta, VK_META_OBJECT_KEY_LBVH_GENERATE_IR, lbvh_generate_ir_spv,
|
||||
sizeof(lbvh_generate_ir_spv),
|
||||
sizeof(struct lbvh_generate_ir_args), args, &pipeline, &layout);
|
||||
|
||||
|
|
@ -948,7 +946,7 @@ ploc_build_internal(VkCommandBuffer commandBuffer,
|
|||
VkPipelineLayout layout;
|
||||
|
||||
VkResult result =
|
||||
get_pipeline_spv(device, meta, "ploc", ploc_spv,
|
||||
get_pipeline_spv(device, meta, VK_META_OBJECT_KEY_PLOC, ploc_spv,
|
||||
sizeof(ploc_spv),
|
||||
sizeof(struct ploc_args), args, &pipeline, &layout);
|
||||
|
||||
|
|
|
|||
|
|
@ -167,6 +167,14 @@ enum vk_meta_object_key_type {
|
|||
VK_META_OBJECT_KEY_COPY_IMAGE_PIPELINE,
|
||||
VK_META_OBJECT_KEY_FILL_BUFFER_PIPELINE,
|
||||
|
||||
/* BVH build pipelines */
|
||||
VK_META_OBJECT_KEY_LEAF,
|
||||
VK_META_OBJECT_KEY_LEAF_ALWAYS_ACTIVE,
|
||||
VK_META_OBJECT_KEY_MORTON,
|
||||
VK_META_OBJECT_KEY_LBVH_MAIN,
|
||||
VK_META_OBJECT_KEY_LBVH_GENERATE_IR,
|
||||
VK_META_OBJECT_KEY_PLOC,
|
||||
|
||||
/* Should be used as an offset for driver-specific object types. */
|
||||
VK_META_OBJECT_KEY_DRIVER_OFFSET = 0x80000000,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue