Skip to content

Package Canvas text metrics test font - #1881

Merged
CedricGuillemet merged 3 commits into
BabylonJS:masterfrom
CedricGuillemet:cedricguillemet-unit-test-failure
Sep 17, 2026
Merged

CedricGuillemet merged 3 commits into
BabylonJS:masterfrom
CedricGuillemet:cedricguillemet-unit-test-failure

Conversation

@CedricGuillemet

Copy link
Copy Markdown
Collaborator

Summary

Fix CanvasTextMetrics failures in Babylon.js CI caused by a hardcoded build-machine font path.

  • Package droidsans.ttf and its license with UnitTests through CMake.
  • Load the font relative to the executable, with clear failure diagnostics.
  • Validate packaged assets in nightly.yml.

Metric assertions remain unchanged.

Validation

Windows x64/D3D11 build succeeded. All 38 unit tests passed, including both text-metrics tests from a relocated output folder. Incremental rebuild restores a deleted output font.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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 packaged asset flow and executable-relative loading are consistent with existing UnitTests behavior.

Pull request overview

Packages Droid Sans with UnitTests and loads it relative to the executable, eliminating hardcoded machine paths.

Changes:

  • Adds the font and license to CMake-packaged assets.
  • Updates text-metrics tests with executable-relative paths and diagnostics.
  • Validates packaged assets in nightly CI.
File summaries
File Description
Apps/UnitTests/CMakeLists.txt Packages font assets into the test output.
Apps/UnitTests/Source/Tests.Canvas.TextMetrics.cpp Loads the packaged font and reports failures.
Apps/UnitTests/Assets/droidsans.ttf Provides the test font fixture.
Apps/UnitTests/Assets/droidsans.LICENSE.txt Provides font licensing information.
nightly.yml Validates packaged assets after building.
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.

CedricGuillemet and others added 2 commits September 17, 2026 14:59
Include GoogleTest before App.h so the X11 Bool macro cannot collide with GoogleTest's Bool helper on Linux.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Archive and extract both nightly app directories before running their test suites, then publish the tested extracted directories with the existing artifact layout.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@CedricGuillemet
CedricGuillemet merged commit bb01e28 into BabylonJS:master Sep 17, 2026
35 checks passed
bkaradzic-microsoft added a commit that referenced this pull request Sep 18, 2026
## Summary

