Skip to content

Combined native-engine GL fixes (re-enables 10 validation tests)#1752

Draft
bkaradzic-microsoft wants to merge 7 commits into
BabylonJS:masterfrom
bkaradzic-microsoft:native-combined-gl-fixes
Draft

Combined native-engine GL fixes (re-enables 10 validation tests)#1752
bkaradzic-microsoft wants to merge 7 commits into
BabylonJS:masterfrom
bkaradzic-microsoft:native-combined-gl-fixes

Conversation

@bkaradzic-microsoft

@bkaradzic-microsoft bkaradzic-microsoft commented Jun 11, 2026

Copy link
Copy Markdown
Member

Paired engine PR: BabylonJS/Babylon.js#18567

What

Integration branch combining the four native-engine fixes below (each also exists as its own focused
PR — those remain the review units). Opened so combined CI / testing can validate the cumulative
effect and the full set of validation tests they re-enable.

Fix BabylonNative PR Babylon.js PR
Honor depthCullingState.depthTest on the native engine #1747 BabylonJS/Babylon.js#18558
Load single-file .dds/.ktx/.ktx2 cubemaps + spherical harmonics #1748 BabylonJS/Babylon.js#18560
Cube render target support #1750 BabylonJS/Babylon.js#18561
NativeEngine::UpdateTextureData (+ engine.name "Native") #1751 BabylonJS/Babylon.js#18566

Validation tests re-enabled (10)

Built babylon.max.js from the paired Babylon.js branch and ran the Playground validation suite
(Win32 / D3D11). All 10 previously-excluded tests now pass pixel comparison:

Honor depthCullingState.depthTest (#1747)

  • [392] blur-cube-with-the-effect-renderer

Single-file .dds/.ktx/.ktx2 cubemap loading (#1748)

  • [141] NMEGLTF
  • [172] Anisotropic
  • [173] Clear Coat
  • [246] PBRMetallicRoughnessMaterial
  • [247] PBRSpecularGlossinessMaterial
  • [248] PBR

Cube render targets (#1750)

  • [284] Shadows with instances in left handed system
  • [285] Shadows with instances in right handed system

updateTextureData (#1751)

  • [336] Test updateTextureData

CI

The validation suite uses the published babylonjs npm, which does not yet contain the paired JS
changes, so the re-enabled tests stay red on CI until a babylonjs release with those changes ships
and the dependency is bumped here. Locally verified green against a babylon.max.js built from the
paired Babylon.js branch. Draft until then.

Note

Draft integration branch — the four individual PRs are the units to review/merge.

bkaradzic and others added 7 commits June 10, 2026 10:41
This EffectRenderer fullscreen-pass test rendered all-black on Native because the
native engine did not honor depth-test toggles made through
engine.depthCullingState.depthTest (used by EffectRenderer). Fixed upstream in the
native engine (BabylonJS/Babylon.js#18558); re-enable the test here.

Depends on a babylonjs dependency bump that includes the fix.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…armonics

loadCubeTexture now accepts a single self-contained cubemap container (all six
faces + mips), decoded via bimg::imageParse, and uploads sides 0-5 x mips.
ComputeCubeSphericalPolynomial derives the diffuse-IBL spherical harmonics from
the top-mip faces (port of CubeMapToSphericalPolynomialTools) and returns the
polynomial coefficients to JS. This is done natively because the WebGL upload and
cube-readback paths are unimplemented on native and .dds stores no SH.

Re-enables 6 prefiltered-environment PBR validation tests.

Pairs with BabylonJS/Babylon.js#18560 (native createCubeTexture dispatch for
single-URL containers). Depends on a babylonjs dependency bump including it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…nces tests)

Render-to-cubemap on the native engine so ReflectionProbe and point-light
cube shadow maps render instead of dereferencing the null WebGL context.

- InitializeTexture: optional isCube param -> Texture::CreateCube.
- CreateFrameBuffer: optional layer param so the color attachment targets a
  single cube face (bgfx::Attachment layer); the JS side creates one
  framebuffer per face and binds the matching one per face.

Re-enables the "Shadows with instances in left/right handed system" validation
tests that previously crashed/hung.

Requires the paired Babylon.js change (native cube render target JS overrides);
CI stays red until a babylonjs npm with that change is published and the dep
bumped here.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ureData)

updateTextureData previously threw "not implemented" on Native. Implement it so
sub-rectangle texture updates work.

- Add NativeEngine::UpdateTextureData: upload the requested sub-rectangle via
  bgfx::updateTexture2D (Texture::Update2D). Validates the JS-controlled rect
  against the mip extents, sizes the copy with bgfx::calcTextureSize (no bimg
  dependency, so it also works in no-image-loading builds), and mirrors the
  vertical flip the base texture upload applies so the sub-rect lines up on
  top-left-origin backends (e.g. D3D11).
- Re-enable the "Test updateTextureData" validation test.

Pairs with the Babylon.js change (engine.name = "Native" so name-gated WebGL
_gl access skips Native, plus the updateTextureData override). CI stays red
until a babylonjs npm with that change is published and the dependency bumped.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants