C Specification

To query a 64-bit buffer device address value through which buffer memory can be accessed in a shader, call:

VkDeviceAddress vkGetBufferDeviceAddressEXT(
    VkDevice                                    device,
    const VkBufferDeviceAddressInfoEXT*         pInfo);

Parameters

  • device is the logical device that the buffer was created on.

  • pInfo is a pointer to a VkBufferDeviceAddressInfoEXT structure specifying the buffer to retrieve an address for.

Description

The 64-bit return value is an address of the start of pInfo::buffer. The address range starting at this value and whose size is the size of the buffer can be used in a shader to access the memory bound to that buffer, using the SPV_EXT_physical_storage_buffer extension and the PhysicalStorageBufferEXT storage class. For example, this value can be stored in a uniform buffer, and the shader can read the value from the uniform buffer and use it to do a dependent read/write to this buffer. A value of zero is reserved as a “null” pointer and must not be returned as a valid buffer device address. All loads, stores, and atomics in a shader through PhysicalStorageBufferEXT pointers must access addresses in the address range of some buffer.

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

Valid Usage
Valid Usage (Implicit)
  • device must be a valid VkDevice handle

  • pInfo must be a valid pointer to a valid VkBufferDeviceAddressInfoEXT structure

See Also

Document Notes

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.

Copyright (c) 2014-2019 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.