M4.5: RAM preview: render options in the frame key, least-recently-shown eviction, stale frames freed at once
- `FrameKey` carries a hash of the render options (`frames::opts_hash`): switching Fast Previews (Draft / Fast Draft) or Realtime Shadows no longer shows frames rendered the other way. - Eviction drops the least recently shown frame (`Frames::get` touches it), not the oldest inserted: a looping preview a little over budget no longer evicts the frame it shows next. - Frames of earlier project revisions are dropped on every change (`Frames::drop_stale`); they could never be shown again but held memory (and GPU textures) until evicted. - The green cache bars (Timeline, Preview panel) count the frames of exactly what the viewer shows — scale, 3D view / region of interest and options (`EffectcraftApp::shown_series`) — instead of any frame at that scale. - Playback loops compute the key's fixed part once (`EffectcraftApp::frame_series`). - Docs: architecture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
249cc145e3
commit
5648fdb1c2
@@ -137,7 +137,7 @@ fn gpu_worker_renders_effect_frames_and_the_disk_cache_survives_a_reload() {
|
||||
s.execute("prop.set", json!({"layer": "#1", "path": "effects/#1/blurriness", "value": 12})).unwrap();
|
||||
let opts = RenderOpts { backend: effectcraft_engine::render::Backend::Gpu, ..Default::default() };
|
||||
let t = effectcraft_engine::time::Tick::ZERO;
|
||||
let key = |comp: effectcraft_engine::project::ItemId| FrameKey { revision: s.revision, comp: comp.0, frame: 0, scale: 1000, view: 0 };
|
||||
let key = |comp: effectcraft_engine::project::ItemId| FrameKey { revision: s.revision, comp: comp.0, frame: 0, scale: 1000, view: 0, opts: 0 };
|
||||
let disk = Arc::new(Mutex::new(HashMap::new()));
|
||||
let worker = Arc::new(GpuWorker::new(&s, worker_gpu.clone(), disk.clone()));
|
||||
let mut frames = Frames::default();
|
||||
@@ -162,7 +162,7 @@ fn gpu_worker_renders_effect_frames_and_the_disk_cache_survives_a_reload() {
|
||||
let mut frames2 = Frames::default();
|
||||
frames2.set_remote(Some(worker2.clone()));
|
||||
assert!(frames2.remote_disk());
|
||||
let bar = frames2.disk_frames(&source(&s, None), s.revision, fx.0, 1000, 0, 30, &opts);
|
||||
let bar = frames2.disk_frames(&source(&s, None), &key(fx), 30, &opts);
|
||||
assert_eq!(bar, vec![0], "the blue cache bar shows the stored frame");
|
||||
frames2.request_urgent(&source(&s, Some(page_gpu)), key(fx), fx, t, opts);
|
||||
frames2.dispatch_remote();
|
||||
|
||||
Reference in New Issue
Block a user