anv/rt: fully restore code to write instance_count

Conformance tests and games still pass without this code, but
spec says we need it:
  https://registry.khronos.org/vulkan/specs/latest/html/
  vkspec.html#vkCmdCopyAccelerationStructureToMemoryKHR

This is potentially expensive code. There may be a future
opportunity to optimize this out. Need to research.

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-10 19:35:37 +00:00 committed by Marge Bot
parent cff9d82c66
commit 09c218e8aa

View file

@ -251,7 +251,10 @@ encode_leaf_node(uint32_t type, uint64_t src_node, uint64_t dst_node, REF(anv_ac
DEREF(dst_instance).part1.instance_index = src.instance_id;
DEREF(dst_instance).part1.instance_id = src.custom_instance_and_mask & 0xffffff;
uint64_t instance_leaves_addr_base = args.output_bvh -
args.output_bvh_offset + ANV_RT_BVH_HEADER_SIZE;
uint64_t cnt = atomicAdd(DEREF(dst_header).instance_count, 1);
DEREF(INDEX(uint64_t, instance_leaves_addr_base, cnt)) = dst_node;
break;
}
}