Fix sorted batching without indirect drawing#24708
Queued
issam3105 wants to merge 1 commit into
Queued
Conversation
alice-i-cecile
approved these changes
Jun 22, 2026
kfc35
approved these changes
Jun 22, 2026
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.
Objective
Fix incorrect sorted batching when indirect drawing is unavailable.
While testing some glTF files on the web, I noticed transparent meshes rendering with the wrong geometry or transforms: some objects appeared duplicated or at incorrect positions. The same scenes rendered correctly on native Windows.
Disabling automatic batching for
Transparent3davoided the issue by settingAUTOMATIC_BATCHINGtofalse, which pointed the investigation toward batching.After investigation, the issue came from the
NoIndirectDrawingpath used when indirect drawing is unavailable. Different meshes could still be grouped as if indirect multi-draw was supported.Solution
When
NoIndirectDrawingis active, sorted phase items with different meshes now start a new batch set instead of usingBreakBatch.Testing
The original glTF asset that exposed the issue is confidential, but I can share it privately with maintainers if needed.
I was able to reproduce the issue natively on Windows by adding
NoIndirectDrawing, which matches the path used on web when indirect drawing is unavailable. Press Space to test theNoIndirectDrawingpath.Enregistrement.de.l.ecran.2026-06-22.142624.mp4
Showcase
Before this change, transparent glTF meshes on web could render with duplicated geometry or wrong transforms when automatic batching was enabled.
Enregistrement.de.l.ecran.2026-06-22.120126.mp4
After this change, the same scenes render correctly:
Enregistrement.de.l.ecran.2026-06-22.144337.mp4