Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
js-engine:
required: true
type: string
nativedawn:
required: false
type: boolean
default: false

env:
NDK_VERSION: '28.2.13676358'
Expand Down Expand Up @@ -40,6 +44,7 @@ jobs:
fi

- name: Build Playground ${{ inputs.js-engine }}
if: ${{ !inputs.nativedawn }}
working-directory: Apps/Playground/Android
run: |
chmod +x gradlew
Expand All @@ -48,3 +53,20 @@ jobs:
-PARM64Only \
-PNDK_VERSION=${{ env.NDK_VERSION }} \
-PSANITIZERS=OFF

# NativeDawn (WebGPU/Dawn, Vulkan backend) build: enabling the plugin
# force-disables NativeEngine. The Android app native lib has no Dawn code
# path, so build only the NativeDawn plugin target (via the -PNativeDawn
# gradle property, which also restricts the CMake `targets`) to validate it
# compiles/links; the full APK is not assembled.
- name: Build NativeDawn ${{ inputs.js-engine }}
if: ${{ inputs.nativedawn }}
working-directory: Apps/Playground/Android
run: |
chmod +x gradlew
./gradlew :BabylonNative:externalNativeBuildRelease \
-PJSEngine=${{ inputs.js-engine }} \
-PARM64Only \
-PNDK_VERSION=${{ env.NDK_VERSION }} \
-PSANITIZERS=OFF \
-PNativeDawn=ON
30 changes: 30 additions & 0 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ on:
required: false
type: string
default: macos-latest
nativedawn:
required: false
type: boolean
default: false

# Absorb transient npm registry / CDN flakes during `npm install` in Apps/CMakeLists.txt.
# npm's default fetch-retries is 2; bump to 5 (npm's own exponential backoff handles spacing).
Expand All @@ -32,6 +36,7 @@ jobs:
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer

- name: Generate iOS solution
if: ${{ !inputs.nativedawn }}
run: |
cmake -G Xcode -B build/iOS \
-D IOS=ON \
Expand All @@ -40,10 +45,35 @@ jobs:
-D CMAKE_IOS_INSTALL_COMBINED=NO

- name: Build Playground iOS
if: ${{ !inputs.nativedawn }}
run: |
xcodebuild \
-project build/iOS/BabylonNative.xcodeproj \
-scheme Playground \
-sdk iphoneos \
-configuration Release \
CODE_SIGNING_ALLOWED=NO

# NativeDawn (WebGPU/Dawn, Metal backend) build: enabling the plugin
# force-disables NativeEngine. The iOS Playground host has no Dawn code
# path, so build the NativeDawn plugin target (plugin + Dawn) to validate it
# compiles/links.
- name: Generate iOS solution (NativeDawn)
if: ${{ inputs.nativedawn }}
run: |
cmake -G Xcode -B build/iOS \
-D IOS=ON \
-D DEPLOYMENT_TARGET=${{ inputs.deployment-target }} \
-D BABYLON_DEBUG_TRACE=ON \
-D CMAKE_IOS_INSTALL_COMBINED=NO \
-D BABYLON_NATIVE_PLUGIN_NATIVEDAWN=ON

- name: Build NativeDawn iOS
if: ${{ inputs.nativedawn }}
run: |
xcodebuild \
-project build/iOS/BabylonNative.xcodeproj \
-scheme NativeDawn \
-sdk iphoneos \
-configuration Release \
CODE_SIGNING_ALLOWED=NO
33 changes: 31 additions & 2 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
required: false
type: boolean
default: false
nativedawn:
required: false
type: boolean
default: false

env:
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1:symbolize=1
Expand All @@ -40,7 +44,12 @@ jobs:
sudo apt-get update
sudo apt-get install -y libjavascriptcoregtk-4.1-dev libgl1-mesa-dev libcurl4-openssl-dev libwayland-dev clang ninja-build

- name: Install Vulkan packages (NativeDawn)
if: ${{ inputs.nativedawn }}
run: sudo apt-get install -y libvulkan-dev libx11-xcb-dev

