Clarification about supported data format for host/device acceleration structure builds

I am currently exploring different ways of building acceleration structures and got myself a bit confused about the data that may be passed to vkCmdBuildAccelerationStructuresKHR or vkBuildAccelerationStructuresKHR – the former being a device-build, and the latter being a host-build – and I’ve got a couple of questions:

  1. Is it true that when providing (instance) data via VkAccelerationStructureGeometryInstancesDataKHR::data, one cannot mix both device and host addresses?
  2. I.e. more specifically: Is it true that only device addresses may be used with device builds (i.e. vkCmdBuildAccelerationStructuresKHR)?
  3. …and only host addresses may be used with host builds (i.e. vkBuildAccelerationStructuresKHR)?
  4. Is it true that when using the “array of pointers” format – which can be configured by setting VkAccelerationStructureGeometryInstancesDataKHR::arrayOfPointers to VK_TRUE – with a device build (i.e. vkCmdBuildAccelerationStructuresKHR), the buffer that holds the array of pointers must be a device buffer? (I.e. VkAccelerationStructureGeometryInstancesDataKHR::data must be set to a device address and cannot be a host address.)
  5. …and analogously, for “array of pointers” with host builds (i.e. vkBuildAccelerationStructuresKHR), VkAccelerationStructureGeometryInstancesDataKHR::data must be set to a host address and cannot be a device address, right?
  6. Is it true that one cannot specify multiple arrays of consecutive (instance) data elements for acceleration structure builds, but the only options are to EITHER specify one and only one consecutive chunk of memory that contains all elements OR specify one pointer for each single element – despite many of them could be located in consecutive memory?

Regarding the my last question: What I would like to do is to build a top-level acceleration structure from consecutive data residing in two different buffers. E.g. the first buffer contains 1000 AABBs, and the second contains 2 instances of a triangle mesh bottom-level acceleration structure. If I see it correctly, it is not possible to pass ~“pointers to arrays of elements”, right?

Is it true that my options are to either:

  • create a combined buffer of 1002 instance elements, and copy both, the 1000 AABB instances and the 2 triangle mesh instances, into it; and use the new (temporary) buffer for the acceleration structure build, or
  • create an “array of pointers”-style buffer of 1002 elements and fill it with each individual address – one for each of the 1002 elements (despite the first 1000 elements, and also the last 2 elements, lie in consecutive memory).

Is that about right?

Please correct me if I’m wrong and please point me to alternatives if there are any!

1 Like

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.