Donner SVG 0.8.0
0.8.0 ยท ebf353960.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::gpu::vulkan::VulkanQueueProgress Class Reference

When the one queue every runtime device over a Vulkan root submits to last made progress. More...

#include "donner/gpu/vulkan/VulkanQueueProgress.h"

Public Member Functions

 VulkanQueueProgress (const VulkanApi &api, VkDevice device)
 ~VulkanQueueProgress ()
 Destroys every event. No submission that sets one may still be pending.
 VulkanQueueProgress (const VulkanQueueProgress &)=delete
VulkanQueueProgress & operator= (const VulkanQueueProgress &)=delete
 VulkanQueueProgress (VulkanQueueProgress &&)=delete
VulkanQueueProgress & operator= (VulkanQueueProgress &&)=delete
Result< VkEvent > acquire ()
 An unset event for a command buffer being encoded to set as it finishes.
void releaseUnsubmitted (std::span< const VkEvent > events)
 Takes back events whose command buffers the queue did not accept, or ran only before a reported device loss was drained.
void noteSubmitted (std::span< const VkEvent > events)
 Records that the queue accepted work whose command buffers set events, which may be none. Work accepted while none of the tracked work was outstanding starts the progress clock, whether or not it sets events. Call under the queue lock, so work is noted in queue order.
void retire (std::span< const VkEvent > events)
 Takes back the events of a submission that has completed. Any not yet seen set count as progress now.
std::chrono::steady_clock::time_point observe ()
 Looks for events set since the last look, and returns when the queue last made progress.

Detailed Description

When the one queue every runtime device over a Vulkan root submits to last made progress.

Work on that queue completes in order, so a submission completes only after everything queued ahead of it, other devices' work included. A wait for it therefore judges a hang by whether the queue is still finishing work, not by a budget for the whole backlog, and not by its own device's completions alone, which a sibling's long work ahead of it would hold back.

Each command buffer a runtime device submits ends by setting an event taken from here, and an event seen set is a command buffer finished. The queue last made progress when an event was last seen set, or when work was submitted while none of the tracked work was outstanding, which starts the clock. That includes work that sets no event, such as a texture upload or a swapchain's frame handover, so a wait for it is not judged by progress from long before it was submitted. A single command buffer that runs longer than a wait's bound is therefore indistinguishable from a hang. Work that sets no event never counts as outstanding, though: each submission made while only such work is outstanding starts the clock again, so a hang in it is caught up to one bound after the last such submission rather than after the hang began.

Progress is timed when it is seen, not when it happened: an event is seen when a wait or observe looks, or when its submission completes and its device gives it back. Command buffers that finished while nothing looked therefore count as progress at the next look, and the first wait after such a stretch can run for up to its whole bound from that look even when the queue stopped earlier. A wait that keeps looking sees each one within a step.

Events are pooled. One goes back to the pool once the submission whose command buffer set it has completed, and every event is destroyed with this object, which the root destroys before its device. Thread-safe: each device over the root reaches it from its own thread.

Constructor & Destructor Documentation

◆ VulkanQueueProgress()

donner::gpu::vulkan::VulkanQueueProgress::VulkanQueueProgress ( const VulkanApi & api,
VkDevice device )
Parameters
apiEntry points of the root's device; outlives this object.
deviceThe root's device; outlives this object.

Member Function Documentation

◆ noteSubmitted()

void donner::gpu::vulkan::VulkanQueueProgress::noteSubmitted ( std::span< const VkEvent > events)

Records that the queue accepted work whose command buffers set events, which may be none. Work accepted while none of the tracked work was outstanding starts the progress clock, whether or not it sets events. Call under the queue lock, so work is noted in queue order.

Parameters
eventsEvents the accepted command buffers set, from acquire.

◆ releaseUnsubmitted()

void donner::gpu::vulkan::VulkanQueueProgress::releaseUnsubmitted ( std::span< const VkEvent > events)

Takes back events whose command buffers the queue did not accept, or ran only before a reported device loss was drained.

Parameters
eventsEvents from acquire that no pending command buffer refers to.

◆ retire()

void donner::gpu::vulkan::VulkanQueueProgress::retire ( std::span< const VkEvent > events)

Takes back the events of a submission that has completed. Any not yet seen set count as progress now.

Parameters
eventsEvents the completed submission's command buffers set.

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