From b9a980ea731f368d090f1ce2492c0ce096104691 Mon Sep 17 00:00:00 2001 From: Kevin Chuang Date: Tue, 25 Feb 2025 12:35:12 -0800 Subject: [PATCH] anv/bvh: Fix encoder handling sparse buffer Fixes: 2fe57947e378 ("anv: Implement encode shader to fit in ANV BVH") This commit resolves the failures in the future tests "sparse_binding_structures" for rayquery. Sparse buffers' heaps are located high, and since it's in canonical form, the higher 16bits are all set to 1. However, the existing encoder did not expect any non-zero values at the higher 16bits. As a result, the instance flags got corrupted, causing most triangle tests to fail. Thanks for Paulo providing insights about sparse buffer properties. Co-developed-by: Paulo Zanoni Signed-off-by: Kevin Chuang Reviewed-by: Sagar Ghuge Part-of: --- src/intel/vulkan/bvh/encode.comp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/vulkan/bvh/encode.comp b/src/intel/vulkan/bvh/encode.comp index c9a485a3ba0..884edeb970b 100644 --- a/src/intel/vulkan/bvh/encode.comp +++ b/src/intel/vulkan/bvh/encode.comp @@ -153,7 +153,7 @@ encode_leaf_node(uint32_t type, uint64_t src_node, uint64_t dst_node, REF(anv_ac } DEREF(dst_instance).part0.start_node_ptr_and_inst_flags = - start_node_ptr | + (start_node_ptr & ((1ul << 48) - 1)) | (get_instance_flag(instance_flags | (src.sbt_offset_and_flags >> 24)) << 48); mat4 transform = mat4(src.otw_matrix);