#include <descriptorsetcache.h>
Public Member Functions | |
| DescriptorSetCache (RenderService &renderService, VkDescriptorSetLayout layout, DescriptorSetAllocator &descriptorSetAllocator) | |
| ~DescriptorSetCache () | |
| const DescriptorSet & | acquire (const std::vector< UniformBufferObject > &uniformBufferObjects, int numStorageBufferObjects, int numSamplers) |
| void | release (int frameIndex) |
Responsible for caching DescriptorSets and allocating them when the DescriptorSet is not in the cache. A DescriptorSetAllocator allocates DescriptorSets for a specific VkDescriptorSetLayout. Any DescriptorSet that is returned will be compatible with that VkDescriptorSetLayout.
Internally it will maintain a free-list of available DescriptorSets. When a VkDescriptorSet is acquired, it is marked for use by that frame (the current RenderService frame is used). When a frame is fully completed, release should be called for that frame so that the resources are return to the free-list, to be used by subsequent frames.
| DescriptorSetCache | ( | RenderService & | renderService, |
| VkDescriptorSetLayout | layout, | ||
| DescriptorSetAllocator & | descriptorSetAllocator | ||
| ) |
| ~DescriptorSetCache | ( | ) |
| const DescriptorSet& acquire | ( | const std::vector< UniformBufferObject > & | uniformBufferObjects, |
| int | numStorageBufferObjects, | ||
| int | numSamplers | ||
| ) |
Acquires a DescriptorSet from the cache (or allocated it if not in the cache). For new DescriptorSets, also allocates Buffers for each UBO from the global Vulkan allocator. The result is a DescriptorSet that is fully compatible with the DescriptorSetLayout.
| uniformBufferObjects | The list of UBOs for this DescriptorSet. |
| numStorageBufferObjects | The number of HBOs for this DescriptorSet. |
| numSamplers | The number of samplers for this DescriptorSet |
| void release | ( | int | frameIndex | ) |
Releases all DescriptorSets to the internal pool for use by other frames.
| frameIndex | The frame index that was completed by the render system and for which no resources are in use anymore. |