diff --git a/src/intel/vulkan/bvh/anv_bvh.h b/src/intel/vulkan/bvh/anv_bvh.h index 2ba5c371ba5..c4efeac5b6e 100644 --- a/src/intel/vulkan/bvh/anv_bvh.h +++ b/src/intel/vulkan/bvh/anv_bvh.h @@ -252,7 +252,12 @@ struct instance_leaf_part0 { }; struct instance_leaf_part1 { - /* 48-bits pointer to BVH where start node belongs too */ + /* 48-bits pointer to BVH where start node belongs to. + * Note that this software-defined bvh_ptr has to be in canonical form for + * copy.comp to dereference, which means we have to preserve the upper 16 + * bits. For example, sparse buffer's heaps are located high, so its 63:48 + * are set to 1. + */ uint64_t bvh_ptr; /* The instanceCustomIndex in VkAccelerationStructureInstanceKHR */ diff --git a/src/intel/vulkan/bvh/copy.comp b/src/intel/vulkan/bvh/copy.comp index 070eee3307e..65856b3e85d 100644 --- a/src/intel/vulkan/bvh/copy.comp +++ b/src/intel/vulkan/bvh/copy.comp @@ -126,14 +126,14 @@ main(void) /* Indirectly access the anv_instance_leaf, and store the blas_ptrs after ser_header */ uint64_t instance_leaf_addr = DEREF(REF(uint64_t)(copy_src_addr + offset)); REF(anv_instance_leaf) instance_leaf = REF(anv_instance_leaf)(instance_leaf_addr); - uint64_t blas_ptr = DEREF(instance_leaf).part1.bvh_ptr & 0xfffffffffffful; + uint64_t blas_ptr = DEREF(instance_leaf).part1.bvh_ptr; DEREF(INDEX(uint64_t, instance_base, idx)) = blas_ptr; } else { /* ANV_COPY_MODE_DESERIALIZE */ /* Indirectly access the anv_instance_leaf, and replace the bvh_ptr with the ones after ser_header */ uint64_t instance_leaf_addr = DEREF(REF(uint64_t)(copy_dst_addr + offset)); REF(anv_instance_leaf) instance_leaf = REF(anv_instance_leaf)(instance_leaf_addr); uint64_t blas_ptr = DEREF(INDEX(uint64_t, instance_base, idx)); - DEREF(instance_leaf).part1.bvh_ptr = (blas_ptr & 0xfffffffffffful); + DEREF(instance_leaf).part1.bvh_ptr = blas_ptr; /* set the startNodePtr to blas_ptr + ANV_HEADER_SIZE */ uint64_t mask = 0x0000fffffffffffful;