Donner SVG 0.8.0-pre
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::svg::components::FilterExecutionBudget Class Reference

Shared per-frame filter budget. More...

#include "donner/svg/components/filter/FilterGraph.h"

Classes

struct  Reservation
 Successful preflight reservation made before allocating a filter capture surface. More...

Public Types

enum class  RejectionReason : std::uint8_t {
  None ,
  InvalidGraph ,
  ExecutionLimit ,
  WorkLimit ,
  MemoryLimit ,
  External
}

Public Member Functions

void reset ()
 Reset all per-frame accounting.
bool beginChunkAfterSubmit ()
 Release GPU-retained accounting after submitting one ordered command-buffer chunk.
std::optional< Reservationreserve (const FilterGraph &graph, std::uint64_t pixelCount, FilterMemoryModel memoryModel, std::uint64_t captureBytes)
 Reserve graph execution and capture memory before allocating the capture surface.
void release (Reservation &reservation)
 Release a successful CPU capture reservation after its filter layer is popped.
bool consume (const FilterGraph &graph, std::uint64_t pixelCount, FilterMemoryModel memoryModel)
 Consume a graph at execution time for direct callers without a capture preflight.
void reject ()
 Latch the frame closed after an allocation or other external preflight failure.
std::uint64_t executions () const
std::uint64_t workUnits () const
std::uint64_t retainedBytes () const
std::uint64_t captureBytesReserved () const
std::uint64_t activeGpuReservations () const
std::uint64_t retainedGpuBytes () const
std::uint64_t chunks () const
 Ordered GPU chunks submitted since this budget was constructed.
bool rejected () const
RejectionReason rejectionReason () const

Static Public Attributes

static constexpr std::uint64_t kMaximumExecutions = 1024
 Maximum number of graph executions, including zero-area and otherwise inexpensive graphs.

Detailed Description

Shared per-frame filter budget.

A graph that is safe in isolation can still exhaust memory or CPU when an SVG repeats it across many elements or <use> instances. Renderers reset this object at beginFrame() and consume it before every graph execution.


Class Documentation

◆ donner::svg::components::FilterExecutionBudget::Reservation

struct donner::svg::components::FilterExecutionBudget::Reservation

Successful preflight reservation made before allocating a filter capture surface.

Class Members
bool active = false
uint64_t captureBytes = 0
FilterMemoryModel memoryModel = FilterMemoryModel::CpuFloatNamedResults

Member Function Documentation

◆ reserve()

std::optional< Reservation > donner::svg::components::FilterExecutionBudget::reserve ( const FilterGraph & graph,
std::uint64_t pixelCount,
FilterMemoryModel memoryModel,
std::uint64_t captureBytes )
inline

Reserve graph execution and capture memory before allocating the capture surface.

Rejection latches the frame closed, preventing a document from repeatedly attempting large allocations that were never charged. CPU capture bytes are released at pop; GPU capture and intermediate textures remain charged until frame reset because command buffers retain them.


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