- name: Build X11
if: ${{ !inputs.nativedawn }}
run: |
cmake -G Ninja -B build/Linux \
-D JAVASCRIPTCORE_LIBRARY=/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-4.1.so \
Expand All @@ -53,30 +62,50 @@ jobs:
-D ENABLE_SANITIZERS=${{ inputs.enable-sanitizers && 'ON' || 'OFF' }} .
ninja -C build/Linux

# NativeDawn (WebGPU/Dawn, Vulkan backend) build: enabling the plugin
# force-disables NativeEngine. The Linux Playground host has no Dawn code
# path, so build the NativeDawn plugin target (plugin + Dawn) to validate it
# compiles/links; the bgfx validation/unit tests don't apply.
- name: Build NativeDawn
if: ${{ inputs.nativedawn }}
run: |
cmake -G Ninja -B build/Linux \
-D JAVASCRIPTCORE_LIBRARY=/usr/lib/x86_64-linux-gnu/libjavascriptcoregtk-4.1.so \
-D NAPI_JAVASCRIPT_ENGINE=${{ inputs.js-engine }} \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D BX_CONFIG_DEBUG=ON \
-D OpenGL_GL_PREFERENCE=GLVND \
-D BABYLON_DEBUG_TRACE=ON \
-D BABYLON_NATIVE_PLUGIN_NATIVEDAWN=ON .
ninja -C build/Linux NativeDawn

- name: Enable Core Dump
if: ${{ !inputs.nativedawn }}
run: sudo sysctl -w kernel.core_pattern=core.%p

- name: Validation Tests
if: ${{ !inputs.nativedawn }}
run: |
cd build/Linux/Apps/Playground
ulimit -c unlimited
xvfb-run ./Playground app:///Scripts/validation_native.js

- name: Unit Tests
if: ${{ !inputs.nativedawn }}
run: |
cd build/Linux/Apps/UnitTests
ulimit -c unlimited
xvfb-run ./UnitTests

- name: Module Load Test
if: ${{ !inputs.enable-sanitizers }}
if: ${{ !inputs.enable-sanitizers && !inputs.nativedawn }}
run: |
cd build/Linux/Apps/ModuleLoadTest
ulimit -c unlimited
xvfb-run ./ModuleLoadTest

- name: Upload Rendered Pictures
if: always()
if: ${{ always() && !inputs.nativedawn }}
uses: actions/upload-artifact@v6
with:
name: ${{ inputs.cc }}-${{ inputs.js-engine }}${{ inputs.enable-sanitizers && '-sanitizer' || '' }}-rendered-pictures
Expand Down
24 changes: 23 additions & 1 deletion .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ on:
required: false
type: string
default: ''
nativedawn:
required: false
type: boolean
default: false

env:
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1:symbolize=1
Expand All @@ -43,6 +47,7 @@ jobs:
run: sudo xcode-select --switch /Applications/Xcode_${{ inputs.xcode-version }}.app/Contents/Developer

- name: Generate macOS solution
if: ${{ !inputs.nativedawn }}
run: |
cmake -G "${{ inputs.generator }}" -B build/macOS \
${{ inputs.js-engine != '' && format('-D NAPI_JAVASCRIPT_ENGINE={0}', inputs.js-engine) || '' }} \
Expand All @@ -51,25 +56,42 @@ jobs:
-D BABYLON_NATIVE_TESTS_USE_NOOP_METAL_DEVICE=ON

- name: Build Playground macOS
if: ${{ !inputs.nativedawn }}
run: cmake --build build/macOS --target Playground --config RelWithDebInfo

- name: Build UnitTests macOS
if: ${{ !inputs.nativedawn }}
run: cmake --build build/macOS --target UnitTests --config RelWithDebInfo

- name: Build ModuleLoadTest macOS
if: ${{ !inputs.nativedawn }}
run: cmake --build build/macOS --target ModuleLoadTest --config RelWithDebInfo

# NativeDawn (WebGPU/Dawn, Metal backend) build: enabling the plugin
# force-disables NativeEngine. The macOS Playground host has no Dawn code
# path, so build the NativeDawn plugin target (plugin + Dawn) to validate it
# compiles/links; the bgfx unit tests don't apply.
- name: Build NativeDawn macOS
if: ${{ inputs.nativedawn }}
run: |
cmake -G "${{ inputs.generator }}" -B build/macOS \
-D BABYLON_DEBUG_TRACE=ON \
-D BABYLON_NATIVE_PLUGIN_NATIVEDAWN=ON
cmake --build build/macOS --target NativeDawn --config RelWithDebInfo

- name: Enable Core Dump
if: ${{ !inputs.nativedawn }}
run: sudo sysctl -w kern.corefile=%N.core.%P

- name: Run UnitTests macOS
if: ${{ !inputs.nativedawn }}
run: |
cd build/macOS/Apps/UnitTests/RelWithDebInfo
ulimit -c unlimited
./UnitTests

- name: Run ModuleLoadTest macOS
if: ${{ !inputs.enable-sanitizers }}
if: ${{ !inputs.enable-sanitizers && !inputs.nativedawn }}
run: |
cd build/macOS/Apps/ModuleLoadTest/RelWithDebInfo
ulimit -c unlimited
Expand Down
53 changes: 48 additions & 5 deletions .github/workflows/build-win32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ on:
required: false
type: boolean
default: false
nativedawn:
required: false
type: boolean
default: false

# Absorb transient npm registry / CDN flakes during `npm install` in Apps/CMakeLists.txt.
# npm's default fetch-retries is 2; bump to 5 (npm's own exponential backoff handles spacing).
Expand Down Expand Up @@ -55,6 +59,16 @@ jobs:
echo "js_define=$JS_DEFINE" >> "$GITHUB_OUTPUT"
echo "solution_name=Win32_${{ inputs.platform }}${SUFFIX}" >> "$GITHUB_OUTPUT"
echo "sanitizer_flag=${{ inputs.enable-sanitizers && 'ON' || 'OFF' }}" >> "$GITHUB_OUTPUT"
# NativeDawn (WebGPU/Dawn) build: enable the plugin (which force-disables
# NativeEngine) and build only the Playground target, since the
# bgfx-based validation/unit/module tests don't apply to this backend.
if [ "${{ inputs.nativedawn }}" = "true" ]; then
echo "dawn_flag=-D BABYLON_NATIVE_PLUGIN_NATIVEDAWN=ON" >> "$GITHUB_OUTPUT"
echo "build_target=--target Playground" >> "$GITHUB_OUTPUT"
else
echo "dawn_flag=" >> "$GITHUB_OUTPUT"
echo "build_target=" >> "$GITHUB_OUTPUT"
fi

- name: Generate solution
shell: cmd
Expand All @@ -63,6 +77,7 @@ jobs:
-B build/${{ steps.vars.outputs.solution_name }} ^
-A ${{ inputs.platform }} ^
${{ steps.vars.outputs.js_define }} ^
${{ steps.vars.outputs.dawn_flag }} ^
-D BX_CONFIG_DEBUG=ON ^
-D GRAPHICS_API=${{ inputs.graphics-api }} ^
-D BGFX_CONFIG_MAX_FRAME_BUFFERS=256 ^
Expand All @@ -72,7 +87,7 @@ jobs:
- name: Build
shell: cmd
run: |
cmake --build build/${{ steps.vars.outputs.solution_name }} --config RelWithDebInfo -- /m
cmake --build build/${{ steps.vars.outputs.solution_name }} --config RelWithDebInfo ${{ steps.vars.outputs.build_target }} -- /m

- name: Enable Crash Dumps
shell: cmd
Expand Down Expand Up @@ -104,14 +119,42 @@ jobs:
)

- name: Validation Tests
if: ${{ inputs.graphics-api != 'D3D12' }}
if: ${{ inputs.graphics-api != 'D3D12' && !inputs.nativedawn }}
shell: cmd
run: |
cd build\${{ steps.vars.outputs.solution_name }}\Apps\Playground\RelWithDebInfo
Playground app:///Scripts/validation_native.js

# NativeDawn (WebGPU) validation. Runs the same harness on the Dawn
# backend; tests that don't yet render correctly on WebGPU are marked
# `excludedGraphicsApis: ["WebGPU"]` in config.json and are skipped, so
# this gates on the currently-passing WebGPU subset. --headless routes
# all logs to stdout for CI diagnostics.
- name: Validation Tests (NativeDawn)
if: ${{ inputs.nativedawn }}
shell: cmd
run: |
cd build\${{ steps.vars.outputs.solution_name }}\Apps\Playground\RelWithDebInfo
Playground --headless app:///Scripts/validation_native.js

