From 560b21fe49c75a7bc9b696d92325a87a37759d0e Mon Sep 17 00:00:00 2001 From: Sagar Ghuge Date: Fri, 28 Nov 2025 12:29:26 -0800 Subject: [PATCH] anv/rt: Increment block count only for valid children If invalid childrens don't consume space in memory, we don't have to increment the block count. HW unit just look at the bounding boxes and reject them in intersection test. Also, this patch handles invalid children type encoding. Fixes: 198537039a7b ("anv/rt: reduce writes to block_incr_and_start_prim") Signed-off-by: Sagar Ghuge Reviewed-by: Felix DeGrood Tested-by: Felix DeGrood Part-of: --- src/intel/vulkan/bvh/encode.comp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/bvh/encode.comp b/src/intel/vulkan/bvh/encode.comp index 0ecae5867c8..78d4f5582c7 100644 --- a/src/intel/vulkan/bvh/encode.comp +++ b/src/intel/vulkan/bvh/encode.comp @@ -398,14 +398,17 @@ encode_internal_node(uint32_t child, uint32_t child_block_offset_from_internal_n * If not set properly, gpu could hang. */ uint32_t type = ir_id_to_type(child); - uint8_t block_incr_and_start_prim = type == vk_ir_node_instance ? uint8_t(2) : uint8_t(1); + uint8_t block_incr_and_start_prim = valid_leaf ? + (type == vk_ir_node_instance ? uint8_t(2) : uint8_t(1)) : + uint8_t(0); /* for a mixed node, encode type of each children in startPrim in childdata */ if (node_type == uint8_t(ANV_NODE_TYPE_MIXED)) block_incr_and_start_prim |= (type == vk_ir_node_triangle) ? (uint8_t(ANV_NODE_TYPE_QUAD) << 2) : (type == vk_ir_node_aabb) ? (uint8_t(ANV_NODE_TYPE_PROCEDURAL) << 2) : (type == vk_ir_node_instance) ? (uint8_t(ANV_NODE_TYPE_INSTANCE) << 2) : - (type == vk_ir_node_internal) ? (uint8_t(ANV_NODE_TYPE_MIXED) << 2) : uint8_t(0); + (type == vk_ir_node_internal) ? (uint8_t(ANV_NODE_TYPE_MIXED) << 2) : + (uint8_t(ANV_NODE_TYPE_INVALID) << 2); DEREF(dst_node).data[cluster.idx].block_incr_and_start_prim = block_incr_and_start_prim; }