|
virtual std::vector< const descriptor_layout_type * > | descriptors () const noexcept=0 |
| Gets the layouts of all descriptors in the IDescriptorSet.
|
|
const descriptor_layout_type * | descriptor (unsigned binding) const override=0 |
| Gets the layout of a descriptor in the IDescriptorSet bound to a specific binding point.
|
|
virtual std::unique_ptr< descriptor_set_type > | allocate (const std::vector< DescriptorBinding > &bindings={}) const =0 |
| Allocates a new IDescriptorSet or returns an unused descriptor set.
|
|
virtual std::unique_ptr< descriptor_set_type > | allocate (unsigned descriptors, const std::vector< DescriptorBinding > &bindings={ }) const =0 |
| Allocates a new IDescriptorSet or returns an unused descriptor set.
|
|
virtual std::vector< std::unique_ptr< descriptor_set_type > > | allocateMultiple (unsigned descriptor_sets, const std::vector< std::vector< DescriptorBinding > > &bindings={ }) const =0 |
| Allocates an array of IDescriptorSet.
|
|
virtual std::vector< std::unique_ptr< descriptor_set_type > > | allocateMultiple (unsigned descriptor_sets, const std::function< std::vector< DescriptorBinding >(unsigned)> &binding_factory) const =0 |
| Allocates an array of IDescriptorSet.
|
|
virtual std::vector< std::unique_ptr< descriptor_set_type > > | allocateMultiple (unsigned descriptor_sets, unsigned descriptors, const std::vector< std::vector< DescriptorBinding > > &bindings={ }) const =0 |
| Allocates an array of IDescriptorSet.
|
|
virtual std::vector< std::unique_ptr< descriptor_set_type > > | allocateMultiple (unsigned descriptor_sets, unsigned descriptors, const std::function< std::vector< DescriptorBinding >(unsigned)> &binding_factory) const =0 |
| Allocates an array of IDescriptorSet.
|
|
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.
|
|
virtual unsigned int | space () const noexcept=0 |
| Gets the space index of the IDescriptorSet.
|
|
virtual ShaderStage | shaderStage () const noexcept=0 |
| Gets the shader stage the IDescriptorSet is used in.
|
|
virtual unsigned int | uniforms () const noexcept=0 |
| Gets the number of uniform/constant buffers in the IDescriptorSet.
|
|
virtual unsigned int | storages () const noexcept=0 |
| Gets the number of storage buffers in the IDescriptorSet.
|
|
virtual unsigned int | images () const noexcept=0 |
| Gets the number of images (textures) in the IDescriptorSet.
|
|
virtual unsigned int | buffers () const noexcept=0 |
| Get the number of texel buffer descriptors in the IDescriptorSet.
|
|
virtual unsigned int | samplers () const noexcept=0 |
| Gets the number of texel buffer descriptors in the IDescriptorSet.
|
|
virtual unsigned int | staticSamplers () const noexcept=0 |
| Gets the number of static/immutable samplers in the IDescriptorSet.
|
|
virtual unsigned int | inputAttachments () const noexcept=0 |
| Gets the number of input attachments in the IDescriptorSet.
|
|
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.
|
|
template<typename DescriptorLayoutType, typename DescriptorSetType>
class spark::render::DescriptorSetLayout< DescriptorLayoutType, DescriptorSetType >
Describes the layout of a descriptor set.
- Template Parameters
-
DescriptorLayoutType | Type of the descriptor layout. (inherits from IDescriptorLayout) |
DescriptorSetType | Type of the descriptor set. (inherits from IDescriptorSet) |
template<typename DescriptorLayoutType , typename DescriptorSetType >
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.
Implemented in spark::render::vk::VulkanDescriptorSetLayout.
template<typename DescriptorLayoutType , typename DescriptorSetType >
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.
Implemented in spark::render::vk::VulkanDescriptorSetLayout.