radv: Fix handling of primitiveOffset
VkAccelerationStructureBuildRangeInfoKHR spec: If the geometry uses indices, primitiveCount × 3 indices are consumed from VkAccelerationStructureGeometryTrianglesDataKHR::indexData, starting at an offset of primitiveOffset. The value of firstVertex is added to the index values before fetching vertices. If the geometry does not use indices, primitiveCount × 3 vertices are consumed from VkAccelerationStructureGeometryTrianglesDataKHR::vertexData, starting at an offset of primitiveOffset + VkAccelerationStructureGeometryTrianglesDataKHR::vertexStride × firstVertex. Meaning: We always add firstVertex * vertexStride to the vertex address and add primitiveOffset either to the vertex address or the index address, depending on wether indices are used. Also add missing handling with instances. Fixes: 0dad88b4 ("radv: Implement device-side BVH building.") Signed-off-by:Konstantin Seurer <konstantin.seurer@gmail.com> Reviewed-by:
Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <mesa/mesa!16719>
Loading
Please register or sign in to comment