From 407186994cea8e92c96aca498e24711c87ab9b63 Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Tue, 31 Dec 2024 14:33:04 +0100 Subject: [PATCH] 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 Part-of: --- src/amd/vulkan/radv_acceleration_structure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amd/vulkan/radv_acceleration_structure.c b/src/amd/vulkan/radv_acceleration_structure.c index af0a75f5781..fac85ebfc00 100644 --- a/src/amd/vulkan/radv_acceleration_structure.c +++ b/src/amd/vulkan/radv_acceleration_structure.c @@ -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);