LiteFX::Rendering::DescriptorSetLayout::allocate¶
Allocates a new descriptor set or returns an instance of an unused descriptor set.
Synopsis¶
Declared in <litefx/rendering.hpp>
UniquePtr<descriptor_set_type> allocate(std::initializer_list<DescriptorBinding> bindings = { }) const;Description¶
To reduce allocation overhead, the descriptor set layout keeps the local descriptor storage of freed descriptor sets and re-uses it for subsequent allocations. When a descriptor set is destroyed, it calls free to return its storage to the layout. Each allocated set also reserves a range on the global descriptor heaps, which is released when the set is destroyed.
The above does not apply to descriptor sets containing an unbounded descriptor array (see IDescriptorLayout::unbounded). Their size is defined by the descriptors parameter, so their storage is never cached. The unbounded array must be bound to the last binding of the descriptor set. Because such sets are not cached, freeing and re-allocating them may fragment the global descriptor heap, which can cause allocations to fail if the heap is full.
Return Value¶
The instance of the descriptor set.
Parameters¶
| Name | Description |
|---|---|
| bindings | Optional default bindings for descriptors in the descriptor set. |