Fix instancing data layout for all graphics backends.#1656
Merged
bkaradzic-microsoft merged 1 commit intoBabylonJS:masterfrom Apr 13, 2026
Merged
Fix instancing data layout for all graphics backends.#1656bkaradzic-microsoft merged 1 commit intoBabylonJS:masterfrom
bkaradzic-microsoft merged 1 commit intoBabylonJS:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to fix per-instance vertex data packing and shader attribute naming so instancing maps consistently across all bgfx backends (notably OpenGL/Metal), and then re-enable previously excluded tests that depended on correct instancing.
Changes:
- VertexBuffer: always packs instance data in reverse attribute order (previously conditional on D3D11/D3D12).
- ShaderCompilerTraversers: OpenGL traverser now assigns
i_data*instance attribute names in reverse order (matching Metal); addssplatIndex0-3to instance attribute detection. - Playground config: re-enables previously excluded graphics API runs for some tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Plugins/ShaderCompiler/Source/ShaderCompilerTraversers.cpp | Updates OpenGL instance attribute naming order and expands instance attribute detection for Gaussian Splatting. |
| Plugins/NativeEngine/Source/VertexBuffer.cpp | Makes instance data packing reverse-order for all backends to match bgfx’s abstracted mapping. |
| Apps/Playground/Scripts/config.json | Removes OpenGL/Metal exclusions to re-enable rendering tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
779a4e0 to
a666bd4
Compare
bghgary
approved these changes
Apr 13, 2026
Contributor
bghgary
left a comment
There was a problem hiding this comment.
LGTM as long as the tests pass
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.
VertexBuffer: Always pack instance data in reverse attribute order. bgfx maps i_data0 to the highest semantic (TEXCOORD7) in all backends, so reverse iteration is correct universally, not just D3D11/D3D12.
ShaderCompilerTraversers: Fix OpenGL traverser to assign i_data names in reverse order (--m_instanceAttributeCount), matching the Metal traverser. Previously it used forward order (m_instanceAttributeIndex++) which produced wrong attribute-to-slot mapping when combined with reverse instance buffer packing.
ShaderCompilerTraversers: Add splatIndex0-3 to IsInstance() so Gaussian Splatting attributes are recognized as instance data on OpenGL and Metal.
config.json: Re-enable Gaussian Splatting tests on OpenGL and Metal now that instancing is fixed for those backends.