![]() |
ezEngine Release 26.3
|
A thread-safe pool for batching Vulkan descriptor sets writes. More...
#include <DescriptorWritePoolVulkan.h>
Public Member Functions | |
| ezDescriptorWritePoolVulkan (ezGALDeviceVulkan *pDevice) | |
| void | WriteTransientDescriptor (vk::DescriptorSet descriptorSet, const ezGALBindGroupCreationDescription &desc, ezUniformBufferPoolVulkan *pUniformBufferPool) |
| Writes a transient descriptor set with resources that may include dynamic uniform buffers. | |
| void | WriteDescriptor (vk::DescriptorSet descriptorSet, const ezGALBindGroupCreationDescription &desc, ezDynamicArray< ezUInt32 > &out_Offsets) |
| Writes a persistent descriptor set and extracts dynamic buffer offsets. | |
| ezUInt32 | FlushWrites () |
| Flushes all pending descriptor writes to the GPU. | |
A thread-safe pool for batching Vulkan descriptor sets writes.
This class manages the creation and batching of Vulkan descriptor set writes, supporting both transient and persistent descriptor set updates. All writes are batched and flushed together to minimize API calls before the next bindDescriptorSets call.
| ezUInt32 ezDescriptorWritePoolVulkan::FlushWrites | ( | ) |
Flushes all pending descriptor writes to the GPU.
Right now, this method must be executed before each call to bindDescriptorSets until VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT_EXT is used (Vulkan 1.2). https://registry.khronos.org/vulkan/specs/latest/man/html/VkDescriptorSetLayoutBindingFlagsCreateInfo.html. As we can't guarantee that the API is available, only the inefficient version is implemented for now.
| void ezDescriptorWritePoolVulkan::WriteDescriptor | ( | vk::DescriptorSet | descriptorSet, |
| const ezGALBindGroupCreationDescription & | desc, | ||
| ezDynamicArray< ezUInt32 > & | out_Offsets | ||
| ) |
Writes a persistent descriptor set and extracts dynamic buffer offsets.
This method is used for persistent descriptor sets used by bind group resources. We tag every constant buffer as dynamic in the layout, so we need to extract the offsets for each constant buffer here. The offsets are extracted and stored in the output array for later use during command buffer recording.
| descriptorSet | The Vulkan descriptor set to write to. |
| desc | The bind group creation description containing the resources to write. |
| out_Offsets | Output array that will be filled with dynamic buffer offsets for constant buffers. See ezGALBindGroupVulkan::GetOffsets. |
| void ezDescriptorWritePoolVulkan::WriteTransientDescriptor | ( | vk::DescriptorSet | descriptorSet, |
| const ezGALBindGroupCreationDescription & | desc, | ||
| ezUniformBufferPoolVulkan * | pUniformBufferPool | ||
| ) |
Writes a transient descriptor set with resources that may include dynamic uniform buffers.
This method is used for transient descriptor sets that contain resources which may be allocated from a uniform buffer pool. Transient constant buffers are handled specially by using the uniform buffer pool to obtain their actual buffer info. Offsets are handled separately in ezGALCommandEncoderImplVulkan::UpdateDynamicUniformBufferOffsets.
| descriptorSet | The Vulkan descriptor set to write to. |
| desc | The bind group creation description containing the resources to write. |
| pUniformBufferPool | Pointer to the uniform buffer pool for resolving transient buffers. |