remotion: Fix stacked WebGL effects#7759
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Reviewed changes — Fix for stacked WebGL effects producing blank canvas or flipped output when multiple effects of the same backend are chained. The PR corrects the setup-cache keying to be per-target-canvas and keeps flipSourceY enabled for same-backend ping-pong passes.
- Fix
setupCachekeying inrunEffectChain— ChangessetupCachefromWeakMap<EffectDefinition, unknown>to a nestedWeakMap<EffectDefinition, WeakMap<HTMLCanvasElement, unknown>>so repeated WebGL effects receive setup state for the correct ping-pong canvas instead of reusing state from the wrong one. - Keep
flipWebGLSourceY = trueacross same-backend WebGL passes — Previously set tofalseafter any WebGL pass, which was incorrect for ping-pong passes that feed the previous WebGL canvas directly back throughtexImage2D(not viaImageBitmap). - Add browser visual regression test — New
@vitest/browser-playwrighttest in@remotion/effectsrenders a blur→blur→noise chain and asserts against a reference screenshot. - Add
testeffectsvisualscript and turbo pipeline — Wires the new visual test into the monorepo's task runner.
Kimi K2 | 𝕏
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — A targeted fix for stacked WebGL effects that were blanking and flipping, plus a new browser visual regression test suite for the effects package.
- Fix
setupCachekeying per ping-pong canvas —ensureSetupnow uses a nestedWeakMap<Definition, WeakMap<Canvas, State>>so repeated WebGL effects (e.g.blur+blur) receive the correct GL program / framebuffer for each ping-pong target instead of sharing stale state and rendering blank. - Keep
flipWebGLSourceY = trueacross same-backend WebGL passes — same-backend ping-pong passes feed a DOM canvas back intotexImage2D, so every upload still needsUNPACK_FLIP_Y_WEBGL. The old code set it tofalseafter the first pass, conflatingImageBitmapbridges (already oriented) with canvas reuse (needs flip). - Export
createEffectChainStateandcleanupEffectChainStateviaInternals— enables the new@remotion/effectsvisual-test harness to imperatively run effect chains outside React. - Add
packages/effectsbrowser visual regression test — stacksblur+blur+noiseand asserts against a reference screenshot using@vitest/browser-playwright, matching the existingpackages/web-rendererscreenshot-test pattern. - Wire
testeffectsvisualinto root andturbo.json— consistent with other visual-test pipelines.
Kimi K2 | 𝕏
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.

Summary
Fixes #7724.
Testing
bun run testeffectsvisualbun run buildbun run formatting