fix(EffectComposer): restore renderer.autoClear/toneMapping on unmount - #358
Merged
Conversation
kvvasuu
force-pushed
the
fix/07-renderer-state-restoration
branch
from
July 31, 2026 20:55
2f020a6 to
17b260d
Compare
kvvasuu
force-pushed
the
fix/07-renderer-state-restoration
branch
from
July 31, 2026 21:07
17b260d to
3b55a6e
Compare
kvvasuu
force-pushed
the
fix/07-renderer-state-restoration
branch
from
July 31, 2026 21:08
3b55a6e to
d5f8eca
Compare
postprocessing forces these on mount and never restores them. Ref-counted per renderer so multiple composers sharing one don't stomp on each other, and skips restoring if something else changed the value since.
kvvasuu
force-pushed
the
fix/07-renderer-state-restoration
branch
from
July 31, 2026 21:10
d5f8eca to
144687c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
EffectComposer forces renderer.autoClear = false and renderer.toneMapping = NoToneMapping, but never restores either when it unmounts. Found this after entering AR mode in WebXR right after using EffectComposer elsewhere - the AR session's own rendering never cleared between frames, since autoClear was stuck false from the composer that had already unmounted.
Fix is a small ref-counted guard per (renderer, property), since multiple composers can share one renderer - a naive restore breaks if they unmount out of order. It also skips restoring if the value already changed since acquire, so it doesn't clobber a manual override made while a composer was still mounted.
Test plan: 6 new tests covering single-composer restore, multi-composer ordering, and the manual-override case for both properties. 69/69 passing.