summaryrefslogtreecommitdiff
path: root/tools/gfx/vulkan
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gfx/vulkan')
-rw-r--r--tools/gfx/vulkan/render-vk.cpp11
-rw-r--r--tools/gfx/vulkan/vk-api.cpp5
-rw-r--r--tools/gfx/vulkan/vk-api.h5
3 files changed, 21 insertions, 0 deletions
diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp
index 78054b4d5..97a527ca6 100644
--- a/tools/gfx/vulkan/render-vk.cpp
+++ b/tools/gfx/vulkan/render-vk.cpp
@@ -179,6 +179,17 @@ public:
RefPtr<VKDevice> m_renderer;
Buffer m_buffer;
Buffer m_uploadBuffer;
+
+ virtual SLANG_NO_THROW DeviceAddress SLANG_MCALL getDeviceAddress() override
+ {
+ if (!m_buffer.m_api->vkGetBufferDeviceAddress)
+ return 0;
+ VkBufferDeviceAddressInfo info = {};
+ info.sType = VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO;
+ info.buffer = m_buffer.m_buffer;
+ return (DeviceAddress)m_buffer.m_api->vkGetBufferDeviceAddress(
+ m_buffer.m_api->m_device, &info);
+ }
};
class TextureResourceImpl : public TextureResource
diff --git a/tools/gfx/vulkan/vk-api.cpp b/tools/gfx/vulkan/vk-api.cpp
index 9a4ab130d..7e1a9bae2 100644
--- a/tools/gfx/vulkan/vk-api.cpp
+++ b/tools/gfx/vulkan/vk-api.cpp
@@ -87,6 +87,11 @@ Slang::Result VulkanApi::initDeviceProcs(VkDevice device)
return SLANG_FAIL;
}
+ if (!vkGetBufferDeviceAddressKHR && vkGetBufferDeviceAddressEXT)
+ vkGetBufferDeviceAddressKHR = vkGetBufferDeviceAddressEXT;
+ if (!vkGetBufferDeviceAddress && vkGetBufferDeviceAddressKHR)
+ vkGetBufferDeviceAddress = vkGetBufferDeviceAddressKHR;
+
m_device = device;
return SLANG_OK;
}
diff --git a/tools/gfx/vulkan/vk-api.h b/tools/gfx/vulkan/vk-api.h
index 75b88dd96..4c024525b 100644
--- a/tools/gfx/vulkan/vk-api.h
+++ b/tools/gfx/vulkan/vk-api.h
@@ -143,6 +143,7 @@ namespace gfx {
x(vkGetPhysicalDeviceSurfacePresentModesKHR) \
x(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) \
x(vkDestroySurfaceKHR) \
+
/* */
#define VK_API_DEVICE_KHR_PROCS(x) \
@@ -155,6 +156,10 @@ namespace gfx {
#define VK_API_DEVICE_OPT_PROCS(x) \
x(vkCmdSetPrimitiveTopologyEXT) \
+ x(vkGetBufferDeviceAddress) \
+ x(vkGetBufferDeviceAddressKHR) \
+ x(vkGetBufferDeviceAddressEXT) \
+
/* */
#define VK_API_ALL_GLOBAL_PROCS(x) \