Function Prototype

vkGetAccelerationStructureDeviceAddressKHR

Query an address of an acceleration structure

To query the 64-bit device address for an acceleration structure, call:

VkDeviceAddress vkGetAccelerationStructureDeviceAddressKHR(
    VkDevice device,
    const VkAccelerationStructureDeviceAddressInfoKHR* pInfo);
  • device is the logical device that the acceleration structure was created on.
  • pInfo is a pointer to a VkAccelerationStructureDeviceAddressInfoKHR structure specifying the acceleration structure to retrieve an address for.

The 64-bit return value is an address of the acceleration structure, which can be used for device and shader operations that involve acceleration structures, such as ray traversal and acceleration structure building.

If the acceleration structure was created with a non-zero value of VkAccelerationStructureCreateInfoKHR::deviceAddress, the return value will be the same address.

If the acceleration structure was created with a type of VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR, the returned address must be consistent with the relative offset to other acceleration structures with type VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR allocated with the same VkBuffer. That is, the difference in returned addresses between the two must be the same as the difference in offsets provided at acceleration structure creation.

The returned address must be aligned to 256 bytes.

The acceleration structure device address may be different from the buffer device address corresponding to the acceleration structure’s start offset in its storage buffer for acceleration structure types other than VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR.

Valid Usage

VUID-vkGetAccelerationStructureDeviceAddressKHR-device-03504

If device was created with multiple physical devices, then the bufferDeviceAddressMultiDevice feature must be enabled

VUID-vkGetAccelerationStructureDeviceAddressKHR-pInfo-09541

If the buffer on which pInfo→accelerationStructure was placed is non-sparse then it must be bound completely and contiguously to a single VkDeviceMemory object

VUID-vkGetAccelerationStructureDeviceAddressKHR-pInfo-09542

The buffer on which pInfo→accelerationStructure was placed must have been created with the VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT usage flag