Skip to content

fix(EffectComposer): restore renderer.autoClear/toneMapping on unmount - #358

Merged
kvvasuu merged 1 commit into
masterfrom
fix/07-renderer-state-restoration
Jul 31, 2026
Merged

fix(EffectComposer): restore renderer.autoClear/toneMapping on unmount#358
kvvasuu merged 1 commit into
masterfrom
fix/07-renderer-state-restoration

Conversation

@kvvasuu

@kvvasuu kvvasuu commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

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.

@kvvasuu
kvvasuu requested a review from krispya July 31, 2026 20:40
@kvvasuu
kvvasuu force-pushed the fix/07-renderer-state-restoration branch from 2f020a6 to 17b260d Compare July 31, 2026 20:55
@kvvasuu
kvvasuu force-pushed the fix/07-renderer-state-restoration branch from 17b260d to 3b55a6e Compare July 31, 2026 21:07
@kvvasuu
kvvasuu force-pushed the fix/07-renderer-state-restoration branch from 3b55a6e to d5f8eca Compare July 31, 2026 21:08
Base automatically changed from fix/06-effects-smoke-tests to master July 31, 2026 21:10
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
kvvasuu force-pushed the fix/07-renderer-state-restoration branch from d5f8eca to 144687c Compare July 31, 2026 21:10
@kvvasuu
kvvasuu merged commit 14038bc into master Jul 31, 2026
1 check passed
@kvvasuu
kvvasuu deleted the fix/07-renderer-state-restoration branch July 31, 2026 21:18
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