Skip to content

Cache/GPU: adjustment footprint ignores the effect stack; upload starvation is reported (#687) - #701

Open
vbasky wants to merge 2 commits into
storytold:mainfrom
vbasky:fix/687-adjustment-footprint-key
Open

vbasky wants to merge 2 commits into
storytold:mainfrom
vbasky:fix/687-adjustment-footprint-key

Conversation

@vbasky

@vbasky vbasky commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Two of the four things #687 lists, the two that are pure logic and verifiable headless. The GPU-residency and fresh-intermediate-allocation parts need a DX12/Vulkan/Metal device to measure, so they are left for that.

1. Adjustment-layer footprint re-keyed every frame (#687.3)
The footprint (the adjustment layer's source through its masks — where its effects show) is cached so the GPU uploads it once, but its key came from the same key_any as a processed layer, so the whole effects group, paint spans, the comp-camera read and the time-fold any time-dependent effect forces all entered it. Noise or Grain on a finishing adjustment changed that key every frame: the footprint re-rendered and a full-frame RGBA-f32 buffer (127 MB at 4K) re-uploaded each frame, even though the footprint's pixels never move.

key_any now takes an explicit EffectScope — All (processed layer), First(n) (a layer's input, unchanged) and a new Footprint that hashes none of the stack. Masks still re-key (their structure and evaluated values stay in, shutter stays keyed while masks exist); shape/text wiggle time, the effect-dependency walk and the comp-scene read behave exactly as before for the existing scopes. All and First(n) are byte-for-byte today's keys, so the existing hit/miss suites pass unchanged.

A render test drives a mask path across its keyframes with Noise enabled and asserts: identical keys at frames 1.5 and 3.5 (well past the animation), a different key where the mask actually moved, an effect-parameter edit that does not re-key, and that the cached buffer still equals the mask it should show. It fails on the old single-scope code.

2. Silent upload-cache eviction (#687.4)
Static layers over the fixed 1536 MB upload budget evicted live textures with no log line and every later frame paid a re-upload. Evictions of still-held buffers are now counted and the first is reported (gpu <name>: the <N> MB upload budget cannot hold this project's layers…), and GpuContext::set_upload_budget lets an embedder on a small-memory device size it instead of the hard-coded default.

…tack (storytold#687).

The footprint — the adjustment layer's own source through its masks — was keyed by the
same routine as a processed layer, so the whole effects group, per-paint spans, the
comp-camera read and the time fold any time-dependent effect forces all entered its key.
Noise or Grain on a finishing adjustment therefore changed the key on every frame: the
footprint re-rendered, and the GPU compositor re-uploaded a full-frame buffer (127 MB at
4K RGBA f32) each time even though none of those bytes move.

key_any now takes an explicit effect scope: All for the processed layer, First(n) for a
layer input, and a new Footprint that hashes none of it — masks still re-key through their
structure and their evaluated values, shutter stays keyed while masks exist, and the
dependencies walk and shape/text wiggle time fold behave as before. A render test moves a
mask past its keyframes with Noise enabled and asserts the key is stable across frames,
changes with the mask, ignores effect-parameter edits, and that the cached buffer matches
the mask it should show.
…get (storytold#687).

Static layers over the fixed 1536 MB upload budget evicted live layer textures with no
log line, and every later frame paid a full re-upload. Evictions of still-referenced
buffers are now counted and the first is reported by name with the budget in effect, and
GpuContext::set_upload_budget lets an embedder (or a small-memory device) choose a fitting
figure instead of the default.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant