initial commit

This commit is contained in:
2024-04-06 14:11:26 +02:00
commit 1d44ecc0ee
85 changed files with 11573 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
#include "iwa/util/growing_descriptor_pool.hpp"
#include <utility>
#include "iwa/device.hpp"
namespace iwa
{
GrowingDescriptorPool::GrowingDescriptorPool(ObjectPtr<Device> owner, GrowingDescriptorPoolCreationArgs args)
: super_t(std::move(owner)), mCreationArgs(std::move(args))
{
}
ObjectPtr<DescriptorSet> GrowingDescriptorPool::allocateDescriptorSet(const DescriptorSetAllocateArgs& args)
{
for (const ObjectPtr<DescriptorPool>& 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<DescriptorPool>(mCreationArgs));
return mPools.back()->allocateDescriptorSet(args); // raise any error that may occur
}
} // namespace iwa