diff --git a/src/amd/vulkan/bvh/build_interface.h b/src/amd/vulkan/bvh/build_interface.h index dbb866fa3d3..e8bc1c519c7 100644 --- a/src/amd/vulkan/bvh/build_interface.h +++ b/src/amd/vulkan/bvh/build_interface.h @@ -57,14 +57,6 @@ struct morton_args { REF(key_id_pair) ids; }; -struct lbvh_internal_args { - VOID_REF bvh; - REF(key_id_pair) src_ids; - REF(key_id_pair) dst_ids; - uint32_t dst_offset; - uint32_t src_count; -}; - #define LBVH_RIGHT_CHILD_BIT_SHIFT 29 #define LBVH_RIGHT_CHILD_BIT (1 << LBVH_RIGHT_CHILD_BIT_SHIFT) diff --git a/src/amd/vulkan/bvh/lbvh_internal.comp b/src/amd/vulkan/bvh/lbvh_internal.comp deleted file mode 100644 index aac09d5bfc9..00000000000 --- a/src/amd/vulkan/bvh/lbvh_internal.comp +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright © 2022 Konstantin Seurer - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#version 460 - -#extension GL_GOOGLE_include_directive : require - -#extension GL_EXT_shader_explicit_arithmetic_types_int8 : require -#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require -#extension GL_EXT_shader_explicit_arithmetic_types_int32 : require -#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require -#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require -#extension GL_EXT_scalar_block_layout : require -#extension GL_EXT_buffer_reference : require -#extension GL_EXT_buffer_reference2 : require - -layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in; - -#include "build_interface.h" - -layout(push_constant) uniform CONSTS { - lbvh_internal_args args; -}; - -void -main(void) -{ - uint32_t global_id = gl_GlobalInvocationID.x; - - uint32_t src_index = global_id * 2; - uint32_t child_count = min(args.src_count - src_index, 2); - - uint32_t dst_offset = args.dst_offset + global_id * SIZEOF(radv_ir_box_node); - uint32_t current_id = pack_ir_node_id(dst_offset, radv_ir_node_internal); - - REF(radv_ir_box_node) dst_node = REF(radv_ir_box_node)(OFFSET(args.bvh, dst_offset)); - - radv_aabb total_bounds; - total_bounds.min = vec3(INFINITY); - total_bounds.max = vec3(-INFINITY); - - bool is_active = false; - for (uint32_t i = 0; i < 2; i++) { - radv_aabb bounds; - bounds.min = vec3(NAN); - bounds.max = vec3(NAN); - - uint32_t child_id = DEREF(INDEX(key_id_pair, args.src_ids, src_index + i)).id; - - if (i < child_count && child_id != RADV_BVH_INVALID_NODE) { - VOID_REF node = OFFSET(args.bvh, ir_id_to_offset(child_id)); - REF(radv_ir_node) child = REF(radv_ir_node)(node); - bounds = DEREF(child).aabb; - - total_bounds.min = min(total_bounds.min, bounds.min); - total_bounds.max = max(total_bounds.max, bounds.max); - is_active = true; - } else { - child_id = RADV_BVH_INVALID_NODE; - } - - DEREF(dst_node).children[i] = child_id; - } - DEREF(dst_node).base.aabb = total_bounds; - DEREF(dst_node).in_final_tree = is_active ? FINAL_TREE_UNKNOWN : FINAL_TREE_NOT_PRESENT; - - /* An internal node is considered inactive if it has no children. Set the resulting scratch node - * id to RADV_BVH_INVALID_NODE for more internal nodes to become inactive. - */ - DEREF(INDEX(key_id_pair, args.dst_ids, global_id)).id = is_active ? current_id : RADV_BVH_INVALID_NODE; -} diff --git a/src/amd/vulkan/bvh/meson.build b/src/amd/vulkan/bvh/meson.build index c63818292b6..53acde80cf5 100644 --- a/src/amd/vulkan/bvh/meson.build +++ b/src/amd/vulkan/bvh/meson.build @@ -20,7 +20,6 @@ bvh_shaders = [ 'copy.comp', - 'lbvh_internal.comp', 'lbvh_generate_ir.comp', 'lbvh_main.comp', 'leaf.comp', diff --git a/src/amd/vulkan/radv_acceleration_structure.c b/src/amd/vulkan/radv_acceleration_structure.c index da60346b8a6..805cdf9edcb 100644 --- a/src/amd/vulkan/radv_acceleration_structure.c +++ b/src/amd/vulkan/radv_acceleration_structure.c @@ -39,10 +39,6 @@ static const uint32_t morton_spv[] = { #include "bvh/morton.comp.spv.h" }; -static const uint32_t lbvh_internal_spv[] = { -#include "bvh/lbvh_internal.comp.spv.h" -}; - static const uint32_t lbvh_main_spv[] = { #include "bvh/lbvh_main.comp.spv.h" }; @@ -333,8 +329,6 @@ radv_device_finish_accel_struct_build_state(struct radv_device *device) state->accel_struct_build.lbvh_generate_ir_pipeline, &state->alloc); radv_DestroyPipeline(radv_device_to_handle(device), state->accel_struct_build.lbvh_main_pipeline, &state->alloc); - radv_DestroyPipeline(radv_device_to_handle(device), - state->accel_struct_build.lbvh_internal_pipeline, &state->alloc); radv_DestroyPipeline(radv_device_to_handle(device), state->accel_struct_build.leaf_pipeline, &state->alloc); radv_DestroyPipeline(radv_device_to_handle(device), @@ -351,8 +345,6 @@ radv_device_finish_accel_struct_build_state(struct radv_device *device) state->accel_struct_build.lbvh_generate_ir_p_layout, &state->alloc); radv_DestroyPipelineLayout(radv_device_to_handle(device), state->accel_struct_build.lbvh_main_p_layout, &state->alloc); - radv_DestroyPipelineLayout(radv_device_to_handle(device), - state->accel_struct_build.lbvh_internal_p_layout, &state->alloc); radv_DestroyPipelineLayout(radv_device_to_handle(device), state->accel_struct_build.leaf_p_layout, &state->alloc); radv_DestroyPipelineLayout(radv_device_to_handle(device), @@ -448,13 +440,6 @@ radv_device_init_accel_struct_build_state(struct radv_device *device) if (result != VK_SUCCESS) return result; - result = create_build_pipeline_spv( - device, lbvh_internal_spv, sizeof(lbvh_internal_spv), sizeof(struct lbvh_internal_args), - &device->meta_state.accel_struct_build.lbvh_internal_pipeline, - &device->meta_state.accel_struct_build.lbvh_internal_p_layout); - if (result != VK_SUCCESS) - return result; - result = create_build_pipeline_spv(device, lbvh_main_spv, sizeof(lbvh_main_spv), sizeof(struct lbvh_main_args), &device->meta_state.accel_struct_build.lbvh_main_pipeline, diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 8dfa91b5138..2ae445dd41e 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -677,8 +677,6 @@ struct radv_meta_state { VkPipeline leaf_pipeline; VkPipelineLayout morton_p_layout; VkPipeline morton_pipeline; - VkPipelineLayout lbvh_internal_p_layout; - VkPipeline lbvh_internal_pipeline; VkPipelineLayout lbvh_main_p_layout; VkPipeline lbvh_main_pipeline; VkPipelineLayout lbvh_generate_ir_p_layout;