radv: Fix encoding empty acceleration structures

There will always be at least one internal node so the expectation that
there are more leaf nodes than internal nodes dows not hold when the
acceleration structure has no leaf nodes.

Fixes: f8b584d ("vulkan/runtime,radv: Add shared BVH building framework")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12302
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32820>
This commit is contained in:
Konstantin Seurer 2024-12-31 14:33:04 +01:00
parent 2f76bdf35d
commit 407186994c

View file

@ -451,7 +451,7 @@ radv_encode_as(VkCommandBuffer commandBuffer, const VkAccelerationStructureBuild
struct radv_dispatch_info dispatch = {
.unaligned = true,
.ordered = true,
.blocks = {leaf_count, 1, 1},
.blocks = {MAX2(leaf_count, 1), 1, 1},
};
radv_compute_dispatch(cmd_buffer, &dispatch);