Parent: #126
Corresponds to EN-056 in docs/tickets.md
Related: #30
Problem
The renderer still performs avoidable steady-state work: repeated full lighting-buffer uploads, per-frame bloom/pass bind-group allocation, frame-graph construction, and other allocations/uploads documented in EN-056. These costs become significant at 4K, with many materials/lights, and as new quality passes arrive. Previous eager bind-group caching produced a black frame because cache keys missed frame-order/resource-validity state (#30).
Outcome
An allocation-stable steady-state frame with dirty/range-based uploads, persistent pass resources, compiled frame plans, and correctness-backed cache keys.
Required instrumentation
Before optimizing, add per-frame counters/bytes/timers for:
- CPU allocations in renderer prepare/submit where practical;
Queue::write_buffer/staging writes by resource and byte count;
- bind group, pipeline, encoder, and transient physical-resource creation;
- graph compile/build count;
- lighting/material/instance records dirtied vs uploaded;
- cache hit/miss/rebuild reason.
Expose counters through existing profiler output and reset them per frame.
Work breakdown
- Lighting uploads: separate per-frame/view data from light arrays; upload once after light collection or update dirty ranges, not the whole ~8–9 KB block repeatedly.
- Material/instance uploads: use stable GPU buffers, dirty ranges, and growth strategy; avoid rebuilding unchanged records.
- Frame plan: consume the compiled render-graph cache; configuration/uniform changes must not rebuild topology.
- Bind groups: cache only when all bound resource identities/generations and validity state are represented. Land one pass at a time with screenshot/intermediate-buffer diff.
- Transient allocations: reuse graph-planned physical resources across frames/resizes.
- Shader/pipeline creation: prove all steady-state variants are prewarmed or cached; report first-use compilation separately.
Do not cache views of rotating history textures under a key that omits history index/generation/write-validity.
Acceptance criteria
Likely files
native/shared/src/renderer/mod.rs, graph.rs, transient.rs, postfx_chain.rs
- material/light/scene pass modules
native/shared/src/profiler.rs, staging.rs
Non-goals
Dependencies
Parent: #126
Corresponds to EN-056 in
docs/tickets.mdRelated: #30
Problem
The renderer still performs avoidable steady-state work: repeated full lighting-buffer uploads, per-frame bloom/pass bind-group allocation, frame-graph construction, and other allocations/uploads documented in EN-056. These costs become significant at 4K, with many materials/lights, and as new quality passes arrive. Previous eager bind-group caching produced a black frame because cache keys missed frame-order/resource-validity state (#30).
Outcome
An allocation-stable steady-state frame with dirty/range-based uploads, persistent pass resources, compiled frame plans, and correctness-backed cache keys.
Required instrumentation
Before optimizing, add per-frame counters/bytes/timers for:
Queue::write_buffer/staging writes by resource and byte count;Expose counters through existing profiler output and reset them per frame.
Work breakdown
Do not cache views of rotating history textures under a key that omits history index/generation/write-validity.
Acceptance criteria
Likely files
native/shared/src/renderer/mod.rs,graph.rs,transient.rs,postfx_chain.rsnative/shared/src/profiler.rs,staging.rsNon-goals
Dependencies