diff --git a/liblava/resource/buffer.cpp b/liblava/resource/buffer.cpp index fe5ec219c360fe39741173975b6e6ba7ada8608d..85dd957a27f63487e6404804c2d0998d35b75336 100644 --- a/liblava/resource/buffer.cpp +++ b/liblava/resource/buffer.cpp @@ -105,6 +105,18 @@ namespace lava { device = nullptr; } + VkDeviceAddress buffer::get_address() const { + if (device->call().vkGetBufferDeviceAddressKHR) { + VkBufferDeviceAddressInfoKHR addr_info{ + .sType = VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_KHR, + .buffer = vk_buffer + }; + return device->call().vkGetBufferDeviceAddressKHR(device->get(), &addr_info); + } else { + return 0; + } + } + void buffer::flush(VkDeviceSize offset, VkDeviceSize size) { vmaFlushAllocation(device->alloc(), allocation, offset, size); } diff --git a/liblava/resource/buffer.hpp b/liblava/resource/buffer.hpp index 67e58e7015143d08ceb1787b5c8d8adba19aca78..0a323c0733891ac298666e74b7f68228b8efcfdf 100644 --- a/liblava/resource/buffer.hpp +++ b/liblava/resource/buffer.hpp @@ -45,6 +45,7 @@ namespace lava { return get_descriptor(); } + VkDeviceAddress get_address() const; VkDeviceSize get_size() const { return allocation_info.size; }