Allocate a descriptor set from the pool.
Allocates from current pool. If pool is exhausted, creates a new pool automatically and retries allocation.
259{
260 if (!layout) {
262 "Cannot allocate descriptor set with null layout");
263 return nullptr;
264 }
265
268 "No descriptor pools available - call initialize() first");
269 return nullptr;
270 }
271
272 vk::DescriptorSetAllocateInfo alloc_info;
274 alloc_info.descriptorSetCount = 1;
275 alloc_info.pSetLayouts = &layout;
276
277 vk::DescriptorSet set;
278 try {
279 auto sets = device.allocateDescriptorSets(alloc_info);
280 set = sets[0];
282 } catch (const vk::OutOfPoolMemoryError&) {
285
287 return nullptr;
288 }
289
291 try {
292 auto sets = device.allocateDescriptorSets(alloc_info);
293 set = sets[0];
295 } catch (const vk::SystemError& e) {
297 "Failed to allocate descriptor set after pool growth: {}", e.what());
298 return nullptr;
299 }
300 } catch (const vk::SystemError& e) {
302 "Failed to allocate descriptor set: {}", e.what());
303 return nullptr;
304 }
305
308
309 return set;
310}
#define MF_ERROR(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.
size_t m_current_pool_index
std::vector< vk::DescriptorPool > m_pools
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
@ Core
Core engine, backend, subsystems.