MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ get_device_address()

uint64_t MayaFlux::Buffers::VKBuffer::get_device_address ( ) const

Get the Vulkan device address for this buffer (if applicable)

Returns
64-bit device address, or 0 if not BDA-capable or not initialized

Only buffers created with Usage::UNIFORM_BDA or Usage::STORAGE_BDA and registered with the backend will return a valid device address. This is used by processors that need to bind buffers via device address (e.g., for ray tracing or bindless access).

Definition at line 49 of file VKBuffer.cpp.

50{
51 if (!is_initialized()) {
53 "Cannot get device address of uninitialized VKBuffer");
54 return 0;
55 }
56
59 "get_device_address() called on buffer without BDA usage flags");
60 return 0;
61 }
62
63 auto* buffer_service = Registry::BackendRegistry::instance()
64 .get_service<Registry::Service::BufferService>();
65
66 if (!buffer_service) {
67 error<std::runtime_error>(
70 std::source_location::current(),
71 "Cannot query buffer device address: BufferService not available");
72 }
73
74 auto shared_this = std::const_pointer_cast<VKBuffer>(
75 std::static_pointer_cast<const VKBuffer>(shared_from_this()));
76
77 return buffer_service->get_buffer_device_address(
78 std::static_pointer_cast<void>(shared_this));
79}
#define MF_WARN(comp, ctx,...)
@ STORAGE_BDA
Storage buffer with device address query support.
@ UNIFORM_BDA
Uniform buffer with device address query support.
bool is_initialized() const
Check whether Vulkan handles are present (buffer registered)
Definition VKBuffer.hpp:287
Interface * get_service()
Query for a backend service.
static BackendRegistry & instance()
Get the global registry instance.
@ BufferManagement
Buffer Management (Buffers::BufferManager, creating buffers)
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Journal::BufferManagement, MayaFlux::Journal::Buffers, MayaFlux::Registry::BackendRegistry::get_service(), MayaFlux::Registry::BackendRegistry::instance(), is_initialized(), m_usage, MF_WARN, STORAGE_BDA, and UNIFORM_BDA.

+ Here is the call graph for this function: