Repository navigation
Enable SPZ and GUI Input validation tests via harness workarounds - #1959
Merged
bkaradzic-microsoft merged 2 commits intoOct 22, 2026
Merged
bkaradzic-microsoft merged 2 commits into
bkaradzic-microsoft merged 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The global-self workaround needs to remove test-added clipboard listeners so they do not retain disposed GUI objects across tests.
1 open issue
What changed in this PR
Enables three previously excluded validation tests through opt-in harness workarounds for browser features missing from Babylon Native.
Changes:
- Adds limited ES-module loading support for the two SPZ tests.
- Temporarily defines
selffor the GUI Input test. - Documents both workarounds and enables the affected tests.
| File | Description |
|---|---|
Documentation/AddingNewValidationTests.md |
Documents the new workarounds and their limits. |
Apps/Playground/Scripts/validation_native.js |
Implements and restores the per-test workarounds. |
Apps/Playground/Scripts/config.json |
Enables three tests with their required workarounds. |
Review effort: Balanced
bkaradzic-microsoft
requested review from
CedricGuillemet,
bghgary and
ryantrem
October 22, 2026 00:17
Babylon.js loads the SPZ decoder (and Manifold/recast) by handing inline ES module source such as `import createSpzModule from '<url>'; ...await ...` to Tools.LoadScript with useModule. Browsers run that as <script type="module">; Babylon Native's script hosts have no ES module loader, so upstream Tools._LoadScriptNative rejects it and the "Gaussian Splatting SPZ SH" and "SPZ v3 - Splat" tests cannot decode their splats. Rather than add a partial ES-module evaluator to Babylon.js core, keep the shim in the test harness, opt-in per test like the other workarounds. While installed it wraps Tools.LoadScript for module loads only: each default import is fetched, must end in a sole `export default name` (Emscripten EXPORT_ES6 output, as @adobe/spz ships), has import.meta.url bound to its URL, and is evaluated with Function; the remaining inline source runs as an async function with the imports as parameters. Any other module syntax is rejected instead of being misread. Non-module loads go to the original LoadScript, and the original is restored after each test. The gsplat-spz-sh.png and gsplat-spz-v3.png references are synced to the current Babylon.js ones; the old copies predate a Babylon.js splat rendering change, so SPZ v3 differs by 5.4% against them even when it renders exactly like Babylon.js (no pixel difference against the current reference). Both SPZ tests stay excluded on JavaScriptCore: on the Linux JSC CI job the SPZ decoder module never finishes loading and createScene times out after 600s, which pushed the job past its time limit. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 60c2ec68-6de1-445d-9fc9-b699db737eae
bkaradzic-microsoft
force-pushed
the
es-module-import-workaround
branch
from
October 22, 2026 00:19
fc7b076 to
d7e268e
Compare
Browsers and workers define the global `self`; Babylon Native does not. When an InputText takes focus, AdvancedDynamicTexture.registerClipboardEvents calls self.addEventListener, so "GUI Input Test" throws "ReferenceError: self is not defined" from the render loop and fails. Rather than carry a Babylon.js GUI change only for this test, add an opt-in harness workaround (tracked as a bug to fix properly later): while the test runs, `self` is defined as the polyfilled window, which already provides addEventListener/removeEventListener, and it is removed afterwards. Other tests keep the host's real globals. Verified with a babylon.gui.js that has the original self.addEventListener code: the test passes with the same pixel difference as with the Babylon.js fix, and the full 714-test sweep has no other self failures. The test is enabled, and guiInputTest.png is synced to the current Babylon.js reference. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 60c2ec68-6de1-445d-9fc9-b699db737eae
bkaradzic-microsoft
force-pushed
the
es-module-import-workaround
branch
from
October 22, 2026 00:52
d7e268e to
c5e9327
Compare
This was referenced Oct 23, 2026
Merged
Merged
Closed
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.

Enables three validation tests that were excluded only because of browser-only features Babylon Native doesn't have yet. Each is handled by an opt-in harness workaround in
validation_native.js(documented inAddingNewValidationTests.md). As with the existing workarounds, these mark Babylon Native bugs to be fixed properly later.es-module-import— "Gaussian Splatting SPZ SH", "SPZ v3 - Splat"Babylon.js loads the SPZ decoder by passing inline ES-module source (
import createSpzModule from '<url>'; ...) toTools.LoadScriptwithuseModule. Babylon Native has no ES module loader, so this fails. While installed, the workaround wrapsTools.LoadScriptfor module loads only:export default name; anything else is rejected.import.meta.urlis bound to the module's URL, and the module is evaluated withFunction.The original
LoadScriptis restored after each test.Both SPZ tests stay excluded on JavaScriptCore. On the Linux JSC CI jobs the SPZ decoder module never finishes loading, so createScene times out after 600 s and the job hits its time limit.
global-self— "GUI Input Test"Babylon Native doesn't define
self. When an InputText takes focus,AdvancedDynamicTexture.registerClipboardEventscallsself.addEventListenerand throws aReferenceError. For the duration of the test the workaround definesselfas the polyfilledwindow.Reference images
gsplat-spz-sh.png,gsplat-spz-v3.pngandguiInputTest.pngare synced to the current Babylon.js references. The old copies predate Babylon.js rendering changes. For example, SPZ v3 differs by 5.4% from the old reference but matches the current one exactly.Testing
Win32 D3D11 / V8 with the npm babylonjs 9.29.0 bundles: all 474 enabled tests pass, including the three newly enabled ones (SPZ SH 0.029%, SPZ v3 0%, GUI Input 2.1%).