1// Copyright 2016-2024 The Khronos Group Inc. 2// 3// SPDX-License-Identifier: CC-BY-4.0 4 5include::{generated}/meta/{refprefix}VK_KHR_buffer_device_address.adoc[] 6 7=== Other Extension Metadata 8 9*Last Modified Date*:: 10 2019-06-24 11*IP Status*:: 12 No known IP claims. 13*Interactions and External Dependencies*:: 14 - This extension provides API support for 15 {GLSLregistry}/ext/GLSL_EXT_buffer_reference.txt[`GL_EXT_buffer_reference`] 16 and 17 {GLSLregistry}/ext/GLSL_EXT_buffer_reference2.txt[`GL_EXT_buffer_reference2`] 18 and 19 {GLSLregistry}/ext/GLSL_EXT_buffer_reference_uvec2.txt[`GL_EXT_buffer_reference_uvec2`] 20*Contributors*:: 21 - Jeff Bolz, NVIDIA 22 - Neil Henning, AMD 23 - Tobias Hector, AMD 24 - Faith Ekstrand, Intel 25 - Baldur Karlsson, Valve 26 - Jan-Harald Fredriksen, Arm 27 28=== Description 29 30This extension allows the application to query a 64-bit buffer device 31address value for a buffer, which can be used to access the buffer memory 32via the code:PhysicalStorageBuffer storage class in the 33{GLSLregistry}/ext/GLSL_EXT_buffer_reference.txt[`GL_EXT_buffer_reference`] 34GLSL extension and 35{spirv}/KHR/SPV_KHR_physical_storage_buffer.html[`SPV_KHR_physical_storage_buffer`] 36SPIR-V extension. 37 38Another way to describe this extension is that it adds "`pointers to buffer 39memory in shaders`". 40By calling flink:vkGetBufferDeviceAddress with a sname:VkBuffer, it will 41return a basetype:VkDeviceAddress value which represents the address of the 42start of the buffer. 43 44flink:vkGetBufferOpaqueCaptureAddress and 45flink:vkGetDeviceMemoryOpaqueCaptureAddress allow opaque addresses for 46buffers and memory objects to be queried for the current process. 47A trace capture and replay tool can then supply these addresses to be used 48at replay time to match the addresses used when the trace was captured. 49To enable tools to insert these queries, new memory allocation flags must be 50specified for memory objects that will be bound to buffers accessed via the 51code:PhysicalStorageBuffer storage class. 52**Note that this mechanism is intended only to support capture/replay tools, 53and is not recommended for use in other applications.** 54 55=== Promotion to Vulkan 1.2 56 57All functionality in this extension is included in core Vulkan 1.2, with the 58KHR suffix omitted. 59However, if Vulkan 1.2 is supported and this extension is not, the 60code:bufferDeviceAddress feature is optional. 61The original type, enum and command names are still available as aliases of 62the core functionality. 63 64=== Promotion to Vulkan 1.3 65 66Support for the code:bufferDeviceAddress feature is mandatory in Vulkan 1.3, 67regardless of whether this extension is supported. 68 69include::{generated}/interfaces/VK_KHR_buffer_device_address.adoc[] 70 71=== New SPIR-V Capabilities 72 73 * <<spirvenv-capabilities-table-PhysicalStorageBufferAddresses, 74 code:PhysicalStorageBufferAddresses>> 75 76ifdef::isrefpage[] 77 78=== Examples 79 80There are various use cases this extensions is designed for. 81It is required for ray tracing, useful for DX12 portability, and it allows 82storing buffer addresses in memory (enabling creating more complex data 83structures). 84 85This extension can also be used to hardcode a dedicated debug channel into 86all shaders without impacting other descriptor limits by querying a buffer 87device address at startup and pushing that into shaders as a run-time 88constant (e.g. specialization constant). 89 90There are examples of usage in the 91{GLSLregistry}/ext/GLSL_EXT_buffer_reference.txt[`GL_EXT_buffer_reference`] 92spec for how to use this in a high-level shading language such as GLSL. 93The 94{GLSLregistry}/ext/GLSL_EXT_buffer_reference2.txt[`GL_EXT_buffer_reference2`] 95and 96{GLSLregistry}/ext/GLSL_EXT_buffer_reference_uvec2.txt[`GL_EXT_buffer_reference_uvec2`] 97extensions were added to help cover a few edge cases missed by the original 98`GL_EXT_buffer_reference`. 99 100endif::isrefpage[] 101 102=== Version History 103 104 * Revision 1, 2019-06-24 (Jan-Harald Fredriksen) 105 ** Internal revisions based on VK_EXT_buffer_device_address 106 107