radv/rt: Track number of inactive leaf nodes

To avoid emitting nodes with only invalid children in 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 00:01:51 +02:00
committed by Marge Bot
parent f502b3aab3
commit 608fa1bd25
3 changed files with 9 additions and 0 deletions

View File

@@ -135,6 +135,7 @@ struct radv_ir_instance_node {
struct radv_ir_header {
int32_t min_bounds[3];
int32_t max_bounds[3];
uint32_t active_leaf_count;
/* 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. */

View File

@@ -146,6 +146,7 @@ main()
if (valid_grandchild_count > 0)
children[collapsed_child_index] = grandchildren[0];
if (in_final_tree == FINAL_TREE_PRESENT)
DEREF(child_node).in_final_tree = FINAL_TREE_NOT_PRESENT;
} else

View File

@@ -33,6 +33,9 @@
#extension GL_EXT_scalar_block_layout : require
#extension GL_EXT_buffer_reference : require
#extension GL_EXT_buffer_reference2 : require
#extension GL_KHR_shader_subgroup_vote : require
#extension GL_KHR_shader_subgroup_arithmetic : require
#extension GL_KHR_shader_subgroup_ballot : require
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
@@ -300,6 +303,10 @@ main(void)
DEREF(id_ptr).id = is_active ? pack_ir_node_id(dst_offset, node_type) : RADV_BVH_INVALID_NODE;
uvec4 ballot = subgroupBallot(is_active);
if (subgroupElect())
atomicAdd(DEREF(args.header).active_leaf_count, subgroupBallotBitCount(ballot));
atomicMin(DEREF(args.header).min_bounds[0], to_emulated_float(bounds.min.x));
atomicMin(DEREF(args.header).min_bounds[1], to_emulated_float(bounds.min.y));
atomicMin(DEREF(args.header).min_bounds[2], to_emulated_float(bounds.min.z));