radv/rt: Dispatch internal converter indirectly

Preparation for using the converter with PLOC.

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19292>
This commit is contained in:
Friedrich Vock
2022-10-28 22:02:07 +02:00
committed by Marge Bot
parent 49c0995918
commit f502b3aab3
2 changed files with 13 additions and 1 deletions

View File

@@ -135,7 +135,12 @@ struct radv_ir_instance_node {
struct radv_ir_header {
int32_t min_bounds[3];
int32_t max_bounds[3];
/* Indirect dispatch dimensions for the internal node converter.
* ir_internal_node_count is the thread count in the X dimension,
* while Y and Z are always set to 1. */
uint32_t ir_internal_node_count;
uint32_t dispatch_size_y;
uint32_t dispatch_size_z;
};
struct radv_bvh_triangle_node {

View File

@@ -725,7 +725,10 @@ convert_internal_nodes(VkCommandBuffer commandBuffer, uint32_t infoCount,
radv_CmdPushConstants(
commandBuffer, cmd_buffer->device->meta_state.accel_struct_build.convert_internal_p_layout,
VK_SHADER_STAGE_COMPUTE_BIT, 0, sizeof(args), &args);
radv_unaligned_dispatch(cmd_buffer, bvh_states[i].internal_node_count, 1, 1);
radv_indirect_unaligned_dispatch(cmd_buffer, NULL,
pInfos[i].scratchData.deviceAddress +
bvh_states[i].scratch.header_offset +
offsetof(struct radv_ir_header, ir_internal_node_count));
}
/* This is the final access to the leaf nodes, no need to flush */
}
@@ -760,9 +763,13 @@ radv_CmdBuildAccelerationStructuresKHR(
get_build_layout(cmd_buffer->device, leaf_node_count, pInfos + i, &bvh_states[i].accel_struct,
&bvh_states[i].scratch);
/* The internal node count is updated in lbvh_build_internal for LBVH
* and from the PLOC shader for PLOC. */
struct radv_ir_header header = {
.min_bounds = {0x7fffffff, 0x7fffffff, 0x7fffffff},
.max_bounds = {0x80000000, 0x80000000, 0x80000000},
.dispatch_size_y = 1,
.dispatch_size_z = 1,
};
radv_update_buffer_cp(