Update to bgfx API 161 through merged bgfx.cmake commit
`2e8efe6186d1bc311674153c8207c19774bc77a9`
(BabylonJS/bgfx.cmake#147), including the
synchronized upstream CMake scripts and the EGL/D3D12 fixes in
BabylonJS/bgfx#80.

- Bootstrap bgfx without a main window and let Graphics own explicit
swap-chain framebuffers. Resize and window replacement preserve the
graphics device and its resources.
- Import D3D11 caller-owned RTV/DSV resources while retaining their
lifetime and view properties; use the active back buffer for screenshots
and continuous capture.
- Coalesce capture requests into one readback and remove the obsolete
D3D12 extra-frame screenshot workaround.
- Migrate camera/XR native texture imports, attachment flags, and
baseline instancing support to the current API.
- Adapt dependency/install wiring to the synchronized scripts, preserve
disabled video support, and deploy the matched DXC runtime pair for
desktop x64 D3D12 consumers. Unsupported deployment targets warn rather
than receiving incompatible binaries.

## Local validation before opening this PR

| Configuration | Result |
| --- | --- |
| Windows x64 D3D11 / Chakra | UnitTests and Playground build; 40 tests
passed |
| Windows x64 D3D12 / Chakra | UnitTests and Playground build; 29
passed, eight existing skips |
| Linux OpenGL / JavaScriptCore / software Mesa | UnitTests and
Playground build; 32 passed, two existing skips |
| Android arm64-v8a / API 24 | NativeCamera and NativeXr compile
successfully |

Native Canvas pixel validation passes on both D3D11 and D3D12 (1/1
each). New regressions cover swap-chain resize/MSAA/depth modes, window
replacement, disable/re-enable, screenshot/capture coalescing and
normalization, D3D11 external-view imports, and D3D12 resource states.
The debug-layer regression executes and reports zero errors.

Apple SDKs and Android device execution were unavailable locally and
require CI/device coverage. Local D3D12 ModuleLoadTest reports an
unexpected `cryptsp.dll` module; that result is not counted as a pass or
hidden by changing its allowlist.

## Latest rebase and Vulkan fix

- Rebased onto `bb01e283d83da8c043000862c76d9315f76c7a67`, including the
merged Canvas font packaging fix (#1881). The original three patches
remain unchanged by the rebase.
- Fixed the separate Vulkan failure: X11 WSI was clamping requested
32x24 / 64x48 swap chains to the unchanged 640x480 window. Linux Vulkan
now resizes and synchronizes the X11 window before creating or updating
the explicit swap chain.
- Clang/RelWithDebInfo Vulkan build under WSL passed. All three failing
Device tests passed with lavapipe/Xvfb, with the requested swap-chain
dimensions confirmed in logs. Existing capability-based skips were
unchanged.
- Windows D3D11/Chakra build and 30/30 focused regressions passed. The
replacement Linux Vulkan CI job also passed.
- Replacement CI for `7248189a8b5f31cee975e7023b2eedf7da615900` is
green: [run
35237002633](https://github.com/BabylonJS/BabylonNative/actions/runs/35237002633)
completed successfully. All 35 checks passed, including
`Ubuntu_Clang_Vulkan / build`, with no failures or pending checks.

## Review follow-up

[Gary's
review](#1879 (review))
is addressed in `6d7a68a906198e43cc280ba289eb3c9d100d0f9d`:

- Removed `D3D11Format.h` and `ExternalBackBufferD3D11.h/.cpp` entirely
from the PR. The existing D3D11 device implementation owns the
back-buffer state and conversion code, with the shared query declared in
existing internal `DeviceQueries.h`. The original 105-entry table is
preserved verbatim.
- Window depth-only input now explicitly rejects read-only, array and
nonzero-mip views that `SwapChain::depth` cannot represent. Supported
default views and explicit color/depth framebuffer semantics remain
intact. The restriction is documented in the public API.
- Replaced the shader-specific DLL copier with imported DXC runtime
dependencies and standard `TARGET_RUNTIME_DLLS` deployment, including
ShaderTool and installation. Uses the actual SDK dxcompiler import
library and a runtime-only dxil dependency, not a placeholder import
library.

Validation: D3D11 RelWithDebInfo build and 27 Device/ExternalTexture
tests passed in two shuffled runs; the new read-only rejection
regression failed before the fix. D3D12 ShaderTool/ModuleLoadTest builds
and real ShaderTool compilation passed. Paired DLL hashes, transitive
deployment and generated installation entries were verified. CMake
runtime validation used 3.31; 3.21 dependency propagation was checked in
its implementation source. The previously documented local
ModuleLoadTest `cryptsp.dll` allowlist failure remains unchanged.

### Camera lifetime scope

`8bf2c2203cf6c3197d2249bcf6faea02a2141181` removed the broad Texture
shared-state/mutex rewrite and deferred-update API. Apple camera
conversion/import remains synchronous in the update call; no deferred
callback accesses the C++ wrapper.

`bd2a08fb962d6fd1e99fce740a34f48b4baab78f` addresses Gary's follow-up:
the Metal backend borrows the imported object, so retaining it only
until the first AfterRender was insufficient. Each import now supplies a
native-resource owner held by Graphics::Texture. Camera Close/output
replacement cannot release an object while the caller still owns its
wrapper. On disposal/recreation, only native ownership crosses
BeforeRender -> AfterRender, keeping the object alive until a full
render boundary processes the queued handle destruction. No mutex or
shared wrapper state is added.

The replacement lifecycle regression is enabled for D3D11 and Metal and
keeps the wrapper valid across multiple frames after releasing producer
ownership. It covers disposal, wrapper destruction and replacement both
before and from AfterRender. The old one-frame retention fails this
regression; the final D3D11 build and all 28 focused
Device/ExternalTexture tests pass twice. This models producer
Close/replacement with native resources, not physical camera execution.
Apple SDK/device validation is unavailable locally.

Current CI: [run
35292522780](https://github.com/BabylonJS/BabylonNative/actions/runs/35292522780)
for `bd2a08fb962d6fd1e99fce740a34f48b4baab78f` is pending and monitored.
The superseded run for `8bf2c220` was canceled; its Windows QuickJS
failure was all 314 snippets returning HTTP 403, while Windows Chakra
passed all 314 scenes on the same revision. No validation exclusions,
thresholds or retry rules were changed for that service failure.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 54aaa1e1-b4b3-46e7-9de4-5a56add4ac42
Copilot-Session: 48fa7ec8-0cf6-48a0-b836-10b7ace38c1a
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.

3 participants