SPARK
0.1.0
A general purpose game engine written in C++.
|
Interface for a descriptor set layout. More...
#include <DescriptorSet.h>
Public Member Functions | |
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. | |
Interface for a descriptor set layout.
|
inlinenodiscard |
Allocates a new IDescriptorSet or returns an unused descriptor set.
bindings | Optional list of descriptor bindings to initialize the IDescriptorSet with. |
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.
|
inlinenodiscard |
Allocates a new IDescriptorSet or returns an unused descriptor set.
descriptors | The number of descriptors to allocate in an unbounded descriptor array. Ignored if the descriptor array is bounded. |
bindings | Optional list of descriptor bindings to initialize the IDescriptorSet with. |
|
inlinenodiscardnoexcept |
Allocates an array of IDescriptorSet.
descriptors_sets | The number of IDescriptorSet to allocate. |
binding_factory | A factory function that creates a list of descriptor bindings for each IDescriptorSet. |
|
inlinenodiscardnoexcept |
Allocates an array of IDescriptorSet.
descriptors_sets | The number of IDescriptorSet to allocate. |
bindings | Optional list of descriptor bindings to initialize the IDescriptorSet with. |
|
inlinenodiscardnoexcept |
Allocates an array of IDescriptorSet.
descriptors_sets | The number of IDescriptorSet to allocate. |
descriptors | The number of descriptors to allocate in an unbounded descriptor array. Ignored if the descriptor array is bounded. |
binding_factory | A factory function that creates a list of descriptor bindings for each IDescriptorSet. |
|
inlinenodiscardnoexcept |
Allocates an array of IDescriptorSet.
descriptors_sets | The number of IDescriptorSet to allocate. |
descriptors | The number of descriptors to allocate in an unbounded descriptor array. Ignored if the descriptor array is bounded. |
bindings | Optional list of descriptor bindings to initialize each IDescriptorSet with. |
|
nodiscardpure virtualnoexcept |
Get the number of texel buffer descriptors in the IDescriptorSet.
Implemented in spark::render::vk::VulkanDescriptorSetLayout.
|
nodiscardpure virtual |
Gets the layout of a descriptor in the IDescriptorSet bound to a specific binding point.
binding | The binding point of the requested descriptor layout. |
binding
.
|
inlinenodiscardnoexcept |
Gets the layouts of all descriptors in the IDescriptorSet.
|
inlinenoexcept |
Marks a IDescriptorSet as unused, so that it can be handed out again instead of allocating a new one.
descriptor_set | The IDescriptorSet to mark as unused. |
|
nodiscardpure virtualnoexcept |
Gets the number of images (textures) in the IDescriptorSet.
Implemented in spark::render::vk::VulkanDescriptorSetLayout.
|
nodiscardpure virtualnoexcept |
Gets the number of input attachments in the IDescriptorSet.
Implemented in spark::render::vk::VulkanDescriptorSetLayout.
|
nodiscardpure virtualnoexcept |
Gets the number of texel buffer descriptors in the IDescriptorSet.
Implemented in spark::render::vk::VulkanDescriptorSetLayout.
|
nodiscardpure virtualnoexcept |
Gets the shader stage the IDescriptorSet is used in.
Implemented in spark::render::vk::VulkanDescriptorSetLayout.
|
nodiscardpure virtualnoexcept |
Gets the space index of the IDescriptorSet.
Implemented in spark::render::vk::VulkanDescriptorSetLayout.
|
nodiscardpure virtualnoexcept |
Gets the number of static/immutable samplers in the IDescriptorSet.
Implemented in spark::render::vk::VulkanDescriptorSetLayout.
|
nodiscardpure virtualnoexcept |
Gets the number of storage buffers in the IDescriptorSet.
Implemented in spark::render::vk::VulkanDescriptorSetLayout.
|
nodiscardpure virtualnoexcept |
Gets the number of uniform/constant buffers in the IDescriptorSet.
Implemented in spark::render::vk::VulkanDescriptorSetLayout.