Repository navigation
Plug-in effects re-render at every frame time - #1996
storybored379 wants to merge 2 commits into
Conversation
Plug-in effects get the layer time in render, but the layer cache only put the time into its key for built-in effects listed as time-dependent, so a plug-in animating from `time` alone froze on its first frame. Treat every registered plug-in as time-dependent. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Hi @storybored379, thanks for this PR! Most of the conflict comes from the shared module layout (#2491), which moved or split files this PR touches:
When you rebase, please also make sure it fits the other recent changes:
CI ( |
FredApps
left a comment
There was a problem hiding this comment.
ReviewerA — source-read COMMENT (not an approval)
I read the head of the diff: plug-in effects get a new frame at every time (#1977). The layer cache treated them as time-independent, so a plug-in that animates from time alone, with no animated parameter, froze on the first frame it rendered; the cache key now includes the time for plug-in effects. That is a correct fix for a real defect, and the log entry explains the cause. The cost is that a plug-in effect is never served from the cache between frames, which is right for a time-dependent plug-in and wasteful for one that is not; a manifest flag for "depends on time" would let plug-ins opt out. A test with a plug-in that returns the time is the proof. The ROADMAP header and rows are hand-edited (the header dates differ from the entry date). I read the ROADMAP hunks and not the code. I have not run it, and no exact-head CI result exists for this head. Nothing was run.
I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.
Status: waiting_author.
|
Hi @storybored379, this fix is still needed on current main: |
|
Thanks, @storybored379. The regression test that fails on main is exactly the evidence this needed. We're going to hold this. How plugin effects tell the render cache that they change over time is part of a shared plugin system we're building for all the Craft apps, and it already covers this. I've moved this to draft for now. Sorry this waited so long. |
A plug-in effect gets the layer time in
render(docs/plugins.md: "Time is layer time in seconds"), but the layer cache only folds the time into its key for effects listed inTIME_DEPENDENTor namedec.sim.*. Plug-in ids can't be either, so a plug-in that animates fromtimealone, with static parameters, was rendered once and that frame was reused at every other time.is_time_dependentnow also returns true for a registered plug-in id (newplugin::is_plugin, which reads the plug-in registry and tolerates a poisoned lock). Nothing tells the renderer whether a plug-in readstime, so this takes the safe default the issue suggests; an opt-out manifest flag could come later if caching static plug-ins matters.docs/plugins.mdsays so next to the time contract, and ROADMAP.md has a progress-log line.Validation:
crates/host/tests/plugins.rs::time_dependent_plugins_render_each_frameregisters a Rust plug-in that fills the frame with a grey equal totimeand renders at 0 s, 0.5 s and 0 s again. It fails on main (9db7f3b) with the frame at 0.5 s reusing the 0 s frame, and passes with the fix; the other three plug-in tests (including the example WebAssembly plug-in) still pass.--all-targets --release -D warnings), layers, assets and WASM checks pass.cargo test --workspace --release(LTO off, 16 codegen units): 3,599 passed / 80 failed / 31 ignored. 79 failures are GPU tests (no usable GPU on this Linux box: "the GPU renders the frame") plus two FFmpeg oracle tests (AC-3 downmix gain, Radiance HDR fixture); 77 of them are the same set an earlier run on (older) main hit on this machine, and the other two are GPU tests too. The last one,tests_auto::auto_backend_moves_light_comps_to_the_cpu, is timing-based and passes when rerun alone on the loaded box. None of them registers a plug-in.Fixes #1977 (the first problem it describes; the fuel/instance-pool note is separate).
Found and fixed with Claude Code (AI-assisted).
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Documentation
Tests