Class UploadQueue#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Type#

  • public std::enable_shared_from_this< UploadQueue >

Class Documentation#

class UploadQueue : public std::enable_shared_from_this<UploadQueue>#

Submits a model’s upload fills on the device’s upload queue without the CPU waiting for them: timeline semaphores tell which fills are done, and the graphics queue waits on them before every command submitted after the fill. Device-thread only, like the queues it submits to.

Public Functions

UploadQueue(std::shared_ptr<VulkanDevice> device, vk::CommandPool upload_pool, vk::CommandPool acquire_pool)#

upload_pool is on the device’s upload family, acquire_pool on its graphics family, or null when the two families are one; this destroys both.

UploadQueue(const UploadQueue&) = delete#
UploadQueue &operator=(const UploadQueue&) = delete#
UploadQueue(UploadQueue&&) = delete#
UploadQueue &operator=(UploadQueue&&) = delete#
~UploadQueue()#
vk::CommandBuffer begin()#

A command buffer on the upload family, begun for one submit; null when none could be allocated.

StagingRing takeRing(vk::DeviceSize bytes)#

A ring of at least bytes: an idle one, else a new one while fewer than kMaxRingsInFlight are in flight, else the oldest once its copies are done, or a new one if that wait ends without them. Its buffer is null when none could be made.

UploadPoint submit(vk::CommandBuffer commands, StagingRing &&ring, std::span<const UploadedImage> images, std::span<const vk::Buffer> buffers)#

Releases images and buffers to the graphics queue, submits without waiting and holds ring and the command buffers until the GPU is done. Returns the point whose reach makes the fill readable, empty when a submit failed, which leaves nothing pending. The acquire is recorded first, so only its submit fails after the copies.

void collect()#

Frees what finished fills held, idle rings included, without waiting; once a frame.

bool reached(const UploadPoint &point) const#
void waitFor(const UploadPoint &point)#

Blocks until point is reached: only a release of resources an unfinished fill still writes needs it.

inline bool usesUploadFamily() const#
inline UploadRouteKind route() const#
inline const UploadOwnership &families() const#
inline std::uint64_t submitCount() const#
inline std::uint64_t hostWaitCount() const#

Every time the CPU waited for a fill: a full ring set, or a release ahead of its upload.

inline void splitSubmitsForTesting(bool split)#

The graphics side in a submit of its own even where uploads share its queue, as with an upload family.

inline void waitTimeoutForTesting(std::uint64_t nanoseconds)#

Bounds every host wait, so a test can make one end before the copies do.

std::size_t ringsInFlight() const#

Fills in flight that hold a staging ring.

Public Static Attributes

static constexpr std::size_t kMaxRingsInFlight = 2#