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

◆ allocate_sets()

std::vector< vk::DescriptorSet > MayaFlux::Core::VKDescriptorManager::allocate_sets ( vk::Device  device,
const std::vector< vk::DescriptorSetLayout > &  layouts 
)

Allocate multiple descriptor sets at once.

Parameters
deviceLogical device
layoutsVector of layouts (one per set)
Returns
Vector of allocated descriptor sets

More efficient than multiple allocate_set() calls.

Definition at line 539 of file VKDescriptorManager.cpp.

542{
543 if (layouts.empty()) {
545 "Allocating zero descriptor sets");
546 return {};
547 }
548
549 if (m_pools.empty()) {
551 "No descriptor pools available - call initialize() first");
552 return {};
553 }
554
555 vk::DescriptorSetAllocateInfo alloc_info;
556 alloc_info.descriptorPool = m_pools[m_current_pool_index];
557 alloc_info.descriptorSetCount = static_cast<uint32_t>(layouts.size());
558 alloc_info.pSetLayouts = layouts.data();
559
560 std::vector<vk::DescriptorSet> sets;
561 try {
562 sets = device.allocateDescriptorSets(alloc_info);
563 m_allocated_count += static_cast<uint32_t>(layouts.size());
564 } catch (const vk::OutOfPoolMemoryError&) {
566 "Descriptor pool {} exhausted, growing...", m_current_pool_index);
567
568 if (!grow_pools(device)) {
569 return {};
570 }
571
572 alloc_info.descriptorPool = m_pools[m_current_pool_index];
573 try {
574 sets = device.allocateDescriptorSets(alloc_info);
575 m_allocated_count += static_cast<uint32_t>(layouts.size());
576 } catch (const vk::SystemError& e) {
578 "Failed to allocate descriptor sets after pool growth: {}", e.what());
579 return {};
580 }
581 } catch (const vk::SystemError& e) {
583 "Failed to allocate descriptor sets: {}", e.what());
584 return {};
585 }
586
588 "Allocated {} descriptor sets (total: {}/{})",
589 layouts.size(), m_allocated_count, m_pool_capacity);
590
591 return sets;
592}
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
uint32_t m_allocated_count
Total allocated sets.
uint32_t m_pool_capacity
Total capacity across all pools.
bool grow_pools(vk::Device device)
Grow pool capacity by allocating new pool.
std::vector< vk::DescriptorPool > m_pools
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, MayaFlux::Journal::GraphicsBackend, grow_pools(), m_allocated_count, m_current_pool_index, m_pool_capacity, m_pools, MF_DEBUG, MF_ERROR, and MF_WARN.

+ Here is the call graph for this function: