Skip to content

Restore NativeDraco free-function compatibility exports - #1875

Open
bkaradzic-microsoft wants to merge 1 commit into
BabylonJS:masterfrom
bkaradzic-microsoft:pr/native-draco-compatibility
Open

bkaradzic-microsoft wants to merge 1 commit into
BabylonJS:masterfrom
bkaradzic-microsoft:pr/native-draco-compatibility

Conversation

@bkaradzic-microsoft

Copy link
Copy Markdown
Member

Summary

  • restore _native.decodeDracoMesh and _native.encodeDracoMesh as compatibility entry points
  • retain the grouped _native.DracoCodec.Decode, Encode, and Version API
  • cover cross-export encode/decode round trips and identical malformed-input error propagation
  • update the NativeDraco API documentation

Compatibility scope

BabylonNative's unchanged stock runtime bundle is babylonjs 9.21.2. That bundle does not contain either native Draco feature probe. I also checked the published babylonjs and @babylonjs/core packages at 9.21.2 and at the current 9.26.0 release; neither contains _native.decodeDracoMesh or _native.encodeDracoMesh.

These exports therefore prepare NativeDraco for the Babylon.js native decoder/encoder interface without claiming that a released Babylon.js version currently selects this path. The signatures match that interface: synchronous decode returns { indices, attributes, totalVertices }, and synchronous encode returns { data: Int8Array, attributeIds }.

No dependency pin, lockfile, scene, reference, gate, or exclusion changed.

Validation

Configured and built with NativeDraco enabled:

cmake -S . -B build\win32 -G "Visual Studio 17 2022" -A x64 -DGRAPHICS_API=D3D11 -DBABYLON_NATIVE_PLUGIN_NATIVEXR=OFF -DBABYLON_NATIVE_PLUGIN_NATIVEDRACO=ON
npm run build  # Apps\UnitTests\JavaScript, before the native copy/build
cmake --build build\win32 --target UnitTests --config Release -- /m:2 /verbosity:minimal

Negative control on unchanged exports with the new regression tests:

UnitTests.exe --gtest_filter=JavaScript.All
63 passing, 10 pending, 2 failing

The failures explicitly reported the missing compatibility function and showed that its missing-function TypeError did not match the grouped decoder's native malformed-input error.

After the export change:

UnitTests.exe --gtest_filter=JavaScript.All
65 passing, 10 pending
[ PASSED ] JavaScript.All

This is API/unit coverage against stock pinned assets; no stock visual-test outcome is claimed because the released bundle does not probe these entry points.

Publish decodeDracoMesh and encodeDracoMesh alongside the grouped
DracoCodec API. Cover cross-export round trips and verify that malformed
input errors propagate identically through both entry point forms.

Document that the stock Babylon.js pin does not yet probe the native API.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 60c2ec68-6de1-445d-9fc9-b699db737eae
Copilot AI lite review requested due to automatic review settings September 11, 2026 20:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The reviewed changes are covered by passing regression tests and documentation updates.

Pull request overview

Restores NativeDraco free-function compatibility exports while retaining the grouped DracoCodec API.

Changes:

  • Adds decodeDracoMesh and encodeDracoMesh.
  • Adds cross-export round-trip and error-propagation tests.
  • Updates NativeDraco documentation and declarations.
File summaries
File Description
Plugins/NativeDraco/Source/NativeDraco.cpp Registers compatibility exports.
Plugins/NativeDraco/README.md Documents both API forms.
Plugins/NativeDraco/Include/Babylon/Plugins/NativeDraco.h Updates API comments.
Apps/UnitTests/JavaScript/src/tests.javaScript.all.ts Adds compatibility tests.
Apps/UnitTests/JavaScript/dist/tests.javaScript.all.js Updates compiled tests.
Review details
  • Files reviewed: 4/5 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No unresolved issues remain, and the exports, documentation, and regression coverage are included.

Review details
  • Files reviewed: 4/5 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

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