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

◆ ensure_shared_buffer()

void MayaFlux::Yantra::GpuResourceManager::ensure_shared_buffer ( uint32_t  set,
size_t  binding_index,
size_t  element_count,
GpuBufferBinding::ElementType  element_type,
Portal::Graphics::BufferUsageHint  usage_hint = Portal::Graphics::BufferUsageHint::COMPUTE_STORAGE 
)

Definition at line 355 of file GpuResourceManager.cpp.

358{
359 const size_t width = Portal::Graphics::element_type_bytes(element_type);
360 if (width == 0) {
361 error<std::runtime_error>(
364 std::source_location::current(),
365 "GpuResourceManager: ensure_shared_buffer requires a sized element_type");
366 }
367
368 auto& slot = m_shared->slots[{ set, binding_index }];
369 const size_t required_bytes = element_count * width;
370 if (slot.allocated_bytes >= required_bytes)
371 return;
372
373 auto& foundry = Portal::Graphics::get_shader_foundry();
374 allocate_slot(foundry.get_device(), foundry.get_physical_device(),
375 slot, required_bytes, Portal::Graphics::to_buffer_usage_flags(usage_hint));
376}
uint32_t width
Definition Decoder.cpp:66
std::unique_ptr< SharedBuffers > m_shared
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.
size_t element_type_bytes(GpuBufferBinding::ElementType et) noexcept
Byte width of one GpuBufferBinding::ElementType element.
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
vk::BufferUsageFlags to_buffer_usage_flags(BufferUsageHint hint)
Resolve the extra vk::BufferUsageFlags a BufferUsageHint requires, on top of whatever base usage the ...

References MayaFlux::Journal::BufferProcessing, MayaFlux::Portal::Graphics::element_type_bytes(), MayaFlux::Portal::Graphics::get_shader_foundry(), m_shared, MayaFlux::Portal::Graphics::to_buffer_usage_flags(), width, and MayaFlux::Journal::Yantra.

+ Here is the call graph for this function: