#include "iwa/util/growing_descriptor_pool.hpp" #include #include "iwa/device.hpp" namespace iwa { GrowingDescriptorPool::GrowingDescriptorPool(ObjectPtr owner, GrowingDescriptorPoolCreationArgs args) : super_t(std::move(owner)), mCreationArgs(std::move(args)) { } ObjectPtr GrowingDescriptorPool::allocateDescriptorSet(const DescriptorSetAllocateArgs& args) { for (const ObjectPtr& pool : mPools) { try { return pool->allocateDescriptorSet(args); } catch (vk::FragmentedPoolError&) {} catch (vk::OutOfPoolMemoryError&) {} // any other error shall be forwarded } // couldn't allocate in any of the existing pools, create a new one mPools.push_back(getOwner()->createChild(mCreationArgs)); return mPools.back()->allocateDescriptorSet(args); // raise any error that may occur } } // namespace iwa