mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
radv/bvh: Implement compact encoding
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20818>
This commit is contained in:
parent
71ccc8d600
commit
07c1b23022
3 changed files with 11 additions and 1 deletions
|
|
@ -165,6 +165,7 @@ struct radv_ir_header {
|
|||
uint32_t dispatch_size_y;
|
||||
uint32_t dispatch_size_z;
|
||||
radv_global_sync_data sync_data;
|
||||
uint32_t dst_node_offset;
|
||||
};
|
||||
|
||||
struct radv_bvh_triangle_node {
|
||||
|
|
|
|||
|
|
@ -233,9 +233,13 @@ main()
|
|||
uint32_t dst_offset;
|
||||
|
||||
if (type == radv_ir_node_internal) {
|
||||
#if COMPACT
|
||||
dst_offset = atomicAdd(DEREF(args.header).dst_node_offset, SIZEOF(radv_bvh_box32_node));
|
||||
#else
|
||||
uint32_t offset_in_internal_nodes = offset - intermediate_leaf_nodes_size;
|
||||
uint32_t child_index = offset_in_internal_nodes / SIZEOF(radv_ir_box_node);
|
||||
dst_offset = dst_internal_offset + child_index * SIZEOF(radv_bvh_box32_node);
|
||||
#endif
|
||||
|
||||
REF(radv_ir_box_node) child_node = REF(radv_ir_box_node)OFFSET(args.intermediate_bvh, offset);
|
||||
DEREF(child_node).bvh_offset = dst_offset;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,12 @@ bvh_shaders = [
|
|||
[
|
||||
'encode.comp',
|
||||
'encode',
|
||||
[],
|
||||
['COMPACT=0'],
|
||||
],
|
||||
[
|
||||
'encode.comp',
|
||||
'encode_compact',
|
||||
['COMPACT=1'],
|
||||
],
|
||||
[
|
||||
'lbvh_generate_ir.comp',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue