Repository navigation
Conversation
Co-authored-by: samme <435681+samme@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix performance issues in PhaserCE 2.7.X compared to 2.6.2
Skip redundant bindTexture in WebGLSpriteBatch.renderBatch when multi-texture batching is on
Oct 24, 2026
There was a problem hiding this comment.
🟡 Changes recommended
Filter passes leave the binding cache stale, so skipping the fallback bind can cause subsequent sprites to sample the wrong texture.
1 open issue
What changed in this PR
This PR targets the WebGL rendering overhead reported in #198 by removing one texture bind per batch in multi-texture mode. Performance gains remain unmeasured.
Changes:
- Skip the clean-texture bind in
renderBatch()when multi-texture batching is enabled. - Preserve the bind in single-texture mode and leave dirty-texture uploads unchanged.
| File | Description |
|---|---|
src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js |
Conditionally skips texture binding in multi-texture batches. |
Review effort: Balanced
| } | ||
| } | ||
| else | ||
| else if (!PIXI._enableMultiTextureToggle) |
This branch has not been deployed
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.

Phaser CE 2.7+ issues more GL calls per draw than 2.6.2, which hurts frame rate on older mobile devices, especially with many Text objects. Profiling in the issue shows 8 calls per draw in 2.8 vs. 2 in 2.6.2, including two
bindTexturecalls.This PR removes one of those two
bindTexturecalls. It does not remove the other, and it does not address the remaining extra calls per draw.WebGLSpriteBatch.renderBatch(src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js)gl.bindTextureon every draw.render()andrenderTilingSprite()have already bound each base texture to its unit and tracked it inPIXI.WebGLRenderer.textureArray, so the extra bind was redundant.PIXI._enableMultiTextureToggleis false, whererender()doesn't bind andrenderBatchstill has to.Review notes
elsebranch bound the texture to whichever unit was last active, not totexture.textureIndex, so it was not reliably correct in multi-texture mode.render()is unchanged.