vulkan/bvh: Add option to override leaf builder SPIR-Vs

With this, drivers can compile and use custom leaf builder versions
instead of the generic common shader.

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32797>
This commit is contained in:
Natalie Vock
2024-12-29 13:59:21 +01:00
committed by Marge Bot
parent 40b0ad0f45
commit e39994088a
2 changed files with 25 additions and 5 deletions
+20 -5
View File
@@ -506,12 +506,27 @@ build_leaves(VkCommandBuffer commandBuffer,
*/
VkResult result;
if (updateable) {
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);
const uint32_t *spirv = leaf_always_active_spv;
size_t spirv_size = sizeof(leaf_always_active_spv);
if (device->as_build_ops->leaf_always_active_spirv_override) {
spirv = device->as_build_ops->leaf_always_active_spirv_override;
spirv_size = device->as_build_ops->leaf_always_active_spirv_override_size;
}
result = get_pipeline_spv(device, meta, VK_META_OBJECT_KEY_LEAF_ALWAYS_ACTIVE, spirv,
spirv_size, sizeof(struct leaf_args), args,
&pipeline, &layout);
} else {
result = get_pipeline_spv(device, meta, VK_META_OBJECT_KEY_LEAF, leaf_spv, sizeof(leaf_spv),
const uint32_t *spirv = leaf_spv;
size_t spirv_size = sizeof(leaf_spv);
if (device->as_build_ops->leaf_spirv_override) {
spirv = device->as_build_ops->leaf_spirv_override;
spirv_size = device->as_build_ops->leaf_spirv_override_size;
}
result = get_pipeline_spv(device, meta, VK_META_OBJECT_KEY_LEAF, spirv, spirv_size,
sizeof(struct leaf_args), args, &pipeline, &layout);
}
@@ -93,6 +93,11 @@ struct vk_acceleration_structure_build_ops {
uint32_t leaf_count,
struct vk_acceleration_structure *src,
struct vk_acceleration_structure *dst);
const uint32_t *leaf_spirv_override;
size_t leaf_spirv_override_size;
const uint32_t *leaf_always_active_spirv_override;
size_t leaf_always_active_spirv_override_size;
};
struct vk_acceleration_structure_build_args {