Repository navigation
Conversation
Co-authored-by: samme <435681+samme@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Skipping the bind can leave sprites sampling filter output because filter passes overwrite texture bindings without updating the binding cache.
1 open issue
What changed in this PR
This PR aims to prevent multi-texture sprite batching from overwriting the wrong texture unit while preserving single-texture rendering behavior.
Changes:
- Skip the clean-texture bind in
renderBatch()when multi-texture batching is enabled. - Add a changelog entry describing the texture-binding fix.
| File | Description |
|---|---|
src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js |
Guard the texture bind in multi-texture mode. |
CHANGELOG.md |
Document the fix and its connection to issue #231. |
Review effort: Balanced
| } | ||
| } | ||
| else | ||
| else if (!PIXI._enableMultiTextureToggle) |
There was a problem hiding this comment.
Invalidated unit 0's cached texture binding after popFilter() binds the filter output. Commit: c05a0ad4e.
Co-authored-by: samme <435681+samme@users.noreply.github.com>
| } | ||
| } | ||
| else | ||
| else if (!PIXI._enableMultiTextureToggle) |
There was a problem hiding this comment.
Invalidated unit 0 and the texture’s assigned unit after Rope and Creature render their direct bindings. Commit: d9301bcd1.
Co-authored-by: samme <435681+samme@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
TileSprite uploads, RenderTexture allocation, and lazy shader initialization still leave incorrect texture bindings when the draw-time bind is skipped.
5 open issues
Update texture cache after Rope and Creature binds Invalidate texture cache after filter passes Flush queued sprites before TileSprite texture upload · New Synchronize texture cache when allocating RenderTexture backing textures · New Preserve queued texture bindings during lazy shader initialization · New
1 resolved since last review
Review effort: Balanced
| } | ||
| } | ||
| else | ||
| else if (!PIXI._enableMultiTextureToggle) |
| } | ||
| } | ||
| else | ||
| else if (!PIXI._enableMultiTextureToggle) |
| } | ||
| } | ||
| else | ||
| else if (!PIXI._enableMultiTextureToggle) |


With multi-texture batching enabled, a sprite could be drawn with the wrong texture. In the reported case, the full-canvas
game.debug.spriteappeared with another sprite's texture aftersetTexturePriority()was called. I haven't reproduced the stretching in a browser. The link to the debug sprite is inferred from the code and the comments on the issue.Cause
WebGLSpriteBatch#renderBatchalways ended withgl.bindTexture(TEXTURE_2D, texture._glTextures[gl.id]).render()has already bound each base texture to its own unit (textureIndex).PIXI.WebGLRenderer.textureArraywould not reflect the change.Change
WebGLSpriteBatch.js: skip that bind whenPIXI._enableMultiTextureToggleis set.updateTexture) is unchanged. It already activates the correct unit.CHANGELOG.md: added a bug-fix entry.The issue comments say this "appears fixed by #641". The redundant bind is still present in this branch, so I treated the bug as still open.