From 7e072cfba2ccee3f730c2a05acf35fd8ea2356f6 Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Mon, 30 Jan 2023 16:12:28 +0100 Subject: [PATCH] radv: Improve the BVH size estimation The previous estimation was from before we had proper LBVH and PLOC. Part-of: --- src/amd/vulkan/radv_acceleration_structure.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/amd/vulkan/radv_acceleration_structure.c b/src/amd/vulkan/radv_acceleration_structure.c index f69a64eeb55..b81f587b8b5 100644 --- a/src/amd/vulkan/radv_acceleration_structure.c +++ b/src/amd/vulkan/radv_acceleration_structure.c @@ -126,13 +126,7 @@ get_build_layout(struct radv_device *device, uint32_t leaf_count, const VkAccelerationStructureBuildGeometryInfoKHR *build_info, struct acceleration_structure_layout *accel_struct, struct scratch_layout *scratch) { - /* Initialize to 1 to have enought space for the root node. */ - uint32_t child_count = leaf_count; - uint32_t internal_count = 1; - while (child_count > 1) { - child_count = DIV_ROUND_UP(child_count, 2); - internal_count += child_count; - } + uint32_t internal_count = MAX2(leaf_count, 2) - 1; VkGeometryTypeKHR geometry_type = VK_GEOMETRY_TYPE_TRIANGLES_KHR;