- name: Upload Rendered Pictures (NativeDawn)
if: ${{ inputs.nativedawn && !cancelled() }}
uses: actions/upload-artifact@v6
with:
name: ${{ steps.vars.outputs.solution_name }}-NativeDawn-rendered-pictures
path: build/${{ steps.vars.outputs.solution_name }}/Apps/Playground/RelWithDebInfo/Results
if-no-files-found: ignore

- name: Upload Error Pictures (NativeDawn)
if: ${{ inputs.nativedawn && failure() }}
uses: actions/upload-artifact@v6
with:
name: ${{ steps.vars.outputs.solution_name }}-NativeDawn-error-pictures
path: build/${{ steps.vars.outputs.solution_name }}/Apps/Playground/RelWithDebInfo/Errors
if-no-files-found: ignore

- name: Upload Rendered Pictures
if: ${{ inputs.graphics-api != 'D3D12' && !cancelled() }}
if: ${{ inputs.graphics-api != 'D3D12' && !inputs.nativedawn && !cancelled() }}
uses: actions/upload-artifact@v6
with:
name: ${{ steps.vars.outputs.solution_name }}-${{ inputs.graphics-api }}${{ inputs.enable-sanitizers && '-sanitizer' || '' }}-rendered-pictures
Expand All @@ -134,14 +177,14 @@ jobs:
Copy-Item -Path "build\${{ steps.vars.outputs.solution_name }}\Apps\Playground\RelWithDebInfo\Playground.*" -Destination "$env:RUNNER_TEMP\Dumps\" -ErrorAction SilentlyContinue

- name: Unit Tests
if: ${{ inputs.graphics-api != 'D3D12' }}
if: ${{ inputs.graphics-api != 'D3D12' && !inputs.nativedawn }}
shell: cmd
run: |
cd build\${{ steps.vars.outputs.solution_name }}\Apps\UnitTests\RelWithDebInfo
UnitTests

- name: Module Load Test
if: ${{ !inputs.enable-sanitizers }}
if: ${{ !inputs.enable-sanitizers && !inputs.nativedawn }}
shell: cmd
run: |
cd build\${{ steps.vars.outputs.solution_name }}\Apps\ModuleLoadTest\RelWithDebInfo
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,51 @@ jobs:

Win32_Installation:
uses: ./.github/workflows/test-install-win32.yml

# ── NativeDawn (WebGPU / Dawn backend, replaces NativeEngine) ──
# These build with BABYLON_NATIVE_PLUGIN_NATIVEDAWN=ON, which force-disables
# NativeEngine. Dawn is fetched (git) only for these jobs. Win32 builds the
# full WebGPU Playground; the other platforms build the NativeDawn plugin
# target (plugin + Dawn) since only the Win32 host has a Dawn code path.
#
# The Win32 job runs the WebGPU validation tests, so it must use the V8 JS
# engine: the NativeDawn bootstrap (navigator.gpu + WebGPUEngine init +
# NativeEngine aliasing, and the glslang/twgsl WASM shader-translation helpers)
# relies on V8 semantics and fails on the Win32 default (ChakraCore) with
# "TypeError: Object doesn't support this action".
Win32_x64_NativeDawn:
uses: ./.github/workflows/build-win32.yml
with:
platform: x64
napi-type: V8
nativedawn: true

MacOS_NativeDawn:
uses: ./.github/workflows/build-macos.yml
with:
runs-on: macos-26
xcode-version: "26.4"
nativedawn: true

iOS_NativeDawn:
uses: ./.github/workflows/build-ios.yml
with:
runs-on: macos-26
xcode-version: "26.4"
deployment-target: '18.0'
nativedawn: true

Ubuntu_NativeDawn:
uses: ./.github/workflows/build-linux.yml
with:
cc: clang
cxx: clang++
js-engine: JavaScriptCore
nativedawn: true

Android_NativeDawn:
uses: ./.github/workflows/build-android.yml
with:
runs-on: ubuntu-latest
js-engine: V8
nativedawn: true
Loading