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
@@ -215,14 +215,12 @@ pub fn preview(app: &mut EffectcraftApp, ui: &mut egui::Ui, rect: Rect) {
|
||||
}
|
||||
|
||||
// Cache bar over the preview range.
|
||||
if let Some(c) = app.session.active_comp_arc() {
|
||||
let cid = app.session.active_comp_id().map(|i| i.0).unwrap_or(0);
|
||||
let scale = app.viewer_shown.as_ref().map(|(_, k)| k.scale).unwrap_or(1000);
|
||||
if let (Some(c), Some(cid)) = (app.session.active_comp_arc(), app.session.active_comp_id()) {
|
||||
let pl = match app.playback.plan.filter(|_| app.playback.playing) {
|
||||
Some(pl) => pl,
|
||||
None => effectcraft_engine::preview::plan(&o, &c, app.session.time()),
|
||||
};
|
||||
let cached_set = app.frames.cached_frames(app.session.revision, cid, scale);
|
||||
let cached_set = app.frames.cached_frames(&app.shown_series(cid));
|
||||
let total = pl.frames().count();
|
||||
let cached = pl.frames().filter(|f| cached_set.binary_search(f).is_ok()).count();
|
||||
let bar = Rect::from_min_size(pos2(rect.min.x + 12.0, yy), vec2(rect.width() - 24.0, 6.0));
|
||||
|
||||
Reference in New Issue
Block a user