From ca1663ffda25c47d731a313705ced28308b09245 Mon Sep 17 00:00:00 2001 From: Cedric Guillemet <1312968+CedricGuillemet@users.noreply.github.com> Date: Thu, 20 Jul 2023 18:02:15 +0200 Subject: [PATCH] Update BN submodule (#589) * Update BN submodule * BN #883ba13 * a676d6df117cb6cdebc5c347b8aa37f2fed852fb * cmake + brn up * cmake update * removed comment * comment * GraphicsDevice * graphics init * android rn 0.71 * back to 0.64 --- .github/workflows/bn_master_commit.yml | 2 +- .github/workflows/ios_android.yml | 2 +- .github/workflows/pr.yml | 4 +- .../android/CMakeLists.txt | 4 +- .../android/build.gradle | 2 +- .../ios/CMakeLists.txt | 2 +- .../submodules/BabylonNative | 2 +- .../windows/CMakeLists.txt | 2 +- .../react-native/shared/BabylonNative.cpp | 48 +++++++++---------- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/bn_master_commit.yml b/.github/workflows/bn_master_commit.yml index 85b2f9cf3..beaf3270c 100644 --- a/.github/workflows/bn_master_commit.yml +++ b/.github/workflows/bn_master_commit.yml @@ -23,7 +23,7 @@ jobs: - name: Setup CMake uses: jwlawson/actions-setup-cmake@v1.8 with: - cmake-version: '3.19.6' # See https://gitlab.kitware.com/cmake/cmake/-/issues/22021 + cmake-version: '3.26.3' - name: Setup Ninja run: brew install ninja - name: NPM Install (Playground) diff --git a/.github/workflows/ios_android.yml b/.github/workflows/ios_android.yml index 12d6316cc..f501f8e61 100644 --- a/.github/workflows/ios_android.yml +++ b/.github/workflows/ios_android.yml @@ -28,7 +28,7 @@ jobs: - name: Setup CMake uses: jwlawson/actions-setup-cmake@v1.8 with: - cmake-version: '3.19.6' # See https://gitlab.kitware.com/cmake/cmake/-/issues/22021 + cmake-version: '3.26.3' - name: Setup Ninja run: brew install ninja - name: 'Select XCode ${{ inputs.xcode-version }}' diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index eb34d5003..0d762adbd 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -21,7 +21,7 @@ jobs: - name: Setup CMake uses: jwlawson/actions-setup-cmake@v1.8 with: - cmake-version: '3.19.6' # See https://gitlab.kitware.com/cmake/cmake/-/issues/22021 + cmake-version: '3.26.3' - name: Setup Ninja run: brew install ninja - name: NPM Install (Playground) @@ -77,7 +77,7 @@ jobs: - name: Setup CMake uses: jwlawson/actions-setup-cmake@v1.8 with: - cmake-version: '3.19.6' # See https://gitlab.kitware.com/cmake/cmake/-/issues/22021 + cmake-version: '3.26.3' - name: Setup Ninja run: brew install ninja - name: NPM Install (Playground) diff --git a/Modules/@babylonjs/react-native-iosandroid/android/CMakeLists.txt b/Modules/@babylonjs/react-native-iosandroid/android/CMakeLists.txt index 99bd84ed3..1396477f9 100644 --- a/Modules/@babylonjs/react-native-iosandroid/android/CMakeLists.txt +++ b/Modules/@babylonjs/react-native-iosandroid/android/CMakeLists.txt @@ -134,7 +134,7 @@ if (EXISTS "${TURBOMODULE_DIR}/CMakeLists.txt") turbomodulejsijni # prefab ready yoga # prefab ready AndroidExtensions - Graphics + GraphicsDevice JsRuntime NativeCamera NativeCapture @@ -196,7 +196,7 @@ else() jsi turbomodulejsijni AndroidExtensions - Graphics + GraphicsDevice JsRuntime NativeCamera NativeCapture diff --git a/Modules/@babylonjs/react-native-iosandroid/android/build.gradle b/Modules/@babylonjs/react-native-iosandroid/android/build.gradle index e7dfd3fd0..c64e1ec91 100644 --- a/Modules/@babylonjs/react-native-iosandroid/android/build.gradle +++ b/Modules/@babylonjs/react-native-iosandroid/android/build.gradle @@ -109,7 +109,7 @@ android { } externalNativeBuild { cmake { - version '3.19.6' + version '3.19.6+' path 'CMakeLists.txt' } } diff --git a/Modules/@babylonjs/react-native-iosandroid/ios/CMakeLists.txt b/Modules/@babylonjs/react-native-iosandroid/ios/CMakeLists.txt index fadbf2538..23ff53114 100644 --- a/Modules/@babylonjs/react-native-iosandroid/ios/CMakeLists.txt +++ b/Modules/@babylonjs/react-native-iosandroid/ios/CMakeLists.txt @@ -42,7 +42,7 @@ target_include_directories(BabylonNative PUBLIC ${CMAKE_CURRENT_LIST_DIR}) target_link_libraries(BabylonNative z arcana - Graphics + GraphicsDevice jsi reactnative JsRuntime diff --git a/Modules/@babylonjs/react-native-iosandroid/submodules/BabylonNative b/Modules/@babylonjs/react-native-iosandroid/submodules/BabylonNative index 409bc4b31..c89031ec5 160000 --- a/Modules/@babylonjs/react-native-iosandroid/submodules/BabylonNative +++ b/Modules/@babylonjs/react-native-iosandroid/submodules/BabylonNative @@ -1 +1 @@ -Subproject commit 409bc4b3178a5140462c618293e5ff984dfe5bd5 +Subproject commit c89031ec58bca5faffa92d3498230c5484175e57 diff --git a/Modules/@babylonjs/react-native-windows/windows/CMakeLists.txt b/Modules/@babylonjs/react-native-windows/windows/CMakeLists.txt index a23b717ff..7dcada09c 100644 --- a/Modules/@babylonjs/react-native-windows/windows/CMakeLists.txt +++ b/Modules/@babylonjs/react-native-windows/windows/CMakeLists.txt @@ -30,7 +30,7 @@ target_include_directories(BabylonNative PRIVATE ${SHARED_INCLUDES}) target_link_libraries(BabylonNative arcana - Graphics + GraphicsDevice jsi JsRuntime NativeCamera diff --git a/Modules/@babylonjs/react-native/shared/BabylonNative.cpp b/Modules/@babylonjs/react-native/shared/BabylonNative.cpp index a42f83bee..f1042c3b0 100644 --- a/Modules/@babylonjs/react-native/shared/BabylonNative.cpp +++ b/Modules/@babylonjs/react-native/shared/BabylonNative.cpp @@ -23,8 +23,8 @@ namespace BabylonNative namespace { Dispatcher g_inlineDispatcher{ [](const std::function& func) { func(); } }; - std::unique_ptr g_graphics{}; - std::unique_ptr g_update{}; + std::optional g_graphicsDevice{}; + std::optional g_update{}; std::unique_ptr g_nativeCanvas{}; } @@ -75,34 +75,34 @@ namespace BabylonNative void UpdateView(WindowType window, size_t width, size_t height) { - m_windowConfig.Window = window; - m_windowConfig.Width = width; - m_windowConfig.Height = height; + m_graphicsConfig.Window = window; + m_graphicsConfig.Width = width; + m_graphicsConfig.Height = height; UpdateGraphicsConfiguration(); } void UpdateGraphicsConfiguration() { - if (!g_graphics) + if (!g_graphicsDevice) { - g_graphics = Babylon::Graphics::Device::Create(m_windowConfig); - g_update = std::make_unique(g_graphics->GetUpdate("update")); + g_graphicsDevice.emplace(m_graphicsConfig); + g_update.emplace(g_graphicsDevice->GetUpdate("update")); } else { - g_graphics->UpdateWindow(m_windowConfig); - g_graphics->UpdateSize(m_windowConfig.Width, m_windowConfig.Height); + g_graphicsDevice->UpdateWindow(m_graphicsConfig.Window); + g_graphicsDevice->UpdateSize(m_graphicsConfig.Width, m_graphicsConfig.Height); } - g_graphics->UpdateMSAA(mMSAAValue); - g_graphics->UpdateAlphaPremultiplied(mAlphaPremultiplied); + g_graphicsDevice->UpdateMSAA(mMSAAValue); + g_graphicsDevice->UpdateAlphaPremultiplied(mAlphaPremultiplied); - g_graphics->EnableRendering(); + g_graphicsDevice->EnableRendering(); std::call_once(m_isGraphicsInitialized, [this]() { m_jsDispatcher([this]() { - g_graphics->AddToJavaScript(m_env); + g_graphicsDevice->AddToJavaScript(m_env); Babylon::Plugins::NativeEngine::Initialize(m_env); }); }); @@ -121,18 +121,18 @@ namespace BabylonNative void UpdateMSAA(uint8_t value) { mMSAAValue = value; - if (g_graphics) + if (g_graphicsDevice) { - g_graphics->UpdateMSAA(value); + g_graphicsDevice->UpdateMSAA(value); } } void UpdateAlphaPremultiplied(bool enabled) { mAlphaPremultiplied = enabled; - if (g_graphics) + if (g_graphicsDevice) { - g_graphics->UpdateAlphaPremultiplied(enabled); + g_graphicsDevice->UpdateAlphaPremultiplied(enabled); } } @@ -144,12 +144,12 @@ namespace BabylonNative } // If rendering has not been explicitly enabled, or has been explicitly disabled, then don't try to render. // Otherwise rendering can be implicitly enabled, which may not be desirable (e.g. after the engine is disposed). - if (g_graphics && m_isRenderingEnabled) + if (g_graphicsDevice && m_isRenderingEnabled) { - g_graphics->StartRenderingCurrentFrame(); + g_graphicsDevice->StartRenderingCurrentFrame(); g_update->Start(); g_update->Finish(); - g_graphics->FinishRenderingCurrentFrame(); + g_graphicsDevice->FinishRenderingCurrentFrame(); } } @@ -160,10 +160,10 @@ namespace BabylonNative void ResetView() { - if (g_graphics) + if (g_graphicsDevice) { g_nativeCanvas->FlushGraphicResources(); - g_graphics->DisableRendering(); + g_graphicsDevice->DisableRendering(); } m_isRenderingEnabled = false; @@ -264,7 +264,7 @@ namespace BabylonNative Babylon::Plugins::NativeInput* m_nativeInput{}; std::optional m_nativeXr{}; - Babylon::Graphics::WindowConfiguration m_windowConfig{}; + Babylon::Graphics::Configuration m_graphicsConfig{}; std::shared_ptr m_isXRActive{}; uint8_t mMSAAValue{};