evan 2026.1.4
Evan
Loading...
Searching...
No Matches
evan::TransferManager Class Reference

Owns staging memory and command buffers used to upload data to device-local resources without draining the graphics queue. More...

#include <headers/evan/TransferManager.hpp>

Public Member Functions

 TransferManager (const TransferManager &)=delete
 
TransferManager & operator= (const TransferManager &)=delete
 
void init (VkDevice device, VkPhysicalDevice physicalDevice, VkQueue graphicsQueue, uint32_t graphicsFamily)
 Initializes the transfer queue and command pool.
 
void destroy ()
 Releases every Vulkan resource owned by this manager.
 
void uploadBuffer (const void *data, VkDeviceSize size, VkBuffer dst, VkDeviceSize dstOffset=0)
 Copies host data into the staging ring and records a vkCmdCopyBuffer from the ring slot into dst.
 
void uploadBufferToImage (const void *data, VkDeviceSize size, VkImage dst, const VkBufferImageCopy &region)
 Copies host data into the staging ring and records a vkCmdCopyBufferToImage from the ring slot into dst.
 
void transitionImageLayout (VkImage image, VkFormat format, VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t mipLevels)
 Records an image layout transition into the current batch.
 
void generateMipmaps (VkImage image, VkFormat format, uint32_t width, uint32_t height, uint32_t mipLevels)
 Records a mipmap generation chain into the current batch.
 
void flush ()
 Submits the pending transfer command buffer, if any.
 
void waitIdle ()
 Flushes pending work and blocks until every submitted batch has completed on the GPU.
 

Detailed Description

Owns staging memory and command buffers used to upload data to device-local resources without draining the graphics queue.

Uploads are recorded into a single transfer command buffer and only submitted when flush() is called. Submission is asynchronous: a fence is stored per batch and the staging ring is only reused once that fence has signaled. This removes the per-copy vkQueueWaitIdle stall previously performed by ADeviceBackend::endSingleTimeCommands.

Definition at line 27 of file TransferManager.hpp.

Member Function Documentation

◆ init()

void evan::TransferManager::init ( VkDevice  device,
VkPhysicalDevice  physicalDevice,
VkQueue  graphicsQueue,
uint32_t  graphicsFamily 
)

Initializes the transfer queue and command pool.

Parameters
deviceThe Vulkan logical device.
physicalDeviceThe Vulkan physical device.
graphicsQueueThe queue used to submit transfer work. In this iteration transfers are submitted to the graphics queue so uploads are ordered before draw submissions without cross-queue synchronization.
graphicsFamilyThe queue family index of graphicsQueue.

The documentation for this class was generated from the following file: