Universal Dirty Flag & Texture Caching System #144
Labels
No Label
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: john/McRogueFace#144
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
Expand the dirty flag system (#116) to provide optional texture caching for any UIDrawable subtree, enabling single-blit rendering of complex static UI hierarchies.
Background
Key Insight: Position vs Content Dirtiness
Position animations dirty the parent, not the child:
This means developers can strategically enable caching on subtrees that:
Proposed Features
1. Opt-in Subtree Caching
2. Smart Cache Invalidation
markDirty()triggers texture rebuild only whencache_subtree=True3. Clipped vs Non-Clipped Behavior
clip_children=True): Texture size = frame size (stable)4. Memory Management
5. Performance Metrics
getMetrics()Python APIImmediate Prerequisites
Bug fix needed first: Several UIDrawable subclasses don't call
markDirty()in theirsetProperty()methods:This must be fixed before the caching system can work correctly.
Definition of Done
Related Issues
Implementation Progress
Completed ✅
cache_subtreeproperty on Frame - Enables opt-in texture caching for any frame and its childrenFrame(pos=(x,y), size=(w,h), cache_subtree=True)frame.cache_subtree = TrueBenchmarks show measurable improvement
deep_nesting(15-level hierarchy): 0.287ms → 0.081ms with caching (3.5x faster)markDirty() already implemented - All UIDrawable subclasses call
markDirty()on property changes (prerequisite was done earlier)Content changes invalidate caches - Any property change triggers cache rebuild via
markDirty()propagationRemaining Work
Position vs Content distinction - Currently ALL changes trigger rebuild. Optimization: position changes should only mark parent dirty, not rebuild child texture. This requires more sophisticated dirty flag handling.
Memory management - No texture pooling or max size limits yet. Currently unbounded.
F3 overlay statistics - Not implemented. Would need cache hit/miss counters.
Documentation - Need to document when caching is beneficial:
Benchmark Results
The static_scene test shows that caching simple frames doesn't help when a Grid (1200 cells + 20 entities) dominates render time.