Rework NativeTracing to be built on top of the PerfTrace helper from JsRuntime's Foundation lib#1569
Merged
ryantrem merged 4 commits intoNov 15, 2025
Conversation
ryantrem
commented
Nov 14, 2025
ryantrem
commented
Nov 14, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR reworks the NativeTracing plugin to use the new PerfTrace helper from JsRuntime's Foundation library instead of the direct arcana trace_region implementation. The changes also add NativeTracing initialization to the iOS app and include a commented-out line for enabling tracing via the Babylon.js API.
Key changes:
- Refactored NativeTracing implementation to use PerfTrace API with handle-based tracing
- Updated dependencies in CMakeLists files to point to forked repositories with new PerfTrace support
- Integrated NativeTracing into the iOS app's initialization flow
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| Plugins/NativeTracing/Source/NativeTracing.cpp | Refactored to use Babylon::PerfTrace API instead of arcana::trace_region |
| Plugins/NativeTracing/CMakeLists.txt | Added Foundation library dependency |
| CMakeLists.txt | Updated arcana.cpp and JsRuntimeHost dependency URLs and commit tags to forked versions |
| Apps/Playground/iOS/LibNativeBridge.mm | Added NativeTracing::Initialize call in iOS app initialization |
| Apps/Playground/Scripts/experience.js | Added commented-out line to enable performance tracing through Babylon.js API |
| Apps/Playground/CMakeLists.txt | Added NativeTracing to Playground target link libraries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bghgary
requested changes
Nov 14, 2025
Update to merged commits
deltakosh
pushed a commit
to BabylonJS/Babylon.js
that referenced
this pull request
Nov 17, 2025
…ools.EndPerformanceCounter to Babylon Native counterparts (#17450) NativeTracing has been partially implemented in Babylon Native for a long time. These changes hook up the Babylon.js perf tracing related APIs in Tools to the Babylon Native tracing APIs. This extra functionality will only execute in the context of Babylon Native, and is resilient to older versions of Babylon Native. For these changes to fully work, they need BabylonJS/BabylonNative#1569. Couple additional changes related to our native interfaces: - I did a little bit of cleanup on the `INative` interface to make it more type safe - ~I added a declation for the `_native` global in `INativeInterfaces.ts`, which makes it visible globally everywhere so it doesn't have to be redeclared in every file it is used in. However, I declared it as potentially undefined (since it is), so I didn't touch a few files that already declared it as non nullable (like NativeEngine) as there would be a ton of changes and I didn't want this PR to get too overloaded.~ Never mind, not in the mood to battle the custom umd type declaration generation script today.
bkaradzic-microsoft
pushed a commit
to bkaradzic-microsoft/BabylonNative
that referenced
this pull request
May 8, 2026
…stride fix. After the bgfx instance-data stride fix in this branch, 36 of the 58 previously-affected particle/instance tests now pass and are re-enabled so CI can verify the fix. The remaining 22 tests no longer crash but still fail pixel-diff for reasons unrelated to stride alignment (likely shader-side packing of vec3+float into shared vec4 instance slots); their exclusion reason is updated to reflect the post-fix state and to flag the follow-up work. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bkaradzic-microsoft
pushed a commit
to bkaradzic-microsoft/BabylonNative
that referenced
this pull request
May 8, 2026
bgfx exposes instance data as a sequence of float4 registers (TEXCOORD7..0), and the D3D11 input layout binds each one at a hard-coded offset of slotIdx*16, so stride must be a multiple of 16 and each attribute must be 16-byte-padded. The previous code summed ElementSize directly, which both tripped bgfx's 'Stride must be multiple of 16' assert and placed sub-vec4 attributes at the wrong offsets within their slots. Now each instance attribute occupies one 16-byte slot, the buffer is zeroed first, and we early-return on empty/zero instance counts. Lifts 36 of the 58 affected particle/instance tests from crash to pass; the remaining 22 still render but fail pixel-diff for unrelated reasons. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bkaradzic-microsoft
pushed a commit
to bkaradzic-microsoft/BabylonNative
that referenced
this pull request
May 8, 2026
…stride fix. After the bgfx instance-data stride fix in this branch, 36 of the 58 previously-affected particle/instance tests now pass and are re-enabled so CI can verify the fix. The remaining 22 tests no longer crash but still fail pixel-diff for reasons unrelated to stride alignment (likely shader-side packing of vec3+float into shared vec4 instance slots); their exclusion reason is updated to reflect the post-fix state and to flag the follow-up work. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
This PR depends on BabylonJS/JsRuntimeHost#125