|
| VulkanDescriptorSetLayout (const VulkanDevice &device, std::vector< std::unique_ptr< VulkanDescriptorLayout > > &&descriptor_layouts, unsigned int space, ShaderStage stages, unsigned int pool_size=1024, unsigned int max_unbounded_array_size=104857) |
| Initializes a VulkanDescriptorSetLayout.
|
|
| VulkanDescriptorSetLayout (const VulkanDescriptorSetLayout &other)=delete |
|
| VulkanDescriptorSetLayout (VulkanDescriptorSetLayout &&other) noexcept=delete |
|
VulkanDescriptorSetLayout & | operator= (const VulkanDescriptorSetLayout &other)=delete |
|
VulkanDescriptorSetLayout & | operator= (VulkanDescriptorSetLayout &&other) noexcept=delete |
|
unsigned | poolSize () const noexcept |
| Gets the size of each descriptor pool.
|
|
std::size_t | pools () const noexcept |
| Gets the number of active descriptor pools.
|
|
const VulkanDevice & | device () const noexcept |
| Gets the parent VulkanDevice the pipeline layout has been created from.
|
|
std::vector< const VulkanDescriptorLayout * > | descriptors () const noexcept override |
| Gets the layouts of all descriptors in the IDescriptorSet.
|
|
const VulkanDescriptorLayout * | descriptor (unsigned binding) const override |
| Gets the layout of a descriptor in the IDescriptorSet bound to a specific binding point.
|
|
unsigned | space () const noexcept override |
| Gets the space index of the IDescriptorSet.
|
|
ShaderStage | shaderStage () const noexcept override |
| Gets the shader stage the IDescriptorSet is used in.
|
|
unsigned | uniforms () const noexcept override |
| Gets the number of uniform/constant buffers in the IDescriptorSet.
|
|
unsigned | storages () const noexcept override |
| Gets the number of storage buffers in the IDescriptorSet.
|
|
unsigned | images () const noexcept override |
| Gets the number of images (textures) in the IDescriptorSet.
|
|
unsigned | samplers () const noexcept override |
| Gets the number of texel buffer descriptors in the IDescriptorSet.
|
|
unsigned | buffers () const noexcept override |
| Get the number of texel buffer descriptors in the IDescriptorSet.
|
|
unsigned | staticSamplers () const noexcept override |
| Gets the number of static/immutable samplers in the IDescriptorSet.
|
|
unsigned | inputAttachments () const noexcept override |
| Gets the number of input attachments in the IDescriptorSet.
|
|
std::unique_ptr< VulkanDescriptorSet > | allocate (const std::vector< DescriptorBinding > &bindings={}) const override |
| Allocates a new IDescriptorSet or returns an unused descriptor set.
|
|
std::unique_ptr< VulkanDescriptorSet > | allocate (unsigned descriptors, const std::vector< DescriptorBinding > &bindings={}) const override |
| Allocates a new IDescriptorSet or returns an unused descriptor set.
|
|
std::vector< std::unique_ptr< VulkanDescriptorSet > > | allocateMultiple (unsigned descriptor_sets, const std::vector< std::vector< DescriptorBinding > > &bindings={}) const override |
| Allocates an array of IDescriptorSet.
|
|
std::vector< std::unique_ptr< VulkanDescriptorSet > > | allocateMultiple (unsigned descriptor_sets, const std::function< std::vector< DescriptorBinding >(unsigned)> &binding_factory) const override |
| Allocates an array of IDescriptorSet.
|
|
std::vector< std::unique_ptr< VulkanDescriptorSet > > | allocateMultiple (unsigned descriptor_sets, unsigned descriptors, const std::vector< std::vector< DescriptorBinding > > &bindings={}) const override |
| Allocates an array of IDescriptorSet.
|
|
std::vector< std::unique_ptr< VulkanDescriptorSet > > | allocateMultiple (unsigned descriptor_sets, unsigned descriptors, const std::function< std::vector< DescriptorBinding >(unsigned)> &binding_factory) const override |
| Allocates an array of IDescriptorSet.
|
|
void | free (const VulkanDescriptorSet &descriptor_set) const noexcept override |
|
virtual void | free (const descriptor_set_type &descriptor_set) const noexcept=0 |
| Marks a IDescriptorSet as unused, so that it can be handed out again instead of allocating a new one.
|
|
std::vector< const IDescriptorLayout * > | descriptors () const noexcept |
| Gets the layouts of all descriptors in the IDescriptorSet.
|
|
virtual const IDescriptorLayout * | descriptor (unsigned int binding) const =0 |
| Gets the layout of a descriptor in the IDescriptorSet bound to a specific binding point.
|
|
std::unique_ptr< IDescriptorSet > | allocate (const std::vector< DescriptorBinding > &bindings={}) const |
| Allocates a new IDescriptorSet or returns an unused descriptor set.
|
|
std::unique_ptr< IDescriptorSet > | allocate (unsigned int descriptors, const std::vector< DescriptorBinding > &bindings={}) const |
| Allocates a new IDescriptorSet or returns an unused descriptor set.
|
|
std::vector< std::unique_ptr< IDescriptorSet > > | allocateMultiple (unsigned int descriptors_sets, const std::vector< std::vector< DescriptorBinding > > &bindings={}) const noexcept |
| Allocates an array of IDescriptorSet.
|
|
std::vector< std::unique_ptr< IDescriptorSet > > | allocateMultiple (unsigned int descriptors_sets, const std::function< std::vector< DescriptorBinding >(unsigned)> &binding_factory) const noexcept |
| Allocates an array of IDescriptorSet.
|
|
std::vector< std::unique_ptr< IDescriptorSet > > | allocateMultiple (unsigned int descriptors_sets, unsigned int descriptors, const std::vector< std::vector< DescriptorBinding > > &bindings={}) const noexcept |
| Allocates an array of IDescriptorSet.
|
|
std::vector< std::unique_ptr< IDescriptorSet > > | allocateMultiple (unsigned int descriptors_sets, unsigned int descriptors, const std::function< std::vector< DescriptorBinding >(unsigned)> &binding_factory={}) const noexcept |
| Allocates an array of IDescriptorSet.
|
|
void | free (const IDescriptorSet &descriptor_set) const noexcept |
| Marks a IDescriptorSet as unused, so that it can be handed out again instead of allocating a new one.
|
|
| Resource (VkDescriptorSetLayout handle) noexcept |
| Initializes the managed resource with the given handle.
|
|
| Resource (const Resource &other)=delete |
|
| Resource (Resource &&other) noexcept=delete |
|
Resource & | operator= (const Resource &other)=delete |
|
Resource & | operator= (Resource &&other) noexcept=delete |
|
const VkDescriptorSetLayout & | handle () const final |
| Gets the managed resource handle.
|
|
Allocates a new IDescriptorSet or returns an unused descriptor set.
- Parameters
-
bindings | Optional list of descriptor bindings to initialize the IDescriptorSet with. |
- Returns
- A std::unique_ptr to the allocated IDescriptorSet.
Allocating a new descriptor set may be an expensive operation. To improve performance, and prevent fragmentation, the descriptor set layout keeps track of created descriptor sets. It does this by never releasing them. Instead, when a IDescriptorSet instance gets destroyed, it should call IDescriptorSetLayout::free() in order to mark itself (i.e. its handle) as not being used any longer.
Before allocating a new descriptor set from a pool (which may even result in the creation of a new pool, if the existing pools are full), the layout tries to hand out descriptor sets that marked as unused. Descriptor sets are only deleted, if the whole layout instance and therefore the descriptor pools are deleted. ( The above does not apply to unbounded descriptor arrays. A unbounded descriptor array is one, for which IDescriptorLayout::descriptors() returns -1
(or 0xFFFFFFFF
). They must be allocated by specifying the descriptors
parameter. This parameter defines the number of descriptors to allocate in the array.
Note that descriptor sets, that contain an unbounded descriptor array must only contain one single descriptor (the one that identifies this array). Such descriptor sets are never cached. Instead, they are released when calling IDescriptorSetLayout::free(). It is a good practice to cache such descriptor sets as global descriptor tables once and never release them. They provide more flexibility than regular descriptor arrays, since they may be updated, even after they have been bound to a command buffer or from different threads. However, you must ensure yourself not to overwrite any descriptors that are currently in use. Because unbounded arrays are not cached, freeing and re-allocating such descriptor sets may leave the descriptor heap fragmented, which might cause the allocation to fail, if the heap is full.
Implements spark::render::DescriptorSetLayout< VulkanDescriptorLayout, VulkanDescriptorSet >.
std::unique_ptr< VulkanDescriptorSet > spark::render::vk::VulkanDescriptorSetLayout::allocate |
( |
unsigned | descriptors, |
|
|
const std::vector< DescriptorBinding > & | bindings = {} ) const |
|
nodiscardoverridevirtual |
Allocates a new IDescriptorSet or returns an unused descriptor set.
- Parameters
-
bindings | Optional list of descriptor bindings to initialize the IDescriptorSet with. |
- Returns
- A std::unique_ptr to the allocated IDescriptorSet.
Allocating a new descriptor set may be an expensive operation. To improve performance, and prevent fragmentation, the descriptor set layout keeps track of created descriptor sets. It does this by never releasing them. Instead, when a IDescriptorSet instance gets destroyed, it should call IDescriptorSetLayout::free() in order to mark itself (i.e. its handle) as not being used any longer.
Before allocating a new descriptor set from a pool (which may even result in the creation of a new pool, if the existing pools are full), the layout tries to hand out descriptor sets that marked as unused. Descriptor sets are only deleted, if the whole layout instance and therefore the descriptor pools are deleted. ( The above does not apply to unbounded descriptor arrays. A unbounded descriptor array is one, for which IDescriptorLayout::descriptors() returns -1
(or 0xFFFFFFFF
). They must be allocated by specifying the descriptors
parameter. This parameter defines the number of descriptors to allocate in the array.
Note that descriptor sets, that contain an unbounded descriptor array must only contain one single descriptor (the one that identifies this array). Such descriptor sets are never cached. Instead, they are released when calling IDescriptorSetLayout::free(). It is a good practice to cache such descriptor sets as global descriptor tables once and never release them. They provide more flexibility than regular descriptor arrays, since they may be updated, even after they have been bound to a command buffer or from different threads. However, you must ensure yourself not to overwrite any descriptors that are currently in use. Because unbounded arrays are not cached, freeing and re-allocating such descriptor sets may leave the descriptor heap fragmented, which might cause the allocation to fail, if the heap is full.
Implements spark::render::DescriptorSetLayout< VulkanDescriptorLayout, VulkanDescriptorSet >.