mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 19:58:09 +02:00
anv/bvh: Fix copy shader handling sparse buffer
Fixes: 692b5fa9f2 ("anv: Add shader to copy acceleration structures")
This commit fixes the future test "sparse_binding_structures" for
"header_bottom_address" for ray tracing pipeline.
Even on 48-bit ray tracing (Xe1/2), the software-defined part
instance_leaf_part1.bvh_ptr has to be in canonical form for copy.comp
to deference a bvh, which means we have to preserve the upper 16bits.
This is especially relevant in cases where the acceleration structure buffer
is located high, such as sparse buffer.
Signed-off-by: Kevin Chuang <kaiwenjon23@gmail.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33745>
This commit is contained in:
parent
b9a980ea73
commit
87ff7b061f
2 changed files with 8 additions and 3 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue