anv/rt: reduce writes to block_incr_and_start_prim
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36937>
This commit is contained in:
Felix DeGrood 2025-10-29 21:42:14 +00:00 committed by Marge Bot
parent 768bb1c7a3
commit 198537039a

View file

@ -383,13 +383,6 @@ encode_internal_node(uint32_t child, uint32_t child_block_offset_from_internal_n
DEREF(dst_node).node_type = node_type; DEREF(dst_node).node_type = node_type;
} }
uint32_t type = ir_id_to_type(child);
/* blockIncr and child_block_offset are how HW used to find children during traversal.
* If not set properly, gpu could hang.
*/
DEREF(dst_node).data[cluster.idx].block_incr_and_start_prim =
type == vk_ir_node_instance ? uint8_t(2) : uint8_t(1);
child_aabb = conservative_aabb(child_aabb); child_aabb = conservative_aabb(child_aabb);
vk_aabb quantize_aabb = quantize_bounds(child_aabb, conservative_child_aabb.min, exp_i8); vk_aabb quantize_aabb = quantize_bounds(child_aabb, conservative_child_aabb.min, exp_i8);
bool valid_leaf = cluster.idx < child_count; bool valid_leaf = cluster.idx < child_count;
@ -401,24 +394,19 @@ encode_internal_node(uint32_t child, uint32_t child_block_offset_from_internal_n
DEREF(dst_node).upper_y[cluster.idx] = valid_leaf ? uint8_t(quantize_aabb.max.y) : uint8_t(0); DEREF(dst_node).upper_y[cluster.idx] = valid_leaf ? uint8_t(quantize_aabb.max.y) : uint8_t(0);
DEREF(dst_node).upper_z[cluster.idx] = valid_leaf ? uint8_t(quantize_aabb.max.z) : uint8_t(0); DEREF(dst_node).upper_z[cluster.idx] = valid_leaf ? uint8_t(quantize_aabb.max.z) : uint8_t(0);
/* for a mixed node, encode type of each children in startPrim in childdata */ /* blockIncr and child_block_offset are how HW used to find children during traversal.
if (node_type == uint8_t(ANV_NODE_TYPE_MIXED)){ * If not set properly, gpu could hang.
*/
uint32_t type = ir_id_to_type(child); uint32_t type = ir_id_to_type(child);
switch (type){ uint8_t block_incr_and_start_prim = type == vk_ir_node_instance ? uint8_t(2) : uint8_t(1);
case vk_ir_node_triangle: /* for a mixed node, encode type of each children in startPrim in childdata */
DEREF(dst_node).data[cluster.idx].block_incr_and_start_prim |= (uint8_t(ANV_NODE_TYPE_QUAD) << 2); if (node_type == uint8_t(ANV_NODE_TYPE_MIXED))
break; block_incr_and_start_prim |=
case vk_ir_node_aabb: (type == vk_ir_node_triangle) ? (uint8_t(ANV_NODE_TYPE_QUAD) << 2) :
DEREF(dst_node).data[cluster.idx].block_incr_and_start_prim |= (uint8_t(ANV_NODE_TYPE_PROCEDURAL) << 2); (type == vk_ir_node_aabb) ? (uint8_t(ANV_NODE_TYPE_PROCEDURAL) << 2) :
break; (type == vk_ir_node_instance) ? (uint8_t(ANV_NODE_TYPE_INSTANCE) << 2) :
case vk_ir_node_instance: (type == vk_ir_node_internal) ? (uint8_t(ANV_NODE_TYPE_MIXED) << 2) : uint8_t(0);
DEREF(dst_node).data[cluster.idx].block_incr_and_start_prim |= (uint8_t(ANV_NODE_TYPE_INSTANCE) << 2); DEREF(dst_node).data[cluster.idx].block_incr_and_start_prim = block_incr_and_start_prim;
break;
case vk_ir_node_internal:
DEREF(dst_node).data[cluster.idx].block_incr_and_start_prim |= (uint8_t(ANV_NODE_TYPE_MIXED) << 2);
break;
}
}
} }
/* Collapse nodes until reaching 6 children, which typically can be /* Collapse nodes until reaching 6 children, which typically can be