27#ifndef DVD_DESCRIPTOR_ALLOCATOR_H_
28#define DVD_DESCRIPTOR_ALLOCATOR_H_
30#include <vulkan/vulkan_core.h>
43 { VK_DESCRIPTOR_TYPE_SAMPLER, 1.f },
44 { VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 4.f },
45 { VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, 4.f },
46 { VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, 1.f },
47 { VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, 1.f },
48 { VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER, 1.f },
49 { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1.f },
50 { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1.f },
51 { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC, 2.f },
52 { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC, 2.f },
53 { VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 1.f }
59 VkDescriptorPool
pool{ VK_NULL_HANDLE };
84 [[nodiscard]]
bool Allocate(
const VkDescriptorSetLayout& layout, VkDescriptorSet& builtSet,
Divide::U8 retryCount = 0u);
87 VkDescriptorPool
vkPool{VK_NULL_HANDLE};
static DescriptorAllocatorPool * Create(const VkDevice &device, Divide::I32 nFrames=3)
void SetPoolSizeMultiplier(VkDescriptorType type, float multiplier)
Not thread safe! Override the pool size for a specific descriptor type. This will be used new pools a...
Divide::vector< DescriptorAllocator > _clearAllocators
VkDescriptorPool createPool(Divide::I32 count, VkDescriptorPoolCreateFlags flags)
void Flip()
Not thread safe! Switches default allocators to the next frame. When frames loop it will reset the de...
~DescriptorAllocatorPool()
void ReturnAllocator(DescriptorAllocatorHandle &handle, bool bIsFull)
Divide::vector< std::unique_ptr< PoolStorage > > _descriptorPools
DescriptorAllocatorHandle GetAllocator()
eastl::vector< Type > vector
DescriptorAllocatorHandle & operator=(const DescriptorAllocatorHandle &)=delete
bool Allocate(const VkDescriptorSetLayout &layout, VkDescriptorSet &builtSet, Divide::U8 retryCount=0u)
Allocate new descriptor. handle has to be valid returns true if allocation succeeded,...
void Return()
Return this handle to the pool. Will make this handle orphaned.
DescriptorAllocatorHandle()=default
~DescriptorAllocatorHandle()
DescriptorAllocatorPool * ownerPool
Divide::vector< PoolSize > sizes
Divide::vector< DescriptorAllocator > _fullAllocators
Divide::vector< DescriptorAllocator > _usableAllocators