Function Prototype

vkCreateAccelerationStructure2KHR

Create a new acceleration structure object using a device address

To create an acceleration structure using a device address, call:

VkResult vkCreateAccelerationStructure2KHR(
    VkDevice                                     device,
    const VkAccelerationStructureCreateInfo2KHR* pCreateInfo,
    const VkAllocationCallbacks* pAllocator,
    VkAccelerationStructureKHR*                  pAccelerationStructure);
  • device is the logical device that creates the acceleration structure object.
  • pCreateInfo is a pointer to a VkAccelerationStructureCreateInfo2KHR structure containing parameters affecting creation of the acceleration structure.
  • pAllocator controls host memory allocation as described in the Memory Allocation chapter.
  • pAccelerationStructure is a pointer to a VkAccelerationStructureKHR handle in which the resulting acceleration structure object is returned.

Similar to other objects in Vulkan, the acceleration structure creation merely creates an object with a specific shape. The type and quantity of geometry that can be built into an acceleration structure is determined by the parameters of VkAccelerationStructureCreateInfo2KHR.

The acceleration structure data is stored in the object referred to by VkAccelerationStructureCreateInfo2KHR::addressRange.address.

Once the VkAccelerationStructureKHR object has been created, it must be populated by acceleration structure build or acceleration structure copy commands such as vkCmdBuildAccelerationStructuresKHR and vkCmdCopyAccelerationStructureKHR. Acceleration structures created with this command must not be used by host commands.

The expected usage for a trace capture/replay tool is that it will serialize and later deserialize the acceleration structure data using acceleration structure copy commands. During capture the tool will use vkCmdCopyAccelerationStructureToMemoryKHR with a mode of VK_COPY_ACCELERATION_STRUCTURE_MODE_SERIALIZE_KHR, and vkCmdCopyMemoryToAccelerationStructureKHR with a mode of VK_COPY_ACCELERATION_STRUCTURE_MODE_DESERIALIZE_KHR during replay.

Valid Usage (Implicit)

VUID-vkCreateAccelerationStructure2KHR-pAllocator-parameter

If pAllocator is not NULL, pAllocator must be a valid pointer to a valid VkAllocationCallbacks structure

VUID-vkCreateAccelerationStructure2KHR-device-queuecount

The device must have been created with at least 1 queue