Donner SVG main
0.8.0 ยท 382bd0190.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::editor::gui::internal::PresentationSubmissionQueue Class Reference

Bounds pending UI submissions while retaining only the most recent input request. More...

#include "donner/editor/gui/EditorWindow.h"

Classes

struct  Fence
 One submitted UI frame: the GPU serial that retires it and the input it presented. More...
struct  CompletionObservation
 Serial and clock read after a bounded GPU completion confirmation. More...

Public Types

enum class  Admission {
  Ready ,
  Busy ,
  TimedOut
}
 Whether another UI frame may be submitted. More...
using Clock = std::chrono::steady_clock
 Clock that times pending submissions.
using FrameCompletionObserver = std::function<void(const Fence&)>
 Observer called once per retired frame, in submission order, including frames in one poll.

Public Member Functions

Admission observe (std::uint64_t completedSerial, Clock::time_point now, std::optional< Clock::time_point > lastProgress=std::nullopt, const FrameCompletionObserver &onCompleted={})
 Observe completion before admitting a frame; a stopped queue reaches a finite deadline.
template<typename CompletionProbe>
requires std::invocable<CompletionProbe&>
Admission observe (std::uint64_t completedSerial, Clock::time_point now, CompletionProbe &&confirmCompletion, const FrameCompletionObserver &onCompleted={})
 Recheck an expired submission using a bounded completion query.
void submitted (Fence fence)
 Seal the serial and input that reached the GPU as one UI frame.
std::uint64_t admissionSequence () const
 Monotonic last admission, independent of backend submission serial resets.
std::size_t pendingCount () const
 Number of submitted frames whose GPU work has not been observed complete.
Fence completed () const
 Most recently retired frame, or a default fence before any frame retires.
std::uint64_t oldestSerial () const
 Serial of the oldest pending frame, or zero when none is pending.
std::chrono::milliseconds oldestAge (Clock::time_point now) const
 Elapsed time of the oldest unfinished frame without restarting its submission clock.

Static Public Attributes

static constexpr std::chrono::seconds kCompletionDeadline {5}
 How long the oldest pending submission may stay unfinished while the device makes no progress.

Friends

std::ostream & operator<< (std::ostream &os, Admission admission)
 Ostream output operator, e.g. Busy.

Detailed Description

Bounds pending UI submissions while retaining only the most recent input request.


Class Documentation

◆ donner::editor::gui::internal::PresentationSubmissionQueue::Fence

struct donner::editor::gui::internal::PresentationSubmissionQueue::Fence

One submitted UI frame: the GPU serial that retires it and the input it presented.

Class Members
uint64_t admissionSequence = 0 Window-owned admission order across device resets.
uint64_t captureId = 0 Raster capture paired with the frame.
uint64_t documentGeneration = 0 Document lifetime sealed with the frame.
uint64_t frameId = 0 Presentation frame identity.
uint64_t frameVersion = 0 Committed document mutation version.
bool fullFramePresented = false Both document and UI passed surface acceptance.
bool inputRepresented = false Whether the frame represents the input sealed with it; cleared when the full frame was not presented.
bool mouseDown = false Whether the primary button was down when sealed.
double pointerX = 0.0 Pointer x position when the frame was sealed.
double pointerY = 0.0 Pointer y position when the frame was sealed.
uint64_t producerGeneration = 0 Presentation producer lifetime.
uint64_t serial = 0 Last GPU submission serial of the frame.
time_point submittedAt When the frame's work was submitted.
bool surfacePresented = false The frame targeted the visible surface.
double viewportZoom = 0.0 Viewport zoom the frame was drawn with.

◆ donner::editor::gui::internal::PresentationSubmissionQueue::CompletionObservation

struct donner::editor::gui::internal::PresentationSubmissionQueue::CompletionObservation

Serial and clock read after a bounded GPU completion confirmation.

Class Members
time_point observedAt When the completion was observed.
uint64_t serial Highest completed submission serial observed.

Member Enumeration Documentation

◆ Admission

Whether another UI frame may be submitted.

Enumerator
Ready 

Fewer than three submissions are pending and none has timed out.

Busy 

At least three submissions are pending and none has timed out. The oldest pending submission has waited at least kCompletionDeadline, and the work it waits behind has made no progress for that long either.

Member Function Documentation

◆ observe()

Admission donner::editor::gui::internal::PresentationSubmissionQueue::observe ( std::uint64_t completedSerial,
Clock::time_point now,
std::optional< Clock::time_point > lastProgress = std::nullopt,
const FrameCompletionObserver & onCompleted = {} )
inline

Observe completion before admitting a frame; a stopped queue reaches a finite deadline.

A frame's work completes only after everything queued ahead of it, so an old frame behind a device that is still finishing work is slow, not stopped: it times out only once the device has also made no progress for kCompletionDeadline.

Parameters
completedSerialHighest submission serial the device has completed.
nowCurrent time.
onCompletedReceives every completed frame before it is superseded by a later frame.
lastProgressWhen the device last made progress, or nothing when it does not track progress, in which case the oldest frame's age alone reaches the deadline.

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
Admission admission )
friend

Ostream output operator, e.g. Busy.

Parameters
osOutput stream.
admissionValue to output.

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