WebGL application crash/infinite loop inside Batcher.break() due to missing index advancement and unresolved geometry boundaries
PixiJS version
8.20.1
Link to minimal reproduction
Steps to reproduce
- Implement a Custom Batcher extending or mimicking the v8 Batcher pipeline using the following break logic layout:
break(instructionSet) { const elements = this._elements; if (!elements[this.elementStart]) return; let batch = getBatchFromPool(); let textureBatch = batch.textures; textureBatch.clear(); // Missing pipeline injection & tracking index advancement }
Generate Render Objects: Create a display tree containing a large volume of sprites or graphics objects.
Force Frequent Batch Splits: Alternately change states between the objects (such as switching unique textures back and forth, or quickly toggling advanced blendModes) to trigger frequent execution calls to break(instructionSet).
Run under WebGL: Initialize and render the scene utilizing the WebGL renderer preference.
Observe Failure Mode: The application completely locks up, freezes the browser tab, or terminates with a memory leak / execution loop failure.
What is expected?
The batch renderer should safely split the drawing pipeline when a batch limit or state change is reached. It must finalize the current batch, add it to the instructionSet, advance the tracking pointer (this.elementStart = this.currentIndex;), and cleanly reset the pooled textures for the next chunk of elements. The scene should render smoothly under WebGL without performance degradation or crashes.
What is actually happening?
The application freezes, runs out of memory, or crashes the browser tab when frequent batch breaks occur under WebGL. Because the code initializes a new pooled batch and clears its textures (textureBatch.clear();) without advancing the internal iteration pointers (this.elementStart), PixiJS falls into an infinite loop. It repeatedly attempts to process the exact same start element, rapidly flooding the GPU pipeline or blowing past the browser's maximum execution stack.
System Info
PixiJS Version: 8.20.1
Render Pipeline API: WebGL
Operating System: macOS 26.5.2
Browser / Runtime: Chrome 151.0.7922.138
Any additional comments?
No response
Source: pixijs/pixijs