TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::UICacheManager Class Reference

Retained-render cache for BeginCached/EndCached scopes. More...

#include <gui_controls/subsystems/gui_ui_cache_subsystem.h>

Classes

struct  Scope
 Only what's needed to decide whether a scope is still clean and to blit it; not the element tree. More...
struct  HitInput
 Per-frame input facts that decide whether a scope may be served from cache. More...

Public Member Functions

 UICacheManager (FramePipeline &frame, ElementStorage &storage, GUIStateManager &stateManager)
Scope & GetOrCreate (ID id)
 The scope with id, created on first use.
Scope * Find (ID id)
 The scope with id, or nullptr.
bool EvaluateHit (const Scope &s, uint64_t signature, const HitInput &input) const
 True when scope s, built with data signature, can be served from cache this frame.
void Invalidate (ID id)
 Rebuilds scope id the next time it is reached, and its enclosing scopes (an outer hit skips inner content too).
void InvalidateAll ()
 Bumps the global epoch so every scope rebuilds (theme reload, display scale change).
uint64_t CurrentFrame () const
 Frame counter, advanced once per frame.
uint64_t ThemeEpoch () const
 Global epoch that InvalidateAll() bumps.
void SetDrawCacheEnabled (bool e)
 When off, EvaluateHit always misses and every scope rebuilds (for A/B comparison).
bool IsDrawCacheEnabled () const
void RecordResult (bool hit)
 Counts a scope served from cache (hit) or rebuilt.
void RecordDrawReplay ()
 a scope's draw blitted from cache
void RecordDrawCapture ()
 a scope's draw (re)captured this frame
uint32_t FrameHits () const
uint32_t FrameMisses () const
uint32_t FrameDrawReplays () const
uint32_t FrameDrawCaptures () const
size_t ScopeCount () const

Static Public Member Functions

static ID MemberOrNull (const Scope &s, ID id)
 id when scope s contains it, else Invalid.

Static Public Attributes

static constexpr float kDrawSettleSecs = 0.15f
 Seconds for transitions to settle after a rebuild before capturing.

Detailed Description

Retained-render cache for BeginCached/EndCached scopes.

On a frame where nothing relevant changed, the scope's body is skipped and OnRender blits the primitives captured when it was last rendered.

This subsystem owns the per-scope state and the invalidation policy; the draw capture/blit lives in GUIApplication::OnRender. A scope rebuilds when:

  • its container's allotted (inner) size changed (auto, OnPostLayout)
  • hover/active/focus/capture crossed its element set (auto, EvaluateHit)
  • Invalidate(id) was called, or an ancestor scope was (explicit)
  • the optional data signature changed
  • the theme was reloaded (global epoch)

Constructor & Destructor Documentation

◆ UICacheManager()

tachyon::UICacheManager::UICacheManager ( FramePipeline & frame,
ElementStorage & storage,
GUIStateManager & stateManager )

Member Function Documentation

◆ GetOrCreate()

Scope & tachyon::UICacheManager::GetOrCreate ( ID id)

The scope with id, created on first use.

◆ Find()

Scope * tachyon::UICacheManager::Find ( ID id)

The scope with id, or nullptr.

◆ EvaluateHit()

bool tachyon::UICacheManager::EvaluateHit ( const Scope & s,
uint64_t signature,
const HitInput & input ) const

True when scope s, built with data signature, can be served from cache this frame.

◆ Invalidate()

void tachyon::UICacheManager::Invalidate ( ID id)

Rebuilds scope id the next time it is reached, and its enclosing scopes (an outer hit skips inner content too).

◆ InvalidateAll()

void tachyon::UICacheManager::InvalidateAll ( )
inline

Bumps the global epoch so every scope rebuilds (theme reload, display scale change).

◆ CurrentFrame()

uint64_t tachyon::UICacheManager::CurrentFrame ( ) const
inline

Frame counter, advanced once per frame.

◆ ThemeEpoch()

uint64_t tachyon::UICacheManager::ThemeEpoch ( ) const
inline

Global epoch that InvalidateAll() bumps.

◆ SetDrawCacheEnabled()

void tachyon::UICacheManager::SetDrawCacheEnabled ( bool e)
inline

When off, EvaluateHit always misses and every scope rebuilds (for A/B comparison).

◆ IsDrawCacheEnabled()

bool tachyon::UICacheManager::IsDrawCacheEnabled ( ) const
inline

◆ RecordResult()

void tachyon::UICacheManager::RecordResult ( bool hit)
inline

Counts a scope served from cache (hit) or rebuilt.

◆ RecordDrawReplay()

void tachyon::UICacheManager::RecordDrawReplay ( )
inline

a scope's draw blitted from cache

◆ RecordDrawCapture()

void tachyon::UICacheManager::RecordDrawCapture ( )
inline

a scope's draw (re)captured this frame

◆ FrameHits()

uint32_t tachyon::UICacheManager::FrameHits ( ) const
inline

◆ FrameMisses()

uint32_t tachyon::UICacheManager::FrameMisses ( ) const
inline

◆ FrameDrawReplays()

uint32_t tachyon::UICacheManager::FrameDrawReplays ( ) const
inline

◆ FrameDrawCaptures()

uint32_t tachyon::UICacheManager::FrameDrawCaptures ( ) const
inline

◆ ScopeCount()

size_t tachyon::UICacheManager::ScopeCount ( ) const
inline

◆ MemberOrNull()

ID tachyon::UICacheManager::MemberOrNull ( const Scope & s,
ID id )
inlinestatic

id when scope s contains it, else Invalid.

Member Data Documentation

◆ kDrawSettleSecs

float tachyon::UICacheManager::kDrawSettleSecs = 0.15f
staticconstexpr

Seconds for transitions to settle after a rebuild before capturing.


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