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

Aggregate conversion, rasterization, and upload work shared by a render frame. More...

#include "donner/svg/renderer/RendererInterface.h"

Classes

struct  Cost
 Work charged to the shared budget by one draw operation or batch. More...
class  PathMeasurementReservation
 Exclusive reservation for one bounded path-measurement query. More...

Public Member Functions

void reset ()
 Clears aggregate costs, any outstanding measurement reservation, and rejection.
void reject ()
 Latches rejection after an external draw-work failure.
void setGradientStopLimitForTesting (std::size_t maximum)
 Tightens the gradient-stop cap for a test without raising it.
bool reserve (const Cost &cost)
 Charges a draw cost, or latches rejection if any aggregate cap is exceeded.
std::optional< PathMeasurementReservation > reservePathMeasurement ()
 Reserves all remaining path-measurement work before a bounded query starts.
bool reconcilePathMeasurement (const PathMeasurementReservation &reservation, std::size_t actualWorkUnits, bool completed)
 Reconciles an exclusive path-measurement reservation to work actually consumed.
std::size_t drawCalls () const
 Draw operations charged in this frame.
std::size_t pathCommands () const
 Path commands charged in this frame.
std::size_t pathMeasurementWorkUnits () const
 Path-measurement work charged in this frame.
std::size_t gradientStops () const
 Gradient stops charged in this frame.
std::size_t imageDraws () const
 Image draw operations charged in this frame.
std::uint64_t imageBytes () const
 Image bytes charged in this frame.
bool rejected () const
 Whether any draw charge or external draw work failed.

Static Public Attributes

static constexpr std::size_t kMaximumDrawCalls = 64 * 1024
 Maximum draw operations admitted in one frame.
static constexpr std::size_t kMaximumPathCommands = 256 * 1024
 Maximum path commands converted or drawn in one frame.
static constexpr std::size_t kMaximumPathMeasurementWorkUnits = Path::kMaximumGeometryQueryWork
 Maximum cumulative work spent measuring path geometry.
static constexpr std::size_t kMaximumGradientStops = 256 * 1024
 Maximum gradient stops processed in one frame.
static constexpr std::size_t kMaximumImageDraws = 128
 Maximum image draw operations in one frame.
static constexpr std::uint64_t kMaximumImageBytes = 256ULL * 1024 * 1024
 Maximum image bytes admitted for drawing in one frame.

Detailed Description

Aggregate conversion, rasterization, and upload work shared by a render frame.


Class Documentation

◆ donner::svg::RendererDrawBudget::Cost

struct donner::svg::RendererDrawBudget::Cost

Work charged to the shared budget by one draw operation or batch.

Class Members
size_t drawCalls = 0 Draw operations.
size_t gradientStops = 0 Gradient stops.
uint64_t imageBytes = 0 Source-image bytes.
size_t imageDraws = 0 Image draw operations.
size_t pathCommands = 0 Path commands.
size_t pathMeasurementWorkUnits = 0 Geometry-query work units.

Member Function Documentation

◆ reconcilePathMeasurement()

bool donner::svg::RendererDrawBudget::reconcilePathMeasurement ( const PathMeasurementReservation & reservation,
std::size_t actualWorkUnits,
bool completed )
inlinenodiscard

Reconciles an exclusive path-measurement reservation to work actually consumed.

An incomplete query consumes its reported work and rejects the aggregate budget.

◆ reservePathMeasurement()

std::optional< PathMeasurementReservation > donner::svg::RendererDrawBudget::reservePathMeasurement ( )
inlinenodiscard

Reserves all remaining path-measurement work before a bounded query starts.

The caller must pass the returned maximum to the query, then call reconcilePathMeasurement with the query's actual work and completion outcome.


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