PhysicalStorageBuffer storage class in the GL_EXT_buffer_reference GLSL extension and SPV_KHR_physical_storage_buffer SPIR-V extension.
Another way to describe this extension is that it adds “pointers to buffer memory in shaders”. By calling GetBufferDeviceAddress with a VkBuffer, it will return a VkDeviceAddress value which represents the address of the start of the buffer.
GetBufferOpaqueCaptureAddress and GetDeviceMemoryOpaqueCaptureAddress allow opaque addresses for buffers and memory objects to be queried for the current process. A trace capture and replay tool can then supply these addresses to be used at replay time to match the addresses used when the trace was captured. To enable tools to insert these queries, new memory allocation flags must be specified for memory objects that will be bound to buffers accessed via the PhysicalStorageBuffer storage class. Note that this mechanism is intended only to support capture/replay tools, and is not recommended for use in other applications.
There are various use cases this extension is designed for. It is required for ray tracing, useful for DX12 portability, and by allowing buffer addresses to be stored in memory it enables more complex data structures to be created.
This extension can also be used to hardcode a dedicated debug channel into all shaders by querying a pointer at startup and pushing that into shaders as a run-time constant (e.g. specialization constant) that avoids impacting other descriptor limits.
There are examples of usage in the GL_EXT_buffer_reference spec for how to use this in a high-level shading language such as GLSL. The GL_EXT_buffer_reference2 and GL_EXT_buffer_reference_uvec2 extensions were also added to help cover a few additional edge cases.
All functionality in this extension is included in core Vulkan 1.2, with the KHR suffix omitted. However, if Vulkan 1.2 is supported and this extension is not, the bufferDeviceAddress feature is optional. The original type, enum and command names are still available as aliases of the core functionality.
Support for the bufferDeviceAddress feature is mandatory in Vulkan 1.3, regardless of whether this extension is supported.
VK_KHR_buffer_device_addressVK_KHR_get_physical_device_properties2 and VK_KHR_device_group or Version 1.1SPV_KHR_physical_storage_bufferGL_EXT_buffer_reference and GL_EXT_buffer_reference2 and GL_EXT_buffer_reference_uvec2| Modifier and Type | Field and Description |
|---|---|
| public static final int | VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR
Extends |
| public static final int | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_KHR
Extends |
| public static final int | VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR
Extends |
| public static final String | VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME
The extension name. |
| public static final int | VK_KHR_BUFFER_DEVICE_ADDRESS_SPEC_VERSION
The extension specification version. |
| public static final int | VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR
Extends |
| public static final int | VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR
Extends |
| public static final int | VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_KHR
Extends |
| public static final int | VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO_KHR
Extends |
| public static final int | VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO_KHR
Extends |
| public static final int | VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO_KHR
Extends |
| public static final int | VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR
Extends |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public static long | nvkGetBufferDeviceAddressKHR(VkDevice device, long pInfo)
Unsafe version of: |
| public static long | nvkGetBufferOpaqueCaptureAddressKHR(VkDevice device, long pInfo)
Unsafe version of: |
| public static long | nvkGetDeviceMemoryOpaqueCaptureAddressKHR(VkDevice device, long pInfo)
Unsafe version of: |
| public static long | vkGetBufferDeviceAddressKHR(VkDevice
the logical device that the buffer was created on. device, VkBufferDeviceAddressInfo a pointer to a pInfo)VkBufferDeviceAddressInfo structure specifying the buffer to retrieve an address for. |
| public static long | vkGetBufferOpaqueCaptureAddressKHR(VkDevice
the logical device that the buffer was created on. device, VkBufferDeviceAddressInfo a pointer to a pInfo)VkBufferDeviceAddressInfo structure specifying the buffer to retrieve an address for. |
| public static long | vkGetDeviceMemoryOpaqueCaptureAddressKHR(VkDevice
the logical device that the memory object was allocated on. device, VkDeviceMemoryOpaqueCaptureAddressInfo a pointer to a pInfo)VkDeviceMemoryOpaqueCaptureAddressInfo structure specifying the memory object to retrieve an address for. |
| VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR | back to summary |
|---|---|
| public static final int VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR Extends | |
| VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_KHR | back to summary |
|---|---|
| public static final int VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_KHR Extends | |
| VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR | back to summary |
|---|---|
| public static final int VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR Extends | |
| VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME | back to summary |
|---|---|
| public static final String VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME The extension name. | |
| VK_KHR_BUFFER_DEVICE_ADDRESS_SPEC_VERSION | back to summary |
|---|---|
| public static final int VK_KHR_BUFFER_DEVICE_ADDRESS_SPEC_VERSION The extension specification version. | |
| VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR | back to summary |
|---|---|
| public static final int VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR Extends Enum values: | |
| VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR | back to summary |
|---|---|
| public static final int VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR Extends Enum values: | |
| VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_KHR | back to summary |
|---|---|
| public static final int VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_KHR Extends Enum values: | |
| VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO_KHR | back to summary |
|---|---|
| public static final int VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO_KHR Extends Enum values: | |
| VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO_KHR | back to summary |
|---|---|
| public static final int VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO_KHR Extends Enum values: | |
| VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO_KHR | back to summary |
|---|---|
| public static final int VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO_KHR Extends Enum values: | |
| VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR | back to summary |
|---|---|
| public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR Extends Enum values: | |
| KHRBufferDeviceAddress | back to summary |
|---|---|
| protected KHRBufferDeviceAddress() | |
| nvkGetBufferDeviceAddressKHR | back to summary |
|---|---|
| public static long nvkGetBufferDeviceAddressKHR(VkDevice device, long pInfo) Unsafe version of: | |
| nvkGetBufferOpaqueCaptureAddressKHR | back to summary |
|---|---|
| public static long nvkGetBufferOpaqueCaptureAddressKHR(VkDevice device, long pInfo) Unsafe version of: | |
| nvkGetDeviceMemoryOpaqueCaptureAddressKHR | back to summary |
|---|---|
| public static long nvkGetDeviceMemoryOpaqueCaptureAddressKHR(VkDevice device, long pInfo) Unsafe version of: | |
| vkGetBufferDeviceAddressKHR | back to summary |
|---|---|
public static long vkGetBufferDeviceAddressKHR(VkDevice device, VkBufferDeviceAddressInfo pInfo)
| |
| vkGetBufferOpaqueCaptureAddressKHR | back to summary |
|---|---|
| public static long vkGetBufferOpaqueCaptureAddressKHR(VkDevice device, VkBufferDeviceAddressInfo pInfo) See
| |
| vkGetDeviceMemoryOpaqueCaptureAddressKHR | back to summary |
|---|---|
| public static long vkGetDeviceMemoryOpaqueCaptureAddressKHR(VkDevice device, VkDeviceMemoryOpaqueCaptureAddressInfo pInfo) See
| |