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

◆ ensure_buffer()

void MayaFlux::Yantra::GpuResourceManager::ensure_buffer ( const std::string &  key,
size_t  index,
size_t  required_bytes,
Portal::Graphics::BufferUsageHint  usage_hint = Portal::Graphics::BufferUsageHint::COMPUTE_STORAGE 
)

Definition at line 303 of file GpuResourceManager.cpp.

305{
306 auto& unit = unit_for(key);
307 auto& vk_slot = unit.impl->buffers[index];
308 if (vk_slot.allocated_bytes >= required_bytes) {
309 return;
310 }
311
312 auto& foundry = Portal::Graphics::get_shader_foundry();
313 allocate_slot(foundry.get_device(), foundry.get_physical_device(),
314 vk_slot, required_bytes, Portal::Graphics::to_buffer_usage_flags(usage_hint));
315
316 unit.buffer_slots[index].allocated_bytes = required_bytes;
317}
PipelineUnit & unit_for(const std::string &key)
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::Portal::Graphics::get_shader_foundry(), MayaFlux::Portal::Graphics::to_buffer_usage_flags(), and unit_for().

Referenced by MayaFlux::Yantra::GpuDispatchCore::prepare_gpu_inputs().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: