diff --git a/.github/jobs/macos.yml b/.github/jobs/macos.yml
index 6de9d3913..6074d87fc 100644
--- a/.github/jobs/macos.yml
+++ b/.github/jobs/macos.yml
@@ -18,7 +18,7 @@ jobs:
displayName: 'Select XCode $(XCODE_VERSION)'
- script: |
- cmake -G Xcode -B buildmacOS -D CMAKE_UNITY_BUILD=$(UNITY_BUILD) -D BABYLON_DEBUG_TRACE=ON
+ cmake -G Xcode -B buildmacOS -D CMAKE_UNITY_BUILD=$(UNITY_BUILD) -D BABYLON_DEBUG_TRACE=ON -D BABYLON_NATIVE_TESTS_USE_NOOP_METAL_DEVICE=ON
displayName: 'Generate macOS solution'
- script: |
diff --git a/Apps/HeadlessScreenshotApp/Win32/App.cpp b/Apps/HeadlessScreenshotApp/Win32/App.cpp
index 3823a4a58..c89d59b74 100644
--- a/Apps/HeadlessScreenshotApp/Win32/App.cpp
+++ b/Apps/HeadlessScreenshotApp/Win32/App.cpp
@@ -109,7 +109,7 @@ int main()
// Initialize the console polyfill.
Babylon::Polyfills::Console::Initialize(env, [](const char* message, auto) {
- std::cout << message;
+ std::cout << message << std::endl;
});
// Initialize the window, XMLHttpRequest, and NativeEngine polyfills.
diff --git a/Apps/UnitTests/Android/.gitignore b/Apps/UnitTests/Android/.gitignore
deleted file mode 100644
index ca296116d..000000000
--- a/Apps/UnitTests/Android/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-*.iml
-.gradle/
-.idea/
-local.properties
-
-app/.cxx/
-app/build/
-app/src/main/assets
-
-build/
\ No newline at end of file
diff --git a/Apps/UnitTests/Android/app/build.gradle b/Apps/UnitTests/Android/app/build.gradle
deleted file mode 100644
index e6fca383d..000000000
--- a/Apps/UnitTests/Android/app/build.gradle
+++ /dev/null
@@ -1,117 +0,0 @@
-plugins {
- id 'com.android.application'
-}
-
-def jsEngine = "V8"
-if (project.hasProperty("jsEngine")) {
- jsEngine = project.property("jsEngine")
-}
-
-configurations { natives }
-
-android {
- namespace 'com.babylonnative.unittests'
- compileSdk 33
- ndkVersion = "21.4.7075529"
-
- defaultConfig {
- applicationId "com.babylonnative.unittests"
- minSdk 21
- targetSdk 33
- versionCode 1
- versionName "1.0"
-
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
-
- externalNativeBuild {
- cmake {
- arguments (
- "-DANDROID_STL=c++_shared",
- "-DNAPI_JAVASCRIPT_ENGINE=${jsEngine}",
- "-DJSRUNTIMEHOST_CORE_APPRUNTIME_V8_INSPECTOR=ON",
- "-DBABYLON_NATIVE_BUILD_APPS=ON"
- )
- }
- }
-
- if (project.hasProperty("abiFilters")) {
- ndk {
- abiFilters project.getProperty("abiFilters")
- }
- }
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- compileOptions {
- sourceCompatibility JavaVersion.VERSION_1_8
- targetCompatibility JavaVersion.VERSION_1_8
- }
- externalNativeBuild {
- cmake {
- path file('src/main/cpp/CMakeLists.txt')
- buildStagingDirectory '../../../../Build/Android'
- version '3.22.1+'
- }
- }
- buildFeatures {
- viewBinding true
- }
-}
-
-dependencies {
- implementation 'com.google.ar:core:1.16.0'
- natives 'com.google.ar:core:1.16.0'
- implementation 'androidx.appcompat:appcompat:1.6.0'
- implementation 'com.google.android.material:material:1.7.0'
- implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
- implementation group: 'org.java-websocket', name: 'Java-WebSocket', version: '1.5.3'
- testImplementation 'junit:junit:4.13.2'
- androidTestImplementation 'androidx.test.ext:junit:1.1.5'
- androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
-}
-
-task copyScripts {
- doLast {
- // run copy at execution phase because npm command is not done at configuration phase
- copy
- {
- from "../../../node_modules/chai"
- include "chai.js"
- into 'src/main/assets/Scripts'
- }
- copy
- {
- from "../../../node_modules/mocha"
- include "mocha.js"
- into 'src/main/assets/Scripts'
- }
- copy
- {
- from "../../../node_modules/babylonjs"
- include "babylon.max.js"
- into 'src/main/assets/Scripts'
- }
- copy
- {
- from "../../../node_modules/babylonjs-materials"
- include "babylonjs.materials.js"
- into 'src/main/assets/Scripts'
- }
- }
-}
-
-// Run copyScripts task after CMake external build
-// And make sure merging assets into output is performed after the scripts copy
-tasks.configureEach { task ->
- if (task.name == 'mergeDebugNativeLibs') {
- task.finalizedBy(copyScripts)
- }
- if (task.name == 'mergeDebugAssets') {
- task.dependsOn(copyScripts)
- }
-}
diff --git a/Apps/UnitTests/Android/app/proguard-rules.pro b/Apps/UnitTests/Android/app/proguard-rules.pro
deleted file mode 100644
index 481bb4348..000000000
--- a/Apps/UnitTests/Android/app/proguard-rules.pro
+++ /dev/null
@@ -1,21 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/Apps/UnitTests/Android/app/src/androidTest/java/com/babylonnative/unittests/Main.java b/Apps/UnitTests/Android/app/src/androidTest/java/com/babylonnative/unittests/Main.java
deleted file mode 100644
index cff697434..000000000
--- a/Apps/UnitTests/Android/app/src/androidTest/java/com/babylonnative/unittests/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.babylonnative.unittests;
-
-import android.content.Context;
-
-import androidx.test.platform.app.InstrumentationRegistry;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.*;
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see Testing documentation
- */
-@RunWith(AndroidJUnit4.class)
-public class Main {
- @Test
- public void javaScriptTests() {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
- assertEquals("com.babylonnative.unittests", appContext.getPackageName());
-
- assertEquals(0, Native.javaScriptTests(appContext));
- }
-}
\ No newline at end of file
diff --git a/Apps/UnitTests/Android/app/src/androidTest/java/com/babylonnative/unittests/Native.java b/Apps/UnitTests/Android/app/src/androidTest/java/com/babylonnative/unittests/Native.java
deleted file mode 100644
index 882ecd5d5..000000000
--- a/Apps/UnitTests/Android/app/src/androidTest/java/com/babylonnative/unittests/Native.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.babylonnative.unittests;
-
-import android.content.Context;
-
-public class Native {
- // JNI interface
- static {
- System.loadLibrary("UnitTestsJNI");
- }
-
- public static native int javaScriptTests(Context context);
-}
diff --git a/Apps/UnitTests/Android/app/src/main/AndroidManifest.xml b/Apps/UnitTests/Android/app/src/main/AndroidManifest.xml
deleted file mode 100644
index c3537fae4..000000000
--- a/Apps/UnitTests/Android/app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Apps/UnitTests/Android/app/src/main/cpp/CMakeLists.txt b/Apps/UnitTests/Android/app/src/main/cpp/CMakeLists.txt
deleted file mode 100644
index e8049cf63..000000000
--- a/Apps/UnitTests/Android/app/src/main/cpp/CMakeLists.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-cmake_minimum_required(VERSION 3.18)
-
-set(CMAKE_CXX_STANDARD 17)
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
-
-project(UnitTestsJNI)
-
-get_filename_component(UNIT_TESTS_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../../.." ABSOLUTE)
-get_filename_component(APPS_DIR "${UNIT_TESTS_DIR}/.." ABSOLUTE)
-get_filename_component(REPO_ROOT_DIR "${APPS_DIR}/.." ABSOLUTE)
-
-set(JSRUNTIMEHOST_TESTS OFF) # Turn off the tests folder for Android Studio path
-add_subdirectory(${REPO_ROOT_DIR} "${CMAKE_CURRENT_BINARY_DIR}/BabylonNative")
-
-npm(install --silent WORKING_DIRECTORY ${APPS_DIR})
-
-add_library(UnitTestsJNI SHARED
- JNI.cpp
- ${UNIT_TESTS_DIR}/Shared/Tests.h)
-target_compile_definitions(UnitTestsJNI PRIVATE JSRUNTIMEHOST_PLATFORM="${JSRUNTIMEHOST_PLATFORM}")
-
-target_include_directories(UnitTestsJNI
- PRIVATE ${UNIT_TESTS_DIR})
-
-target_link_libraries(UnitTestsJNI
- PRIVATE GLESv3
- PRIVATE android
- PRIVATE EGL
- PRIVATE log
- PRIVATE -lz
- PRIVATE AndroidExtensions
- PRIVATE AppRuntime
- PRIVATE Canvas
- PRIVATE Console
- PRIVATE GraphicsDevice
- PRIVATE NativeCamera
- PRIVATE NativeEngine
- PRIVATE NativeInput
- PRIVATE NativeOptimizations
- PRIVATE NativeEncoding
- PRIVATE ScriptLoader
- PRIVATE XMLHttpRequest
- PRIVATE gtest_main
- PRIVATE Window)
diff --git a/Apps/UnitTests/Android/app/src/main/cpp/JNI.cpp b/Apps/UnitTests/Android/app/src/main/cpp/JNI.cpp
deleted file mode 100644
index de94b0edd..000000000
--- a/Apps/UnitTests/Android/app/src/main/cpp/JNI.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-extern "C" JNIEXPORT jint JNICALL
-Java_com_babylonnative_unittests_Native_javaScriptTests(JNIEnv* env, jclass clazz, jobject context) {
- JavaVM* javaVM{};
- if (env->GetJavaVM(&javaVM) != JNI_OK)
- {
- throw std::runtime_error{"Failed to get Java VM"};
- }
-
- android::StdoutLogger::Start();
-
- Babylon::DebugTrace::EnableDebugTrace(true);
- Babylon::DebugTrace::SetTraceOutput([](const char* trace) { printf("%s\n", trace); fflush(stdout); });
-
- android::global::Initialize(javaVM, context);
- auto testResult = Run();
-
- android::StdoutLogger::Stop();
- return testResult;
-}
diff --git a/Apps/UnitTests/Android/app/src/main/res/values/strings.xml b/Apps/UnitTests/Android/app/src/main/res/values/strings.xml
deleted file mode 100644
index b1ceb201f..000000000
--- a/Apps/UnitTests/Android/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- BabylonNative UnitTests
-
\ No newline at end of file
diff --git a/Apps/UnitTests/Android/build.gradle b/Apps/UnitTests/Android/build.gradle
deleted file mode 100644
index 71b99f4ca..000000000
--- a/Apps/UnitTests/Android/build.gradle
+++ /dev/null
@@ -1,5 +0,0 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-plugins {
- id 'com.android.application' version '7.3.1' apply false
- id 'com.android.library' version '7.3.1' apply false
-}
\ No newline at end of file
diff --git a/Apps/UnitTests/Android/gradle.properties b/Apps/UnitTests/Android/gradle.properties
deleted file mode 100644
index 3e927b11e..000000000
--- a/Apps/UnitTests/Android/gradle.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-# Project-wide Gradle settings.
-# IDE (e.g. Android Studio) users:
-# Gradle settings configured through the IDE *will override*
-# any settings specified in this file.
-# For more details on how to configure your build environment visit
-# http://www.gradle.org/docs/current/userguide/build_environment.html
-# Specifies the JVM arguments used for the daemon process.
-# The setting is particularly useful for tweaking memory settings.
-org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
-# AndroidX package structure to make it clearer which packages are bundled with the
-# Android operating system, and which are packaged with your app's APK
-# https://developer.android.com/topic/libraries/support-library/androidx-rn
-android.useAndroidX=true
-# Enables namespacing of each library's R class so that its R class includes only the
-# resources declared in the library itself and none from the library's dependencies,
-# thereby reducing the size of the R class for that library
-android.nonTransitiveRClass=true
\ No newline at end of file
diff --git a/Apps/UnitTests/Android/gradle/wrapper/gradle-wrapper.jar b/Apps/UnitTests/Android/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index e708b1c02..000000000
Binary files a/Apps/UnitTests/Android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/Apps/UnitTests/Android/gradle/wrapper/gradle-wrapper.properties b/Apps/UnitTests/Android/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 806746cfe..000000000
--- a/Apps/UnitTests/Android/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-#Fri Jan 20 12:19:56 PST 2023
-distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
-distributionPath=wrapper/dists
-zipStorePath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
diff --git a/Apps/UnitTests/Android/gradlew b/Apps/UnitTests/Android/gradlew
deleted file mode 100644
index 4f906e0c8..000000000
--- a/Apps/UnitTests/Android/gradlew
+++ /dev/null
@@ -1,185 +0,0 @@
-#!/usr/bin/env sh
-
-#
-# Copyright 2015 the original author or authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
- echo "$*"
-}
-
-die () {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin or MSYS, switch paths to Windows format before running java
-if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
-
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=`expr $i + 1`
- done
- case $i in
- 0) set -- ;;
- 1) set -- "$args0" ;;
- 2) set -- "$args0" "$args1" ;;
- 3) set -- "$args0" "$args1" "$args2" ;;
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=`save "$@"`
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-exec "$JAVACMD" "$@"
diff --git a/Apps/UnitTests/Android/gradlew.bat b/Apps/UnitTests/Android/gradlew.bat
deleted file mode 100644
index 107acd32c..000000000
--- a/Apps/UnitTests/Android/gradlew.bat
+++ /dev/null
@@ -1,89 +0,0 @@
-@rem
-@rem Copyright 2015 the original author or authors.
-@rem
-@rem Licensed under the Apache License, Version 2.0 (the "License");
-@rem you may not use this file except in compliance with the License.
-@rem You may obtain a copy of the License at
-@rem
-@rem https://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing, software
-@rem distributed under the License is distributed on an "AS IS" BASIS,
-@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-@rem See the License for the specific language governing permissions and
-@rem limitations under the License.
-@rem
-
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Resolve any "." and ".." in APP_HOME to make it shorter.
-for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto execute
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto execute
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/Apps/UnitTests/Android/settings.gradle b/Apps/UnitTests/Android/settings.gradle
deleted file mode 100644
index 52ff7502b..000000000
--- a/Apps/UnitTests/Android/settings.gradle
+++ /dev/null
@@ -1,16 +0,0 @@
-pluginManagement {
- repositories {
- gradlePluginPortal()
- google()
- mavenCentral()
- }
-}
-dependencyResolutionManagement {
- repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
- repositories {
- google()
- mavenCentral()
- }
-}
-rootProject.name = "UnitTests"
-include ':app'
diff --git a/Apps/UnitTests/Apple/App.mm b/Apps/UnitTests/Apple/App.mm
deleted file mode 100644
index e086444de..000000000
--- a/Apps/UnitTests/Apple/App.mm
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "../Shared/Tests.h"
-#include
-
-int main()
-{
- Babylon::DebugTrace::EnableDebugTrace(true);
- Babylon::DebugTrace::SetTraceOutput([](const char* trace) { NSLog(@"%s", trace); });
-
- return RunTests({});
-}
diff --git a/Apps/UnitTests/CMakeLists.txt b/Apps/UnitTests/CMakeLists.txt
index 7086ff915..e21291395 100644
--- a/Apps/UnitTests/CMakeLists.txt
+++ b/Apps/UnitTests/CMakeLists.txt
@@ -1,8 +1,9 @@
-# Build only on Win32, not on UWP
if(NOT((WIN32 AND NOT WINDOWS_STORE) OR (APPLE AND NOT IOS) OR (UNIX AND NOT ANDROID)))
message(FATAL_ERROR "Unsupported platform: ${CMAKE_SYSTEM_NAME}")
endif()
+option(BABYLON_NATIVE_TESTS_USE_NOOP_METAL_DEVICE "Use a noop Metal device for Apple platforms." OFF)
+
set(BABYLONJS_ASSETS
"../node_modules/babylonjs/babylon.max.js")
@@ -14,19 +15,28 @@ set(TEST_ASSETS
"JavaScript/dist/tests.nativeEngine.shaderCache.js")
set(SOURCES
- "Shared/Tests.h"
- "Shared/Tests.cpp"
- "Shared/Tests.JavaScript.cpp"
- "Shared/Tests.NativeEngine.cpp")
+ "Source/App.h"
+ "Source/App.cpp"
+ "Source/Tests.JavaScript.cpp"
+ "Source/Tests.NativeEngine.cpp"
+ "Source/Tests.ExternalTexture.cpp"
+ "Source/Utils.h"
+ "Source/Utils_${GRAPHICS_API}.${BABYLON_NATIVE_PLATFORM_IMPL_EXT}")
if(APPLE)
+ set(SOURCES ${SOURCES} "Source/App_Apple.mm")
+ if(BABYLON_NATIVE_TESTS_USE_NOOP_METAL_DEVICE)
+ set(ADDITIONAL_COMPILE_DEFINITIONS
+ PRIVATE USE_NOOP_METAL_DEVICE
+ PRIVATE SKIP_EXTERNAL_TEXTURE_TESTS)
+ endif()
find_library(JAVASCRIPTCORE_LIBRARY JavaScriptCore)
set(ADDITIONAL_LIBRARIES PRIVATE ${JAVASCRIPTCORE_LIBRARY})
- set(SOURCES ${SOURCES} "Apple/App.mm")
elseif(UNIX AND NOT ANDROID)
- set(SOURCES ${SOURCES} "X11/App.cpp")
+ set(SOURCES ${SOURCES} "Source/App_X11.cpp")
+ set(ADDITIONAL_COMPILE_DEFINITIONS PRIVATE SKIP_EXTERNAL_TEXTURE_TESTS)
elseif(WIN32)
- set(SOURCES ${SOURCES} "Win32/App.cpp")
+ set(SOURCES ${SOURCES} "Source/App_Win32.cpp")
endif()
add_executable(UnitTests ${BABYLONJS_ASSETS} ${BABYLONJS_MATERIALS_ASSETS} ${TEST_ASSETS} ${SOURCES})
@@ -38,6 +48,7 @@ target_link_libraries(UnitTests
PRIVATE Canvas
PRIVATE Console
PRIVATE GraphicsDevice
+ PRIVATE ExternalTexture
PRIVATE NativeEngine
PRIVATE NativeEncoding
PRIVATE ScriptLoader
@@ -47,6 +58,8 @@ target_link_libraries(UnitTests
PRIVATE gtest_main
${ADDITIONAL_LIBRARIES})
+target_compile_definitions(UnitTests PRIVATE ${ADDITIONAL_COMPILE_DEFINITIONS})
+
add_test(NAME UnitTests COMMAND UnitTests)
# See https://gitlab.kitware.com/cmake/cmake/-/issues/23543
diff --git a/Apps/UnitTests/Shared/Tests.h b/Apps/UnitTests/Shared/Tests.h
deleted file mode 100644
index c96bc241f..000000000
--- a/Apps/UnitTests/Shared/Tests.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#pragma once
-
-#include
-
-int RunTests(const Babylon::Graphics::Configuration& config);
\ No newline at end of file
diff --git a/Apps/UnitTests/Shared/Tests.cpp b/Apps/UnitTests/Source/App.cpp
similarity index 58%
rename from Apps/UnitTests/Shared/Tests.cpp
rename to Apps/UnitTests/Source/App.cpp
index 5de1ac846..bfe519b6a 100644
--- a/Apps/UnitTests/Shared/Tests.cpp
+++ b/Apps/UnitTests/Source/App.cpp
@@ -3,9 +3,9 @@
Babylon::Graphics::Configuration g_deviceConfig{};
-int RunTests(const Babylon::Graphics::Configuration& config)
+int RunTests(const Babylon::Graphics::Configuration& config, int argc, char* argv[])
{
g_deviceConfig = config;
- testing::InitGoogleTest();
+ testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
diff --git a/Apps/UnitTests/Source/App.h b/Apps/UnitTests/Source/App.h
new file mode 100644
index 000000000..1c1856601
--- /dev/null
+++ b/Apps/UnitTests/Source/App.h
@@ -0,0 +1,5 @@
+#pragma once
+
+#include
+
+int RunTests(const Babylon::Graphics::Configuration& config, int argc, char* argv[]);
\ No newline at end of file
diff --git a/Apps/UnitTests/Source/App_Apple.mm b/Apps/UnitTests/Source/App_Apple.mm
new file mode 100644
index 000000000..9de1dcf2c
--- /dev/null
+++ b/Apps/UnitTests/Source/App_Apple.mm
@@ -0,0 +1,19 @@
+#include "App.h"
+#include
+#include
+
+int main(int argc, char* argv[])
+{
+ Babylon::DebugTrace::EnableDebugTrace(true);
+ Babylon::DebugTrace::SetTraceOutput([](const char* trace) { NSLog(@"%s", trace); });
+
+ Babylon::Graphics::Configuration config{};
+
+#ifndef USE_NOOP_METAL_DEVICE
+ config.Device = MTLCreateSystemDefaultDevice();
+ config.Width = 600;
+ config.Height = 400;
+#endif
+
+ return RunTests(config, argc, argv);
+}
diff --git a/Apps/UnitTests/Win32/App.cpp b/Apps/UnitTests/Source/App_Win32.cpp
similarity index 92%
rename from Apps/UnitTests/Win32/App.cpp
rename to Apps/UnitTests/Source/App_Win32.cpp
index c758e9127..22bcd4089 100644
--- a/Apps/UnitTests/Win32/App.cpp
+++ b/Apps/UnitTests/Source/App_Win32.cpp
@@ -1,4 +1,4 @@
-#include "../Shared/Tests.h"
+#include "App.h"
#include
#include
@@ -7,7 +7,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
return ::DefWindowProc(hWnd, msg, wParam, lParam);
}
-int main()
+int main(int argc, char* argv[])
{
SetConsoleOutputCP(CP_UTF8);
@@ -29,5 +29,5 @@ int main()
OutputDebugStringA("\n");
});
- return RunTests(config);
+ return RunTests(config, argc, argv);
}
diff --git a/Apps/UnitTests/X11/App.cpp b/Apps/UnitTests/Source/App_X11.cpp
similarity index 91%
rename from Apps/UnitTests/X11/App.cpp
rename to Apps/UnitTests/Source/App_X11.cpp
index f14e27561..5c9a6ac21 100644
--- a/Apps/UnitTests/X11/App.cpp
+++ b/Apps/UnitTests/Source/App_X11.cpp
@@ -1,11 +1,11 @@
-// gtest.h included here and in Shared/Tests.h because of a preprocessor conflict
+// gtest.h included here and in App.h because of a preprocessor conflict
#include
#define XK_MISCELLANY
#define XK_LATIN1
#include // will include X11 which #defines None... Don't mess with order of includes.
#include
#undef None
-#include "../Shared/Tests.h"
+#include "App.h"
#include
namespace
@@ -16,7 +16,7 @@ namespace
constexpr const char* wmDeleteWindowName = "WM_DELETE_WINDOW";
}
-int main()
+int main(int argc, char* argv[])
{
XInitThreads();
Display* display = XOpenDisplay(NULL);
@@ -53,5 +53,5 @@ int main()
Babylon::DebugTrace::EnableDebugTrace(true);
Babylon::DebugTrace::SetTraceOutput([](const char* trace) { printf("%s\n", trace); fflush(stdout); });
- return RunTests(config);
+ return RunTests(config, argc, argv);
}
\ No newline at end of file
diff --git a/Apps/UnitTests/Source/Tests.ExternalTexture.cpp b/Apps/UnitTests/Source/Tests.ExternalTexture.cpp
new file mode 100644
index 000000000..1d982bf83
--- /dev/null
+++ b/Apps/UnitTests/Source/Tests.ExternalTexture.cpp
@@ -0,0 +1,109 @@
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "Utils.h"
+
+#include
+#include
+#include
+
+extern Babylon::Graphics::Configuration g_deviceConfig;
+
+TEST(ExternalTexture, Construction)
+{
+#ifdef SKIP_EXTERNAL_TEXTURE_TESTS
+ GTEST_SKIP();
+#else
+ Babylon::Graphics::Device device{g_deviceConfig};
+ Babylon::Graphics::DeviceUpdate update{device.GetUpdate("update")};
+
+ device.StartRenderingCurrentFrame();
+ update.Start();
+
+ auto nativeTexture = CreateTestTexture(device.GetPlatformInfo().Device, 256, 256);
+ Babylon::Plugins::ExternalTexture externalTexture{nativeTexture};
+ DestroyTestTexture(nativeTexture);
+
+ EXPECT_EQ(externalTexture.Width(), 256u);
+ EXPECT_EQ(externalTexture.Height(), 256u);
+
+ update.Finish();
+ device.FinishRenderingCurrentFrame();
+#endif
+}
+
+TEST(ExternalTexture, AddToContextAsyncAndUpdate)
+{
+#ifdef SKIP_EXTERNAL_TEXTURE_TESTS
+ GTEST_SKIP();
+#else
+ Babylon::Graphics::Device device{g_deviceConfig};
+ Babylon::Graphics::DeviceUpdate update{device.GetUpdate("update")};
+
+ device.StartRenderingCurrentFrame();
+ update.Start();
+
+ auto nativeTexture = CreateTestTexture(device.GetPlatformInfo().Device, 256, 256);
+ Babylon::Plugins::ExternalTexture externalTexture{nativeTexture};
+ DestroyTestTexture(nativeTexture);
+
+ std::promise addToContext{};
+ std::promise promiseResolved{};
+
+ Babylon::AppRuntime runtime{};
+ runtime.Dispatch([&device, &addToContext, &promiseResolved, externalTexture](Napi::Env env) {
+ device.AddToJavaScript(env);
+
+ Babylon::Polyfills::Console::Initialize(env, [](const char* message, auto) {
+ std::cout << message << std::endl;
+ });
+
+ Babylon::Polyfills::Window::Initialize(env);
+
+ Babylon::Plugins::NativeEngine::Initialize(env);
+
+ auto jsPromise = externalTexture.AddToContextAsync(env);
+ addToContext.set_value();
+
+ auto jsOnFulfilled = Napi::Function::New(env, [&promiseResolved](const Napi::CallbackInfo& info) {
+ promiseResolved.set_value();
+ });
+
+ auto jsOnRejected = Napi::Function::New(env, [&promiseResolved](const Napi::CallbackInfo& info) {
+ promiseResolved.set_exception(std::make_exception_ptr(info[0].As()));
+ });
+
+ jsPromise.Get("then").As().Call(jsPromise, {jsOnFulfilled, jsOnRejected});
+ });
+
+ // Wait for AddToContextAsync to be called.
+ addToContext.get_future().wait();
+
+ // Render a frame so that AddToContextAsync will complete.
+ update.Finish();
+ device.FinishRenderingCurrentFrame();
+
+ // Wait for promise to resolve.
+ promiseResolved.get_future().wait();
+
+ // Start a new frame.
+ device.StartRenderingCurrentFrame();
+ update.Start();
+
+ // Update the external texture to a new texture.
+ auto nativeTexture2 = CreateTestTexture(device.GetPlatformInfo().Device, 256, 256);
+ externalTexture.Update(nativeTexture2);
+ DestroyTestTexture(nativeTexture2);
+
+ update.Finish();
+ device.FinishRenderingCurrentFrame();
+#endif
+}
diff --git a/Apps/UnitTests/Shared/Tests.JavaScript.cpp b/Apps/UnitTests/Source/Tests.JavaScript.cpp
similarity index 99%
rename from Apps/UnitTests/Shared/Tests.JavaScript.cpp
rename to Apps/UnitTests/Source/Tests.JavaScript.cpp
index cb12562c5..fa9cb732a 100644
--- a/Apps/UnitTests/Shared/Tests.JavaScript.cpp
+++ b/Apps/UnitTests/Source/Tests.JavaScript.cpp
@@ -1,4 +1,5 @@
#include
+
#include
#include
#include
diff --git a/Apps/UnitTests/Shared/Tests.NativeEngine.cpp b/Apps/UnitTests/Source/Tests.NativeEngine.cpp
similarity index 99%
rename from Apps/UnitTests/Shared/Tests.NativeEngine.cpp
rename to Apps/UnitTests/Source/Tests.NativeEngine.cpp
index 4a834cf59..b9a55bebf 100644
--- a/Apps/UnitTests/Shared/Tests.NativeEngine.cpp
+++ b/Apps/UnitTests/Source/Tests.NativeEngine.cpp
@@ -1,4 +1,5 @@
#include
+
#include
#include
#include
@@ -6,8 +7,8 @@
#include
#include
#include
+
#include
-#include
#include
#include
#include
diff --git a/Apps/UnitTests/Source/Utils.h b/Apps/UnitTests/Source/Utils.h
new file mode 100644
index 000000000..e40c3dccf
--- /dev/null
+++ b/Apps/UnitTests/Source/Utils.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include
+
+Babylon::Graphics::TextureT CreateTestTexture(Babylon::Graphics::DeviceT device, uint32_t width, uint32_t height);
+void DestroyTestTexture(Babylon::Graphics::TextureT texture);
diff --git a/Apps/UnitTests/Source/Utils_D3D11.cpp b/Apps/UnitTests/Source/Utils_D3D11.cpp
new file mode 100644
index 000000000..02a6c0d7b
--- /dev/null
+++ b/Apps/UnitTests/Source/Utils_D3D11.cpp
@@ -0,0 +1,28 @@
+#include
+#include "Utils.h"
+
+Babylon::Graphics::TextureT CreateTestTexture(Babylon::Graphics::DeviceT device, uint32_t width, uint32_t height)
+{
+ D3D11_TEXTURE2D_DESC desc{};
+ desc.Width = width;
+ desc.Height = height;
+ desc.MipLevels = 1;
+ desc.ArraySize = 1;
+ desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+ desc.SampleDesc.Count = 1;
+ desc.SampleDesc.Quality = 0;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
+
+ ID3D11Texture2D* texture = nullptr;
+ EXPECT_HRESULT_SUCCEEDED(device->CreateTexture2D(&desc, nullptr, &texture));
+
+ return texture;
+}
+
+void DestroyTestTexture(Babylon::Graphics::TextureT texture)
+{
+ texture->Release();
+}
diff --git a/Apps/UnitTests/Source/Utils_D3D12.cpp b/Apps/UnitTests/Source/Utils_D3D12.cpp
new file mode 100644
index 000000000..565a80bbc
--- /dev/null
+++ b/Apps/UnitTests/Source/Utils_D3D12.cpp
@@ -0,0 +1,41 @@
+#include
+#include "Utils.h"
+
+Babylon::Graphics::TextureT CreateTestTexture(Babylon::Graphics::DeviceT device, uint32_t width, uint32_t height)
+{
+ D3D12_RESOURCE_DESC desc{};
+ desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
+ desc.Alignment = 0;
+ desc.Width = width;
+ desc.Height = height;
+ desc.DepthOrArraySize = 1;
+ desc.MipLevels = 1;
+ desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
+ desc.SampleDesc.Count = 1;
+ desc.SampleDesc.Quality = 0;
+ desc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN;
+ desc.Flags = D3D12_RESOURCE_FLAG_NONE;
+
+ D3D12_HEAP_PROPERTIES heapProps{};
+ heapProps.Type = D3D12_HEAP_TYPE_DEFAULT;
+ heapProps.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
+ heapProps.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
+ heapProps.CreationNodeMask = 1;
+ heapProps.VisibleNodeMask = 1;
+
+ ID3D12Resource* texture = nullptr;
+ EXPECT_HRESULT_SUCCEEDED(device->CreateCommittedResource(
+ &heapProps,
+ D3D12_HEAP_FLAG_NONE,
+ &desc,
+ D3D12_RESOURCE_STATE_COMMON,
+ nullptr,
+ IID_PPV_ARGS(&texture)));
+
+ return texture;
+}
+
+void DestroyTestTexture(Babylon::Graphics::TextureT texture)
+{
+ texture->Release();
+}
diff --git a/Apps/UnitTests/Source/Utils_Metal.mm b/Apps/UnitTests/Source/Utils_Metal.mm
new file mode 100644
index 000000000..9b8e8960a
--- /dev/null
+++ b/Apps/UnitTests/Source/Utils_Metal.mm
@@ -0,0 +1,23 @@
+#include
+#include "Utils.h"
+#import
+
+Babylon::Graphics::TextureT CreateTestTexture(Babylon::Graphics::DeviceT device, uint32_t width, uint32_t height)
+{
+ MTLTextureDescriptor* descriptor = [MTLTextureDescriptor
+ texture2DDescriptorWithPixelFormat:MTLPixelFormatBGRA8Unorm
+ width:width
+ height:height
+ mipmapped:NO];
+
+ id texture = [device newTextureWithDescriptor:descriptor];
+ EXPECT_NE(texture, nil);
+
+ return texture;
+}
+
+void DestroyTestTexture(Babylon::Graphics::TextureT texture)
+{
+ // ARC will handle the release automatically
+ (void)texture;
+}
diff --git a/Apps/UnitTests/Source/Utils_OpenGL.cpp b/Apps/UnitTests/Source/Utils_OpenGL.cpp
new file mode 100644
index 000000000..b9f18c7a0
--- /dev/null
+++ b/Apps/UnitTests/Source/Utils_OpenGL.cpp
@@ -0,0 +1,12 @@
+#include
+#include "Utils.h"
+
+Babylon::Graphics::TextureT CreateTestTexture(Babylon::Graphics::DeviceT device, uint32_t width, uint32_t height)
+{
+ throw std::runtime_error{"not implemented"};
+}
+
+void DestroyTestTexture(Babylon::Graphics::TextureT texture)
+{
+ throw std::runtime_error{"not implemented"};
+}
diff --git a/Apps/package-lock.json b/Apps/package-lock.json
index 0b5b085fd..3230b3ac1 100644
--- a/Apps/package-lock.json
+++ b/Apps/package-lock.json
@@ -82,6 +82,7 @@
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@babel/code-frame": "^7.27.1",
"@babel/generator": "^7.28.5",
@@ -1912,7 +1913,8 @@
"resolved": "https://registry.npmjs.org/@babylonjs/core/-/core-8.37.0.tgz",
"integrity": "sha512-p1EZGRuutk3/PC9eKAqq5j/St6JT7u+bl23wvSd3khU995IrEi23lpwaRMg9TPShJ39BeSvXErbGyTCfF5Q8qg==",
"dev": true,
- "license": "Apache-2.0"
+ "license": "Apache-2.0",
+ "peer": true
},
"node_modules/@babylonjs/materials": {
"version": "8.37.0",
@@ -2383,6 +2385,7 @@
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true,
"license": "MIT",
+ "peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -2409,6 +2412,7 @@
"integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"fast-deep-equal": "^3.1.3",
"fast-uri": "^3.0.1",
@@ -2733,6 +2737,7 @@
}
],
"license": "MIT",
+ "peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.8.25",
"caniuse-lite": "^1.0.30001754",
@@ -5294,6 +5299,7 @@
"integrity": "sha512-HU1JOuV1OavsZ+mfigY0j8d1TgQgbZ6M+J75zDkpEAwYeXjWSqrGJtgnPblJjd/mAyTNQ7ygw0MiKOn6etz8yw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@types/eslint-scope": "^3.7.7",
"@types/estree": "^1.0.8",
@@ -5343,6 +5349,7 @@
"integrity": "sha512-MfwFQ6SfwinsUVi0rNJm7rHZ31GyTcpVE5pgVA3hwFRb7COD4TzjUUwhGWKfO50+xdc2MQPuEBBJoqIMGt3JDw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@discoveryjs/json-ext": "^0.6.1",
"@webpack-cli/configtest": "^3.0.1",
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4a65d6145..4fe5e2696 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,7 +37,7 @@ FetchContent_Declare(ios-cmake
GIT_TAG 4.5.0)
FetchContent_Declare(JsRuntimeHost
GIT_REPOSITORY https://github.com/BabylonJS/JsRuntimeHost.git
- GIT_TAG b3dbf370caf560fb5b93936efd4cdf4e990d4d0a)
+ GIT_TAG 756bf24a179240efcd5e63590133943203546205)
FetchContent_Declare(SPIRV-Cross
GIT_REPOSITORY https://github.com/BabylonJS/SPIRV-Cross.git
GIT_TAG 6abfcf066d171e9ade7604d91381ebebe4209edc)
diff --git a/Core/Graphics/Include/RendererType/Metal/Babylon/Graphics/RendererType.h b/Core/Graphics/Include/RendererType/Metal/Babylon/Graphics/RendererType.h
index 0cf537b2d..0d6e3f3bd 100644
--- a/Core/Graphics/Include/RendererType/Metal/Babylon/Graphics/RendererType.h
+++ b/Core/Graphics/Include/RendererType/Metal/Babylon/Graphics/RendererType.h
@@ -16,7 +16,7 @@ namespace Babylon::Graphics
struct PlatformInfo
{
- struct MTLDevice* Device;
- struct MTLCommandQueue* CommandQueue;
+ id Device;
+ id CommandQueue;
};
}
diff --git a/Core/Graphics/Source/DeviceImpl_Metal.cpp b/Core/Graphics/Source/DeviceImpl_Metal.cpp
index d8d92fe4d..a8caecc83 100644
--- a/Core/Graphics/Source/DeviceImpl_Metal.cpp
+++ b/Core/Graphics/Source/DeviceImpl_Metal.cpp
@@ -7,10 +7,9 @@ namespace Babylon::Graphics
PlatformInfo DeviceImpl::GetPlatformInfo() const
{
- return
- {
- static_cast(bgfx::getInternalData()->context),
- static_cast(bgfx::getInternalData()->commandQueue)
- };
+ auto internalData = bgfx::getInternalData();
+ id device = (id)internalData->context;
+ id commandQueue = (id)internalData->commandQueue;
+ return {device, commandQueue};
}
}
diff --git a/Dependencies/CMakeLists.txt b/Dependencies/CMakeLists.txt
index a09dec6c2..fddab583f 100644
--- a/Dependencies/CMakeLists.txt
+++ b/Dependencies/CMakeLists.txt
@@ -32,7 +32,6 @@ target_include_directories(base-n INTERFACE "${base-n_SOURCE_DIR}/include")
# --------------------------------------------------
set(BGFX_BUILD_EXAMPLES OFF)
set(BGFX_BUILD_TOOLS OFF)
-set(BGFX_CONFIG_DEBUG_ANNOTATION OFF)
set(BGFX_CONFIG_MULTITHREADED ON)
set(BGFX_CUSTOM_TARGETS OFF)
set(BGFX_INSTALL OFF)
@@ -40,6 +39,11 @@ set(BGFX_OPENGL_USE_EGL ON)
set(BGFX_USE_DEBUG_SUFFIX OFF)
FetchContent_MakeAvailable_With_Message(bgfx.cmake)
+# Turn off debug annotations as it causes an access violation in D3D12.
+# This flag is set using compile definitions because the bgfx.cmake option is ignored in debug configuration.
+# See https://github.com/BabylonJS/bgfx.cmake/blob/0af3c9865a66aff1748a51bb466b24f05a123043/cmake/bgfx/bgfx.cmake#L126.
+target_compile_definitions(bgfx PRIVATE BGFX_CONFIG_DEBUG_ANNOTATION=0)
+
target_compile_definitions(bgfx PRIVATE BGFX_CONFIG_MAX_VERTEX_STREAMS=18)
if(GRAPHICS_API STREQUAL "D3D11")
target_compile_definitions(bgfx PRIVATE BGFX_CONFIG_RENDERER_DIRECT3D11=1)
diff --git a/Plugins/ExternalTexture/Source/ExternalTexture_Shared.h b/Plugins/ExternalTexture/Source/ExternalTexture_Shared.h
index 0734c0ab9..2c2019e39 100644
--- a/Plugins/ExternalTexture/Source/ExternalTexture_Shared.h
+++ b/Plugins/ExternalTexture/Source/ExternalTexture_Shared.h
@@ -69,7 +69,7 @@ namespace Babylon::Plugins
DEBUG_TRACE("ExternalTexture [0x%p] AddToContextAsync", m_impl.get());
arcana::make_task(context.BeforeRenderScheduler(), arcana::cancellation_source::none(),
- [&context, &runtime, deferred = std::move(deferred), impl = m_impl]() {
+ [&context, &runtime, deferred = std::move(deferred), impl = m_impl]() mutable {
// REVIEW: The bgfx texture handle probably needs to be an RAII object to make sure it gets clean up during the asynchrony.
// For example, if any of the schedulers/dispatches below don't fire, then the texture handle will leak.
bgfx::TextureHandle handle = bgfx::createTexture2D(impl->Width(), impl->Height(), impl->HasMips(), 1, impl->Format(), impl->Flags());
@@ -84,7 +84,7 @@ namespace Babylon::Plugins
return;
}
- arcana::make_task(context.AfterRenderScheduler(), arcana::cancellation_source::none(), [&runtime, &context, deferred = std::move(deferred), handle, impl = std::move(impl)]() {
+ arcana::make_task(context.AfterRenderScheduler(), arcana::cancellation_source::none(), [&runtime, &context, deferred = std::move(deferred), handle, impl = std::move(impl)]() mutable {
if (bgfx::overrideInternal(handle, impl->Ptr()) == 0)
{
runtime.Dispatch([deferred = std::move(deferred), handle](Napi::Env env) {
@@ -95,7 +95,7 @@ namespace Babylon::Plugins
return;
}
- runtime.Dispatch([deferred = std::move(deferred), handle, &context, impl = std::move(impl)](Napi::Env env) {
+ runtime.Dispatch([deferred = std::move(deferred), handle, &context, impl = std::move(impl)](Napi::Env env) mutable {
auto* texture = new Graphics::Texture{context};
DEBUG_TRACE("ExternalTexture [0x%p] attach %d x %d %d mips. Format : %d Flags : %d. (bgfx handle id %d)", impl.get(), int(impl->Width()), int(impl->Height()), int(impl->HasMips()), int(impl->Format()), int(impl->Flags()), int(handle.idx));
texture->Attach(handle, true, impl->Width(), impl->Height(), impl->HasMips(), 1, impl->Format(), impl->Flags());
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 14bab2c4e..c5170b8f0 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -88,7 +88,7 @@ jobs:
- template: .github/jobs/linux.yml
parameters:
- name: Ubuntu_Clang_JavaScriptCore
+ name: Ubuntu_Clang_JSC
vmImage: 'ubuntu-latest'
CC: clang
CXX: clang++
@@ -96,7 +96,7 @@ jobs:
- template: .github/jobs/linux.yml
parameters:
- name: Ubuntu_GCC_JavaScriptCore
+ name: Ubuntu_GCC_JSC
vmImage: 'ubuntu-latest'
CC: gcc
CXX: g++