anv/rt: Increment block count only for valid children
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

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: 198537039a ("anv/rt: reduce writes to block_incr_and_start_prim")
Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Felix DeGrood <felix.j.degrood@intel.com>
Tested-by: Felix DeGrood <felix.j.degrood@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38717>
This commit is contained in:
Sagar Ghuge 2025-11-28 12:29:26 -08:00 committed by Marge Bot
parent f734dff419
commit 560b21fe49

View file

@ -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;
}