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

◆ bind_descriptors_batch()

void MayaFlux::Yantra::GpuResourceManager::bind_descriptors_batch ( const std::string &  key,
const std::vector< GpuBufferBinding > &  bindings 
)

Bind every non-image buffer binding in one Vulkan call.

Equivalent to calling bind_descriptor or bind_shared_descriptor once per non-image entry in bindings (routed the same way, by whether a shared slot exists at that (set, binding)), except every entry is submitted through a single vkUpdateDescriptorSets call. Image entries are skipped, matching bind_all_descriptors' existing split between buffer descriptors here and image descriptors bound separately per staged image.

Definition at line 386 of file GpuResourceManager.cpp.

387{
388 auto& unit = unit_for(key);
389 auto& foundry = Portal::Graphics::get_shader_foundry();
390
391 std::vector<Portal::Graphics::DescriptorBufferWrite> writes;
392 writes.reserve(bindings.size());
393
394 for (const auto& b : bindings) {
395 const auto et = b.element_type;
398 continue;
399 }
400
401 const auto shared_it = m_shared->slots.find({ b.set, static_cast<size_t>(b.binding) });
402 vk::Buffer buffer;
403 size_t allocated_bytes = 0;
404 if (shared_it != m_shared->slots.end()) {
405 buffer = shared_it->second.buffer;
406 allocated_bytes = shared_it->second.allocated_bytes;
407 } else {
408 if (static_cast<size_t>(b.binding) >= unit.impl->buffers.size()) {
409 continue;
410 }
411 const auto& vk_slot = unit.impl->buffers[b.binding];
412 buffer = vk_slot.buffer;
413 allocated_bytes = vk_slot.allocated_bytes;
414 }
415
416 if (!buffer)
417 continue;
418
419 writes.push_back({
420 .descriptor_set_id = unit.descriptor_set_ids[b.set],
421 .binding = b.binding,
422 .type = vk::DescriptorType::eStorageBuffer,
423 .buffer = buffer,
424 .offset = 0,
425 .size = allocated_bytes,
426 });
427 }
428
429 foundry.update_descriptor_buffers(writes);
430}
std::shared_ptr< NetworkGeometryBuffer > buffer
size_t b
std::unique_ptr< SharedBuffers > m_shared
PipelineUnit & unit_for(const std::string &key)
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.

References b, buffer, MayaFlux::Portal::Graphics::get_shader_foundry(), MayaFlux::Portal::Graphics::GpuBufferBinding::IMAGE_SAMPLED, MayaFlux::Portal::Graphics::GpuBufferBinding::IMAGE_STORAGE, m_shared, and unit_for().

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

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