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

Aggregate budget for render targets, layers, masks, clips, and pattern tiles. More...

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

Classes

struct  Limits
 Per-frame limits, including any tighter limits installed by a test. More...

Public Member Functions

void reset ()
 Clears usage counters and the sticky rejection state for a new frame.
bool reserve (int width, int height, std::size_t surfaceCount=1, std::uint64_t bytesPerPixel=4)
 Reserves matching surfaces; invalid dimensions or exhausted capacity latch rejection.
bool canReserveBytes (std::uint64_t bytes, std::size_t surfaces) const
 Tests additional capacity without changing counters or latching a rejection.
bool release (int width, int height, std::size_t surfaceCount=1, std::uint64_t bytesPerPixel=4)
 Releases surfaces after their last submitted GPU use, restoring active-capacity accounting.
std::uint64_t bytes () const
 Bytes currently reserved by active surfaces.
Limits limits () const
 The frame's limits, including any tighter limits a test installed.
std::uint64_t peakBytes () const
 Most bytes reserved at once since the last Reset.
std::size_t surfaces () const
 Number of active reserved surfaces.
bool rejected () const
 Whether a reservation or release has failed in this frame.
std::uint64_t refusedRequestBytes () const
 Bytes the reservation that latched this frame's refusal asked for (saturated when the request alone overflows the limit), or zero when no byte limit refused it.
std::uint64_t limitBytes () const
 The aggregate byte limit.
void setLimitsForTesting (Limits limits)
 Tightens limits for a test without raising an existing limit.
void replaceLimitsWithinDefaultsForTesting (Limits limits)
 Sets the limits for a test to limits, clamped to the production defaults: unlike setLimitsForTesting it may raise a limit a test lowered earlier, but never above kMaximumBytes or kMaximumSurfaces.

Static Public Attributes

static constexpr std::uint64_t kMaximumBytes = 256ULL * 1024 * 1024
 Default upper bound on aggregate surface storage.
static constexpr std::size_t kMaximumSurfaces = 256
 Default upper bound on concurrently reserved surfaces.

Detailed Description

Aggregate budget for render targets, layers, masks, clips, and pattern tiles.


Class Documentation

◆ donner::svg::RendererSurfaceBudget::Limits

struct donner::svg::RendererSurfaceBudget::Limits

Per-frame limits, including any tighter limits installed by a test.

Class Members
uint64_t bytes = kMaximumBytes Maximum aggregate surface bytes.
size_t surfaces = kMaximumSurfaces Maximum active surface count.

Member Function Documentation

◆ canReserveBytes()

bool donner::svg::RendererSurfaceBudget::canReserveBytes ( std::uint64_t bytes,
std::size_t surfaces ) const
inlinenodiscard

Tests additional capacity without changing counters or latching a rejection.

Parameters
bytesAdditional allocation bytes.
surfacesAdditional texture count.

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