Bump SPIRV-Cross to 866e5edcc3407997a3ed62f3edf492f91bcb2629 (Expose more functions #10)#1695
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the pinned BabylonJS/SPIRV-Cross dependency revision to pick up upstream changes that remove several SPIRV_CROSS_INVALID_CALL() stubs (notably in HLSL/MSL paths), allowing previously-stubbed opcodes to emit real shader code instead of crashing/producing invalid output.
Changes:
- Bump BabylonJS/SPIRV-Cross
GIT_TAGfrom0e16547...toe1d29b3...in the root FetchContent declaration.
Picks up BabylonJS/SPIRV-Cross#10 which removes the SPIRV_CROSS_WEBMIN stubs (SPIRV_CROSS_INVALID_CALL -> assert(false)) around OpFMod, OpLogicalOr, and other opcodes commonly emitted by Babylon.js shaders. Re-tested 46 previously-excluded validation_native.js tests on the bumped SPIRV-Cross. Net change: 0 -> 9 PASS, 1 -> 5 FAIL_PIXEL_DIFF, 45 -> 31 still failing with shader-compile errors. The bump revealed that several of the 31 remaining failures had distinct root causes that the SPIRV-Cross assert was masking: PrePassRenderer WebGL2 capability check, GPU-particle ARRAY_BUFFER bug, area-lights LTC asset load failures, and a different remaining stub site for OpenPBR. Follow-up issues are being filed to track those. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
These previously-excluded tests now pass cleanly on Win32 D3D11 Release (re-verified end-to-end with full process exit, runtimes 2.1-4.1s): idx 138 Color correction idx 241 Default pipeline idx 254 Default rendering pipeline idx 332 Baked Vertex Animation with Depth Of Field idx 333 Baked Vertex Animation with Volumetric Light Scattering Post Process idx 373 PBR Debug Modes idx 376 MeshDebugPluginMaterial idx 391 sphere-with-custom-shader-to-display-wireframe-using-glow-layer Each had `excludeFromAutomaticTesting: true` with reason "Test crashes or hangs on Babylon Native". The crash/hang was the SPIRV-Cross SPIRV_CROSS_INVALID_CALL() stub for OpFMod / OpLogicalOr; with this PR's bump removing those WEBMIN guards, the shaders compile and the tests render within the default 2.5% errorRatio tolerance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Picks up BabylonJS/SPIRV-Cross#11 which un-guards the final HLSL stubs that Babylon Native's shader compiler still tripped on after BabylonJS#10: - OpSNegate - OpVectorTimesMatrix (two sites) - OpVectorExtractDynamic - to_extract_constant_composite_expression() helper These were the only remaining SPIRV-Cross WEBMIN stubs reachable by Babylon Native's HLSL transpile path on D3D11. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…S#11 These previously-excluded tests now pass cleanly on Win32 D3D11 Release after the SPIRV-Cross bump in this PR un-guarded OpSNegate, OpVectorTimesMatrix, OpVectorExtractDynamic, and the to_extract_constant_composite_expression helper: idx 293 Prepass SSAO + sprites idx 296 Prepass SSAO + line edges renderer idx 299 Prepass SSAO + GUI idx 309 Prepass MBlur + Lens idx 321 Thin instances + dynamic buffer resize idx 322 Instances + render self motion blur idx 323 Thin instances + render self motion blur idx 558 OpenPBR Fuzz Weight vs Fuzz Roughness - Analytic Lights idx 559 OpenPBR Fuzz Weight vs Coat Weight with Normal Maps - Analytic Lights idx 574 OpenPBR Transmission Dispersion VS IOR - Analytic Lights Each had `excludeFromAutomaticTesting: true` with reason "Test crashes or hangs on Babylon Native". The crash/hang was the SPIRV-Cross `SPIRV_CROSS_INVALID_CALL()` stub for `OpSNegate` (idx 293/296/299/309/ 321/322/323) or for `OpVectorTimesMatrix` / OpenPBR analytic-lights codegen (idx 558/559/574); with the bump in this PR removing those WEBMIN guards, the shaders compile and the tests render within the default 2.5% errorRatio tolerance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Linux CI (Ubuntu_Clang_JSC / Ubuntu_GCC_JSC -- both OpenGL backend) was failing on idx 391 sphere-with-custom-shader-to-display-wireframe-using-glow-layer (pixel diff 90900). Re-tested all 18 tests re-enabled by this PR against the Windows OpenGL backend (configured via -DGRAPHICS_API=OpenGLWindowsDevOnly, ANGLE libs from Edge/Chrome) and found 4 OpenGL-only failures: idx 293 Prepass SSAO + sprites BGFX FATAL: shader compile error idx 296 Prepass SSAO + line edges BGFX FATAL: shader compile error idx 299 Prepass SSAO + GUI BGFX FATAL: shader compile error idx 391 sphere-with-custom-shader Pixel diff 90900 px The 3 SSAO tests trip a GLSL compile error `cannot convert from 'mediump float' to 'mediump int'` in the PrePassRenderer fragment shader path; unrelated to SPIRV-Cross. idx 391 diverges in the glow-layer + custom-shader interaction on OpenGL. Mark each with `"excludedGraphicsApis": ["OpenGL"]` plus a `reason` string so they continue to run on D3D11/D3D12/Metal/Vulkan/UWP (where they pass cleanly thanks to the SPIRV-Cross bump in this PR). Also fix a pre-existing OpenGLWindowsDevOnly build break: with /WX the ExternalTexture_Shared.h triggers C4702 (unreachable code) for the OpenGL impl whose GetInfo / Set bodies always throw. Added a targeted `/wd4702` only for `GRAPHICS_API == OpenGL` MSVC builds. No effect on D3D11/D3D12 builds or any non-MSVC build. Verified end-to-end on Windows ANGLE OpenGL: full automatic sweep `ran=149 passed=149 failed=0 missingRef=0 skipped=571` (exit 0). On D3D11 the 4 affected tests still validate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The test passes in isolation but produces ~6000-px diff (right at the 2.5% errorRatio threshold) when run after sibling Prepass-SSAO tests in the full automatic sweep on Win32 D3D11. CI failed deterministically at 6001 px on all 4 Win32 D3D11 jobs (D3D11 / D3D11_Sanitizers / JSI_D3D11 / V8_D3D11) post-bump. OpenGL also fails (BGFX FATAL 'mediump float' shader compile in PrePassRenderer). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0ce1c3a to
c41065e
Compare
bghgary
left a comment
There was a problem hiding this comment.
[Reviewed by Copilot on behalf of @bghgary]
LGTM.
Binary size measured locally (Win32 D3D11 Release x64, Chakra):
| Artifact | Master | #1695 | Δ bytes | Δ% |
|---|---|---|---|---|
| Playground.exe (final linked binary) | 3,645,440 | 3,663,360 | +17,920 | +0.49% |
| spirv-cross-hlsl.lib (static) | 7,249,176 | 7,368,506 | +119,330 | +1.65% |
| spirv-cross-core.lib | 7,836,406 | 7,836,422 | +16 | 0.00% |
| All other libs combined | — | — | ~+850 | timestamp noise |
| Total of all .exe/.dll/.lib | 109.38 MB | 109.52 MB | +0.14 MB | +0.13% |
The linker dead-strips HLSL emitters BN's shader catalog never calls, so only ~17 KB of the hlsl.lib's +119 KB lands in the exe. spirv-cross-msl.lib isn't built on Win32 — the upstream MSL changes cost zero here (will land on Apple platforms). Acceptable for the test-coverage gain.
Summary
Bumps
BabylonJS/SPIRV-Crossto866e5ed, the merge of BabylonJS/SPIRV-Cross#11 on top of BabylonJS/SPIRV-Cross#10 ("Expose more functions"). Together these remove#ifndef SPIRV_CROSS_WEBMINguards and theirSPIRV_CROSS_INVALID_CALL()(=assert(false)) stub bodies for the HLSL opcodes / helpers reachable from the BN test catalog:OpFMod,OpLogicalOr,OpLogicalAnd,OpFwidthFine,OpVectorTimesMatrix(×2 sites),OpVectorExtractDynamic,OpSNegate, plusto_extract_constant_composite_expression. Previously-stubbed opcodes now emit the actual HLSL instead of crashing or returning invalid shader code.Also re-enables 17
validation_native.jstests inApps/Playground/Scripts/config.jsonthat were previously excluded with"reason": "Test crashes or hangs on Babylon Native"and now pass on Win32 D3D11:idx 138, 241, 254, 293, 296, 309, 321, 322, 323, 332, 333, 373, 376, 391, 558, 559, 574.
Note on remaining failures unmasked by the bump
In Release builds
SPIRV_CROSS_INVALID_CALL()is a no-op, so SPIRV-Cross was silently emitting invalid shader code and the test pipeline appeared to hang waiting for a render. After this bump, the underlying JS-side errors are now visible. Several still-failing tests turn out to have causes unrelated to SPIRV-Cross:PrePassRenderer needs WebGL 2 supportbefore any shader compile —NativeEnginedoes not advertise the WebGL2 capability thatPrePassRendererrequires.GPU Particles - Animations) now fails withTypeError: Unable to get property 'ARRAY_BUFFER' of undefined— same root cause as the GPU-particleARRAY_BUFFERbug previously identified.GreasedLine,Area Lights Standard Material) fail to load LTC LUT textures:Error: Unknown error opening URL— UrlLib / asset resolution issue.Realtime IBL/Prefiltered IBLpaths) still hit shader-compile errors — likely additionalSPIRV_CROSS_INVALID_CALL()stub sites not yet reached by this bump.These will be tracked as separate follow-up work (renderer-side WebGL2 capability, GPU-particle gl-constants binding, UrlLib LTC asset path, and a further SPIRV-Cross pass once a
Debugbuild pinpoints the remaining stub sites).OpenGL backend coverage
A local
OpenGLWindowsDevOnlybuild (Windows + ANGLE, sameSTRINGIZE(GRAPHICS_API) == "OpenGL"as Linux native OpenGL) was used to validate the re-enabled tests against the OpenGL backend. Four entries diverge on OpenGL only and have been marked"excludedGraphicsApis": ["OpenGL"]with a documented reason:BGFX FATALmediump float→intshader-compile error in thePrePassRendererfragment shader (OpenGL/ANGLE GLSL only).sphere-with-custom-shader-to-display-wireframe-using-glow-layer(glow-layer + custom-shader divergence).idx 299 (
Prepass SSAO + GUI) is held out of the re-enable batch entirely (keptexcludeFromAutomaticTesting: true): it passes in isolation but produces a ~6000-px diff right at the 2.5 %errorRatiothreshold when run after sibling Prepass-SSAO tests in the full sweep — flaky on Win32 D3D11 in CI.Build hygiene fix
The pre-existing
OpenGLWindowsDevOnlybuild was broken under MSVC/WXbecauseExternalTexture_Shared.hlines 25/28 trip C4702 (unreachable code) — the OpenGL impl'sGetInfo/Set/Getalways throw, so the dispatch's no-throw fall-through is statically unreachable. Addedtarget_compile_options(ExternalTexture PRIVATE /wd4702)gated onGRAPHICS_API STREQUAL "OpenGL" AND MSVCinPlugins/ExternalTexture/CMakeLists.txt. No other build is affected. The right long-term fix is to make the throws conditional in the OpenGL impl.Verification
OpenGLWindowsDevOnly), and Linux native OpenGL all run the full sweep cleanly with the bump applied._deps/spirv-cross-srcmatches the merged866e5edbyte-for-byte.Notes
Plugins/ShaderCompiler/Source/ShaderCompilerDXBC.cpp(the one declared inCMakeLists.txt). The bgfx-bundled SPIRV-Cross under_deps/bgfx.cmake-src/3rdparty/spirv-cross/is unaffected.BabylonJS/SPIRV-Crossis now 2 commits ahead of the previous pin (PR Fix vertex buffer handling #10 + PR Fixes for skinning and morph targets #11).Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com