Updated bgfx.#1723
Open
bkaradzic-microsoft wants to merge 8 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the pinned bgfx.cmake dependency used by Babylon Native’s graphics stack.
Changes:
- Bumps the BabylonJS
bgfx.cmakefork from commite5f3f31c...toaf75c874.... - Leaves the existing FetchContent configuration and downstream bgfx integration unchanged.
The recent bgfx/bx update removed bx::uint32_cnttz and bx::uint32_min (uint32_t.h is gone from bx). Switch to the templated replacements bx::countTrailingZeros and bx::min from <bx/math.h> / <bx/bx.h> to fix the Canvas polyfill compilation across all CI targets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The new bx (post 7dc65d7) assumes SSE4.2 minspec on x86_64 and uses
intrinsics like _mm_round_ps / _mm_blendv_ps in bx/inline/simd128_sse.inl.
bgfx.cmake does not propagate -msse4.2, so bimg fails to build on Linux
with both GCC ('inlining failed in call to always_inline _mm_round_ps:
target specific option mismatch') and Clang ('needs target feature sse4.1').
MSVC enables SSE4.x for x64 by default, and Apple Silicon / Android arm
are unaffected.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Win32_x64_D3D11_Sanitizers CI job has been hanging for the full
60-min budget on the "EXR Loader" validation test after the bgfx pin
bump to da73add9 (bx 7dc65d7), with the last visible line being a
`BX_TRACE("Texture 2: RGBA32F 3240x4800")` and no further output.
Renderer-side bgfx changes (renderer_d3d11.cpp diff
7e4749e6..da73add9) are benign for that codepath: 48 of 58 changed
lines are mechanical bx::uint32_* -> typed bx::min/max/satSub/
countTrailingZeros renames, the only semantic changes are a
per-frame VSync block (commit a8250ce) and the MSAA+mipmaps
needResolve fix (commit 7d03e16, doesn't apply to sampled RGBA32F).
What is new and observable in this window: bx commit eed706f
"Suppress MSVC CRT assert dialogs" added, inside
bx::installExceptionHandler():
- SetUnhandledExceptionFilter(topLevelExceptionFilter)
- SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX)
- _set_invalid_parameter_handler (BN overrides)
- _set_thread_local_invalid_parameter_handler (BN does NOT override)
- _set_purecall_handler (BN does NOT override)
- _CrtSetReportHook (BN overrides)
The thread-local invalid_parameter, pure-call and top-level SEH
filters all go through bx::assertFunction -> bx::defaultAssertHandler,
which walks the callstack via dbghelp. Under ASAN, the sanitizer
runtime already installs its own SEH / invalid-parameter / abort
handlers and provides its own crash diagnostics; layering bx's
dbghelp-walking handlers on top can deadlock against ASAN's
allocator lock if a sanitizer-instrumented allocation races with
handler entry.
Skip bx::installExceptionHandler when built with ASAN; BN's own
_set_invalid_parameter_handler / SIGABRT / CRT report hooks cover
the diagnostics paths we actually rely on.
Verified locally (Win11, RelWithDebInfo+ASAN, NVIDIA): EXR Loader
runs --headless --once in 55s and validates the rendered image
against the reference.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bghgary
approved these changes
May 29, 2026
The Win32_x64_D3D11_Sanitizers CI job has been hanging through the full 60-min budget on the "EXR Loader" validation test after the bgfx pin bump. Local Win11 / NVIDIA / WARP runs cannot reproduce it; the previous "skip bx::installExceptionHandler under ASAN" fix alone was not enough either, so the dominant cost is on the CI side (display-less Azure VM + ASAN + bgfx new bx). Two complementary app-side defaults to fit the validation step back into the 60-min budget without modifying the CI workflow (so this change does not require workflow scope to push): * CommandLine::Parse: default PlaygroundOptions::Headless = true under __SANITIZE_ADDRESS__. On the display-less GH runner the visible-window message pump pessimises every native call under ASAN; headless skips the window entirely and routes all bgfx trace / console output to stdout (which also makes per-test progress visible in the CI log). * Diagnostics.cpp: export __asan_default_options() with abort_on_error=1:detect_leaks=0:malloc_context_size=5: quarantine_size_mb=64. MSVC ASAN reads this exported symbol at runtime init (before main) so we don't depend on the CI workflow to set ASAN_OPTIONS in the env. detect_leaks=0 disables Windows-ASAN's leak detector (known buggy on x64), malloc_context_size=5 trims per-allocation stack capture from the 30-frame default, quarantine_size_mb=64 caps the freed-allocation quarantine; abort_on_error=1 matches Linux/ macOS sanitizer jobs. Verified locally (Win11, RelWithDebInfo+ASAN, no env vars set, no --headless arg): EXR Loader runs --once in 58s with bgfx trace appearing on stdout (proving headless default kicked in) and validates against the reference image. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Win32_x64_D3D11_Sanitizers / build was repeatedly hitting the 60-min job timeout after "Running EXR Loader" with no further output for 53+ minutes (see PR 1723 / run 26610768953). Locally the same test runs in ~57s with same flags, so we can't bisect without telemetry from the CI runner itself. Add an opt-in heartbeat thread in Apps/Playground/Shared/Diagnostics.cpp that prints "[hb] T=Ns WS=Mb" every N seconds. Triggered by: - BN_HEARTBEAT_SECONDS=<n> env var (any build), or - Always on, every 10s, under __SANITIZE_ADDRESS__ This lets us tell a true deadlock (heartbeat stops) from an ASAN+WARP+bimg slowdown (heartbeat keeps ticking, working set grows) in the next sanitizer CI run without further code pushes. The thread is joined inside PrintFinishLine() so it cleanly stops on every exit path (atexit / quick_exit / explicit calls). On non-MSVC the working-set value is omitted.
This reverts commit ee563f1.
Temporary bisection pin while diagnosing the Win32_x64_D3D11_Sanitizers EXR Loader hang. This is the first clean bgfx pin after master (waypoint A 98531b5 has unresolved git merge conflict markers in src/renderer_d3d11.cpp from bgfx commit 056846eb, fixed by 4d5276c7e which is included in 5a00e8d). Will be restored to af75c874 once the bad commit is identified. 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.
No description provided.