You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add multi-texture batching for WebGL renderer (#1376)
Allows up to 16 textures in a single draw call, eliminating GPU flushes
on texture changes. ~80% fewer draw calls on the platformer example,
1000 quads/flush on the sprite benchmark with 5000 objects.
- Generate multi-texture fragment shader dynamically with per-texture
sampler uniforms and if/else selection chain
- Static quad-multi.vert with aTextureId attribute
- push() accepts optional textureId parameter (6 floats when provided)
- uploadTexture/bindTexture2D accept flush parameter to skip flushing
- QuadBatcher falls back to single-texture when custom ShaderEffect active
- Track scissor state with _scissorActive instead of gl.isEnabled() query
- Add unit tests for push with textureId and fragment shader generation
- Add "Tap or Click to spawn" hint to benchmark example
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: packages/melonjs/CHANGELOG.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,11 @@
2
2
3
3
## [19.1.0] (melonJS 2) - _2026-04-15_
4
4
5
+
### Added
6
+
- WebGL: multi-texture batching — up to 16 textures (based on device capabilities) drawn in a single batch/draw call, eliminating GPU flushes on texture changes. Automatically falls back to single-texture mode when a custom `ShaderEffect` is active. ~80% fewer draw calls on the platformer example (14 vs ~70 flushes/frame), with an estimated 30-50% FPS improvement on low-end mobile devices.
7
+
5
8
### Changed
6
-
- WebGL: `failIfMajorPerformanceCaveat` default changed from `true` to `false` — allows WebGL context creation on machines with blocklisted GPU drivers or software renderers, matching PixiJS and Phaser behavior
9
+
- WebGL: `failIfMajorPerformanceCaveat` default changed from `true` to `false` — allows WebGL context creation on machines with blocklisted GPU drivers or software renderers.
7
10
8
11
### Fixed
9
12
- WebGL: `getSupportedCompressedTextureFormats()` no longer crashes when the GL context is unavailable — falls back to the base renderer's empty format list
0 commit comments