Skip to content

Fix nested Container picking up a sibling's blend mode - #7407

Merged
photonstorm merged 1 commit into
phaserjs:masterfrom
vtxe02023274:fix/container-skip-check-blend
Dec 1, 2026
Merged

photonstorm merged 1 commit into
phaserjs:masterfrom
vtxe02023274:fix/container-skip-check-blend

Conversation

@vtxe02023274

Copy link
Copy Markdown
Contributor

Please do not update the README or Change Log, we will do this when we merge your PR.

This PR (delete as applicable)

  • Fixes a bug

Describe the changes below:

Fixes #7387.

This is #7201 coming back. 6f5c7a1 fixed it with an else that went back to baseContext for every child that didn't need a new context. c95e399 removed that else because it also reset a second sibling with the same blend mode, but that left SKIP_CHECK children with nothing to reset them. So a nested Container after an ADD sibling gets the ADD context, and when it has a mask or other filter its result is composited with ADD.

Now a SKIP_CHECK child goes back to baseContext, and a child with its own blend mode still only clones when the mode changes, so consecutive siblings with the same mode keep it.

Tested in Chromium with the repro from the issue using generated textures: a blue square inside the masked inner container over a grey background.

4.2.1   (128, 128, 255)   grey added to blue
patched (0, 0, 255)

In the same scene, two ADD siblings in a row and an ADD sibling after the inner container render the same before and after.

Added two tests to ContainerWebGLRenderer.test.js: one for the SKIP_CHECK child after a blended sibling, which fails before this change, and one for consecutive siblings with the same blend mode. tests/gameobjects/container and tests/gameobjects/layer pass.

LayerWebGLRenderer has the same condition but clones from currentContext, so I left it out of this PR.

@photonstorm
photonstorm merged commit 9b6bd1e into phaserjs:master Dec 1, 2026
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.

v4.2.1 Mask and Blend Mode interaction bleeding into other Container children

2 participants