![]() |
LiteFX 0.3.1.2022
Computer Graphics Engine
|
The interface for a descriptor set layout. More...
#include <rendering_api.hpp>
Inherited by LiteFX::Rendering::DescriptorSetLayout< DirectX12DescriptorLayout, DirectX12DescriptorSet >, LiteFX::Rendering::DescriptorSetLayout< VulkanDescriptorLayout, VulkanDescriptorSet >, and LiteFX::Rendering::DescriptorSetLayout< TDescriptorLayout, TDescriptorSet >.
Public Member Functions | |
virtual | ~IDescriptorSetLayout () noexcept=default |
Array< const IDescriptorLayout * > | descriptors () const noexcept |
Returns the layouts of the descriptors within the descriptor set. More... | |
virtual const IDescriptorLayout & | descriptor (const UInt32 &binding) const =0 |
Returns the descriptor layout for the descriptor bound to the binding point provided with binding . More... | |
virtual const UInt32 & | space () const noexcept=0 |
Returns the space index of the descriptor set. More... | |
virtual const ShaderStage & | shaderStages () const noexcept=0 |
Returns the shader stages, the descriptor set is used in. More... | |
virtual UInt32 | uniforms () const noexcept=0 |
Returns the number of uniform/constant buffer descriptors within the descriptor set. More... | |
virtual UInt32 | storages () const noexcept=0 |
Returns the number of structured and byte address buffer descriptors within the descriptor set. More... | |
virtual UInt32 | images () const noexcept=0 |
Returns the number of image (i.e. texture) descriptors within the descriptor set. More... | |
virtual UInt32 | buffers () const noexcept=0 |
Returns the number of texel buffer descriptors within the descriptor set. More... | |
virtual UInt32 | samplers () const noexcept=0 |
Returns the number of dynamic sampler descriptors within the descriptor set. More... | |
virtual UInt32 | staticSamplers () const noexcept=0 |
Returns the number of static or immutable sampler descriptors within the descriptor set. More... | |
virtual UInt32 | inputAttachments () const noexcept=0 |
Returns the number of input attachment descriptors within the descriptor set. More... | |
UniquePtr< IDescriptorSet > | allocate (const UInt32 &descriptors=0) const |
Allocates a new descriptor set or returns an instance of an unused descriptor set. More... | |
Array< UniquePtr< IDescriptorSet > > | allocateMultiple (const UInt32 &descriptorSets, const UInt32 &descriptors=0) const |
Allocates an array of descriptor sets. More... | |
void | free (const IDescriptorSet &descriptorSet) const noexcept |
Marks a descriptor set as unused, so that it can be handed out again instead of allocating a new one. More... | |
The interface for a descriptor set layout.
|
virtualdefaultnoexcept |
|
inline |
Allocates a new descriptor set or returns an instance of an unused descriptor set.
descriptors | The number of descriptors to allocate in an unbounded descriptor array. Ignored, if the descriptor set does not contain an unbounded array. |
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 DescriptorSet instance gets destroyed, it should call 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 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.
|
inline |
Allocates an array of descriptor sets.
descriptorSets | The number of descriptor sets to allocate. |
descriptors | The number of descriptors to allocate in an unbounded descriptor array. Ignored, if the descriptor set does not contain an unbounded array. |
|
pure virtualnoexcept |
Returns the number of texel buffer descriptors within the descriptor set.
Implemented in LiteFX::Rendering::Backends::DirectX12DescriptorSetLayout, and LiteFX::Rendering::Backends::VulkanDescriptorSetLayout.
|
pure virtual |
Returns the descriptor layout for the descriptor bound to the binding point provided with binding .
binding | The binding point of the requested descriptor layout. |
Implemented in LiteFX::Rendering::DescriptorSetLayout< TDescriptorLayout, TDescriptorSet >, LiteFX::Rendering::Backends::DirectX12DescriptorSetLayout, LiteFX::Rendering::Backends::VulkanDescriptorSetLayout, LiteFX::Rendering::DescriptorSetLayout< DirectX12DescriptorLayout, DirectX12DescriptorSet >, and LiteFX::Rendering::DescriptorSetLayout< VulkanDescriptorLayout, VulkanDescriptorSet >.
|
inlinenoexcept |
Returns the layouts of the descriptors within the descriptor set.
|
inlinenoexcept |
Marks a descriptor set as unused, so that it can be handed out again instead of allocating a new one.
|
pure virtualnoexcept |
Returns the number of image (i.e. texture) descriptors within the descriptor set.
Implemented in LiteFX::Rendering::Backends::DirectX12DescriptorSetLayout, and LiteFX::Rendering::Backends::VulkanDescriptorSetLayout.
|
pure virtualnoexcept |
Returns the number of input attachment descriptors within the descriptor set.
Implemented in LiteFX::Rendering::Backends::DirectX12DescriptorSetLayout, and LiteFX::Rendering::Backends::VulkanDescriptorSetLayout.
|
pure virtualnoexcept |
Returns the number of dynamic sampler descriptors within the descriptor set.
Implemented in LiteFX::Rendering::Backends::DirectX12DescriptorSetLayout, and LiteFX::Rendering::Backends::VulkanDescriptorSetLayout.
|
pure virtualnoexcept |
Returns the shader stages, the descriptor set is used in.
Implemented in LiteFX::Rendering::Backends::DirectX12DescriptorSetLayout, and LiteFX::Rendering::Backends::VulkanDescriptorSetLayout.
|
pure virtualnoexcept |
Returns the space index of the descriptor set.
The descriptor set space maps to the space index in HLSL and the set index in GLSL.
Implemented in LiteFX::Rendering::Backends::DirectX12DescriptorSetLayout, and LiteFX::Rendering::Backends::VulkanDescriptorSetLayout.
|
pure virtualnoexcept |
Returns the number of static or immutable sampler descriptors within the descriptor set.
Implemented in LiteFX::Rendering::Backends::DirectX12DescriptorSetLayout, and LiteFX::Rendering::Backends::VulkanDescriptorSetLayout.
|
pure virtualnoexcept |
Returns the number of structured and byte address buffer descriptors within the descriptor set.
Implemented in LiteFX::Rendering::Backends::DirectX12DescriptorSetLayout, and LiteFX::Rendering::Backends::VulkanDescriptorSetLayout.
|
pure virtualnoexcept |
Returns the number of uniform/constant buffer descriptors within the descriptor set.
Implemented in LiteFX::Rendering::Backends::DirectX12DescriptorSetLayout, and LiteFX::Rendering::Backends::VulkanDescriptorSetLayout.