Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::render::GpuIdleTrimSchedule Class Reference

When a surface's idle trim runs. More...

#include <skia_surface.hpp>

Public Types

using Clock = std::chrono::steady_clock

Public Member Functions

 GpuIdleTrimSchedule (Clock::time_point start)
void note_frame (Clock::time_point start)
 Records the start of a frame; begin_frame() calls it when it hands out a canvas, before anything in the frame is drawn.
std::optional< std::chrono::milliseconds > unused_age (Clock::time_point now) const
 How long a resource must have gone unused at now to be trimmed: at least kUnusedAge, and back to the start of the kUnusedFrames-th most recent frame, so anything drawn in those frames is kept.
bool due (Clock::time_point now)
 True when a trim is due at now; records now as the last trim.
std::uint64_t trims () const
 Trims due() has scheduled since construction.

Static Public Attributes

static constexpr std::chrono::milliseconds kInterval {1000}
static constexpr std::chrono::milliseconds kUnusedAge {2000}
static constexpr std::size_t kUnusedFrames = 30

Detailed Description

When a surface's idle trim runs.

end_frame() asks due() once per frame, so the steady-state cost is one timestamp compare; a trim runs at most once per kInterval.

A trim frees only resources that went unused for both kUnusedAge and the last kUnusedFrames frames. Wall time alone would empty an editor that animates in bursts: a two-second pause between bursts would cost it every scratch target, and the next burst would rebuild them all.

Member Typedef Documentation

◆ Clock

using pulp::render::GpuIdleTrimSchedule::Clock = std::chrono::steady_clock

Constructor & Destructor Documentation

◆ GpuIdleTrimSchedule()

pulp::render::GpuIdleTrimSchedule::GpuIdleTrimSchedule ( Clock::time_point start)
inlineexplicit

Member Function Documentation

◆ due()

bool pulp::render::GpuIdleTrimSchedule::due ( Clock::time_point now)
inline

True when a trim is due at now; records now as the last trim.

◆ note_frame()

void pulp::render::GpuIdleTrimSchedule::note_frame ( Clock::time_point start)
inline

Records the start of a frame; begin_frame() calls it when it hands out a canvas, before anything in the frame is drawn.

◆ trims()

std::uint64_t pulp::render::GpuIdleTrimSchedule::trims ( ) const
inline

Trims due() has scheduled since construction.

◆ unused_age()

std::optional< std::chrono::milliseconds > pulp::render::GpuIdleTrimSchedule::unused_age ( Clock::time_point now) const
inline

How long a resource must have gone unused at now to be trimmed: at least kUnusedAge, and back to the start of the kUnusedFrames-th most recent frame, so anything drawn in those frames is kept.

Empty until that many frames have started, when nothing can qualify.

Member Data Documentation

◆ kInterval

std::chrono::milliseconds pulp::render::GpuIdleTrimSchedule::kInterval {1000}
staticconstexpr

◆ kUnusedAge

std::chrono::milliseconds pulp::render::GpuIdleTrimSchedule::kUnusedAge {2000}
staticconstexpr

◆ kUnusedFrames

std::size_t pulp::render::GpuIdleTrimSchedule::kUnusedFrames = 30
staticconstexpr

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