To copy an acceleration structure to device memory call:
// Provided by VK_KHR_acceleration_structure void vkCmdCopyAccelerationStructureToMemoryKHR( VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR* pInfo);
commandBufferis the command buffer into which the command will be recorded.
pInfois an a pointer to a VkCopyAccelerationStructureToMemoryInfoKHR structure defining the copy operation.
pInfo->src must be synchronized with the
pipeline stage and an
access type of
Accesses to the buffer indicated by
pInfo->dst.deviceAddress must be
synchronized with the
VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR pipeline stage
and an access type of
This command produces the same results as vkCopyAccelerationStructureToMemoryKHR, but writes its result to a device address, and is executed on the device rather than the host. The output may not necessarily be bit-for-bit identical, but it can be equally used by either vkCmdCopyMemoryToAccelerationStructureKHR or vkCopyMemoryToAccelerationStructureKHR.
The defined header structure for the serialized data consists of:
VK_UUID_SIZEbytes of data matching
VK_UUID_SIZEbytes of data identifying the compatibility for comparison using vkGetDeviceAccelerationStructureCompatibilityKHR
A 64-bit integer of the total size matching the value queried using
A 64-bit integer of the deserialized size to be passed in to
A 64-bit integer of the count of the number of acceleration structure handles following. This will be zero for a bottom-level acceleration structure. For top-level acceleration structures this number is implementation-dependent; the number of and ordering of the handles may not match the instance descriptions which were used to build the acceleration structure.
The corresponding handles matching the values returned by vkGetAccelerationStructureDeviceAddressKHR or vkGetAccelerationStructureHandleNV are tightly packed in the buffer following the count. The application is expected to store a mapping between those handles and the original application-generated bottom-level acceleration structures to provide when deserializing. The serialized data is written to the buffer (or read from the buffer) according to the host endianness.
For more information, see the Vulkan Specification
This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.