diff --git a/Apps/HeadlessScreenshotApp/Win32/App.cpp b/Apps/HeadlessScreenshotApp/Win32/App.cpp index 64b90b690..fba31d9eb 100644 --- a/Apps/HeadlessScreenshotApp/Win32/App.cpp +++ b/Apps/HeadlessScreenshotApp/Win32/App.cpp @@ -93,12 +93,10 @@ int main() // Create the Babylon Native graphics device and update. auto device = CreateGraphicsDevice(d3dDevice.get()); - auto deviceUpdate = device.GetUpdate("update"); // Start rendering a frame to unblock the JavaScript from queuing graphics // commands. device.StartRenderingCurrentFrame(); - deviceUpdate.Start(); // Create a Babylon Native application runtime which hosts a JavaScript // engine on a new thread. @@ -128,13 +126,11 @@ int main() winrt::com_ptr outputTexture = CreateD3DRenderTargetTexture(d3dDevice.get()); // Close the script-load frame. - deviceUpdate.Finish(); device.FinishRenderingCurrentFrame(); // Open a new frame for `startup` so the JS-side resource creation and // startup() call run in the same frame as the wait that observes them. device.StartRenderingCurrentFrame(); - deviceUpdate.Start(); std::promise startup{}; @@ -155,7 +151,6 @@ int main() startup.get_future().wait(); // Close the startup frame. - deviceUpdate.Finish(); device.FinishRenderingCurrentFrame(); struct Asset @@ -177,7 +172,6 @@ int main() // Start rendering a frame to unblock the JavaScript again. device.StartRenderingCurrentFrame(); - deviceUpdate.Start(); std::promise loadAndRenderAsset{}; @@ -200,7 +194,6 @@ int main() loadAndRenderAsset.get_future().wait(); // Finish rendering the frame. - deviceUpdate.Finish(); device.FinishRenderingCurrentFrame(); // Tell RenderDoc to stop capturing. diff --git a/Apps/Playground/Android/BabylonNative/src/main/cpp/BabylonNativeJNI.cpp b/Apps/Playground/Android/BabylonNative/src/main/cpp/BabylonNativeJNI.cpp index cebf24c0f..15a1e9b0f 100644 --- a/Apps/Playground/Android/BabylonNative/src/main/cpp/BabylonNativeJNI.cpp +++ b/Apps/Playground/Android/BabylonNative/src/main/cpp/BabylonNativeJNI.cpp @@ -167,10 +167,8 @@ extern "C" { if (appContext) { - appContext->DeviceUpdate().Finish(); appContext->Device().FinishRenderingCurrentFrame(); appContext->Device().StartRenderingCurrentFrame(); - appContext->DeviceUpdate().Start(); } } diff --git a/Apps/Playground/Shared/AppContext.cpp b/Apps/Playground/Shared/AppContext.cpp index 09d9a408a..116aef80f 100644 --- a/Apps/Playground/Shared/AppContext.cpp +++ b/Apps/Playground/Shared/AppContext.cpp @@ -80,7 +80,6 @@ AppContext::AppContext( graphicsConfig.MSAASamples = 4; m_device.emplace(graphicsConfig); - m_deviceUpdate.emplace(m_device->GetUpdate("update")); // Mirror bgfx trace output (BgfxCallback::traceVargs) to debugLog so it // reaches stdout in headless mode, not just OutputDebugString. @@ -89,7 +88,6 @@ AppContext::AppContext( Babylon::Plugins::ShaderCache::Enable(); m_device->StartRenderingCurrentFrame(); - m_deviceUpdate->Start(); Babylon::AppRuntime::Options options{}; @@ -228,7 +226,6 @@ AppContext::~AppContext() { if (m_device) { - m_deviceUpdate->Finish(); m_device->FinishRenderingCurrentFrame(); } @@ -238,6 +235,5 @@ AppContext::~AppContext() m_canvas.reset(); m_input = {}; m_runtime.reset(); - m_deviceUpdate.reset(); m_device.reset(); } diff --git a/Apps/Playground/Shared/AppContext.h b/Apps/Playground/Shared/AppContext.h index e27ad8038..e4d1292da 100644 --- a/Apps/Playground/Shared/AppContext.h +++ b/Apps/Playground/Shared/AppContext.h @@ -39,7 +39,6 @@ class AppContext AppContext& operator=(AppContext&&) noexcept = delete; Babylon::Graphics::Device& Device() { return *m_device; } - Babylon::Graphics::DeviceUpdate& DeviceUpdate() { return *m_deviceUpdate; } Babylon::AppRuntime& Runtime() { return *m_runtime; } Babylon::Polyfills::Canvas& Canvas() { return *m_canvas; } Babylon::Plugins::NativeInput* Input() { return m_input; } @@ -47,7 +46,6 @@ class AppContext private: std::optional m_device; - std::optional m_deviceUpdate; std::optional m_runtime; std::optional m_canvas; Babylon::Plugins::NativeInput* m_input{}; diff --git a/Apps/Playground/UWP/App.cpp b/Apps/Playground/UWP/App.cpp index f4b728879..8f9b81cf0 100644 --- a/Apps/Playground/UWP/App.cpp +++ b/Apps/Playground/UWP/App.cpp @@ -109,10 +109,8 @@ void App::Run() { if (m_appContext) { - m_appContext->DeviceUpdate().Finish(); m_appContext->Device().FinishRenderingCurrentFrame(); m_appContext->Device().StartRenderingCurrentFrame(); - m_appContext->DeviceUpdate().Start(); } CoreWindow::GetForCurrentThread().Dispatcher().ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); @@ -156,7 +154,6 @@ void App::OnSuspending(IInspectable const& /*sender*/, SuspendingEventArgs const if (m_appContext) { - m_appContext->DeviceUpdate().Finish(); m_appContext->Device().FinishRenderingCurrentFrame(); m_appContext->Runtime().Suspend(); @@ -175,7 +172,6 @@ void App::OnResuming(IInspectable const& /*sender*/, IInspectable const& /*args* m_appContext->Runtime().Resume(); m_appContext->Device().StartRenderingCurrentFrame(); - m_appContext->DeviceUpdate().Start(); } } diff --git a/Apps/Playground/Win32/App.cpp b/Apps/Playground/Win32/App.cpp index 507bba413..0fba87e0b 100644 --- a/Apps/Playground/Win32/App.cpp +++ b/Apps/Playground/Win32/App.cpp @@ -215,10 +215,8 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, { if (appContext) { - appContext->DeviceUpdate().Finish(); appContext->Device().FinishRenderingCurrentFrame(); appContext->Device().StartRenderingCurrentFrame(); - appContext->DeviceUpdate().Start(); } result = PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE) && msg.message != WM_QUIT; @@ -340,7 +338,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { if (appContext) { - appContext->DeviceUpdate().Finish(); appContext->Device().FinishRenderingCurrentFrame(); appContext->Runtime().Suspend(); @@ -359,7 +356,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) appContext->Runtime().Resume(); appContext->Device().StartRenderingCurrentFrame(); - appContext->DeviceUpdate().Start(); } } } diff --git a/Apps/Playground/X11/App.cpp b/Apps/Playground/X11/App.cpp index 5205add33..8eb4358ff 100644 --- a/Apps/Playground/X11/App.cpp +++ b/Apps/Playground/X11/App.cpp @@ -139,10 +139,8 @@ int main(int _argc, const char* const* _argv) { if (!XPending(display) && g_appContext) { - g_appContext->DeviceUpdate().Finish(); g_appContext->Device().FinishRenderingCurrentFrame(); g_appContext->Device().StartRenderingCurrentFrame(); - g_appContext->DeviceUpdate().Start(); } else { diff --git a/Apps/Playground/iOS/LibNativeBridge.mm b/Apps/Playground/iOS/LibNativeBridge.mm index aa1731215..337dd6797 100644 --- a/Apps/Playground/iOS/LibNativeBridge.mm +++ b/Apps/Playground/iOS/LibNativeBridge.mm @@ -49,13 +49,11 @@ - (void)resize:(int)inWidth height:(int)inHeight { if (appContext) { - appContext->DeviceUpdate().Finish(); appContext->Device().FinishRenderingCurrentFrame(); appContext->Device().UpdateSize(static_cast(inWidth), static_cast(inHeight)); appContext->Device().StartRenderingCurrentFrame(); - appContext->DeviceUpdate().Start(); } } @@ -63,10 +61,8 @@ - (void)render { if (appContext) { - appContext->DeviceUpdate().Finish(); appContext->Device().FinishRenderingCurrentFrame(); appContext->Device().StartRenderingCurrentFrame(); - appContext->DeviceUpdate().Start(); } } diff --git a/Apps/Playground/macOS/ViewController.mm b/Apps/Playground/macOS/ViewController.mm index 722f6f4f3..a7eb1e6f2 100644 --- a/Apps/Playground/macOS/ViewController.mm +++ b/Apps/Playground/macOS/ViewController.mm @@ -16,23 +16,19 @@ @implementation EngineView - (void)mtkView:(MTKView *)__unused view drawableSizeWillChange:(CGSize) size { if (appContext) { - appContext->DeviceUpdate().Finish(); appContext->Device().FinishRenderingCurrentFrame(); appContext->Device().UpdateSize(static_cast(size.width), static_cast(size.height)); appContext->Device().StartRenderingCurrentFrame(); - appContext->DeviceUpdate().Start(); } } - (void)drawInMTKView:(MTKView *)__unused view { if (appContext) { - appContext->DeviceUpdate().Finish(); appContext->Device().FinishRenderingCurrentFrame(); appContext->Device().StartRenderingCurrentFrame(); - appContext->DeviceUpdate().Start(); } } diff --git a/Apps/Playground/visionOS/LibNativeBridge.mm b/Apps/Playground/visionOS/LibNativeBridge.mm index 78d4e7f87..c5a19a4b9 100644 --- a/Apps/Playground/visionOS/LibNativeBridge.mm +++ b/Apps/Playground/visionOS/LibNativeBridge.mm @@ -37,13 +37,11 @@ - (bool)initializeWithWidth:(NSInteger)width height:(NSInteger)height { - (void)drawableWillChangeSizeWithWidth:(NSInteger)width height:(NSInteger)height { if (_appContext) { - _appContext->DeviceUpdate().Finish(); _appContext->Device().FinishRenderingCurrentFrame(); _appContext->Device().UpdateSize(static_cast(width), static_cast(height)); _appContext->Device().StartRenderingCurrentFrame(); - _appContext->DeviceUpdate().Start(); } } @@ -67,10 +65,8 @@ - (void)setTouchUp:(int)pointerId x:(int)inX y:(int)inY { - (void)render { if (_appContext && self.initialized) { - _appContext->DeviceUpdate().Finish(); _appContext->Device().FinishRenderingCurrentFrame(); _appContext->Device().StartRenderingCurrentFrame(); - _appContext->DeviceUpdate().Start(); } } diff --git a/Apps/PrecompiledShaderTest/Source/App.cpp b/Apps/PrecompiledShaderTest/Source/App.cpp index fe2c132c0..a85f29d4a 100644 --- a/Apps/PrecompiledShaderTest/Source/App.cpp +++ b/Apps/PrecompiledShaderTest/Source/App.cpp @@ -103,12 +103,10 @@ int RunApp( // Create the Babylon Native graphics device and update. auto device = Babylon::Graphics::Device(config); - auto deviceUpdate = device.GetUpdate("update"); // Start rendering a frame to unblock the JavaScript from queuing graphics // commands. device.StartRenderingCurrentFrame(); - deviceUpdate.Start(); // Create a Babylon Native application runtime which hosts a JavaScript // engine on a new thread. @@ -136,13 +134,11 @@ int RunApp( loader.LoadScript("app:///index.js"); // Close the script-load frame. - deviceUpdate.Finish(); device.FinishRenderingCurrentFrame(); // Open a new frame for `startup` so the JS-side resource creation and // startup() call run in the same frame as the wait that observes them. device.StartRenderingCurrentFrame(); - deviceUpdate.Start(); std::promise startup{}; @@ -163,12 +159,10 @@ int RunApp( startup.get_future().wait(); // Close the startup frame. - deviceUpdate.Finish(); device.FinishRenderingCurrentFrame(); // Start a new frame for rendering the scene. device.StartRenderingCurrentFrame(); - deviceUpdate.Start(); std::promise renderScene{}; @@ -190,7 +184,6 @@ int RunApp( renderScene.get_future().wait(); // Finish the frame. - deviceUpdate.Finish(); device.FinishRenderingCurrentFrame(); // Save the rendered output as a PNG. diff --git a/Apps/StyleTransferApp/Win32/App.cpp b/Apps/StyleTransferApp/Win32/App.cpp index a32178863..d9e9c0f01 100644 --- a/Apps/StyleTransferApp/Win32/App.cpp +++ b/Apps/StyleTransferApp/Win32/App.cpp @@ -69,7 +69,6 @@ namespace WCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name std::optional g_device{}; - std::optional g_update{}; Babylon::Plugins::NativeInput* g_nativeInput{}; std::optional g_runtime{}; bool g_minimized{false}; @@ -219,13 +218,11 @@ namespace { if (g_device) { - g_update->Finish(); g_device->FinishRenderingCurrentFrame(); } g_nativeInput = {}; g_runtime.reset(); - g_update.reset(); g_device.reset(); } @@ -300,12 +297,10 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, // --------------------- Babylon Native initialization -------------------------- g_device = CreateBabylonGraphicsDevice(d3d11Device.get()); - g_update.emplace(g_device->GetUpdate("update")); // Start rendering a frame to unblock the JavaScript from queuing graphics // commands. g_device->StartRenderingCurrentFrame(); - g_update->Start(); // Create a Babylon Native application runtime which hosts a JavaScript // engine on a new thread. @@ -335,13 +330,11 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, loader.LoadScript("app:///Scripts/index.js"); // Close the script-load frame. - g_update->Finish(); g_device->FinishRenderingCurrentFrame(); // Open a new frame for `startup` so the JS-side resource creation and // startup() call run in the same frame as the wait that observes them. g_device->StartRenderingCurrentFrame(); - g_update->Start(); std::promise startup{}; @@ -362,7 +355,6 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, startup.get_future().wait(); // Close the startup frame. - g_update->Finish(); g_device->FinishRenderingCurrentFrame(); // --------------------------- Rendering loop ------------------------- @@ -372,7 +364,6 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, MSG msg{}; g_device->StartRenderingCurrentFrame(); - g_update->Start(); // Main message loop: while (msg.message != WM_QUIT) @@ -388,7 +379,6 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, if (g_device) { // Finish Babylon Native rendering. - g_update->Finish(); g_device->FinishRenderingCurrentFrame(); if (g_selectedModel >= 0) @@ -406,7 +396,6 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, // Present and start rendering next frame. swapChain->Present(1, 0); g_device->StartRenderingCurrentFrame(); - g_update->Start(); } result = PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE) && msg.message != WM_QUIT; @@ -460,7 +449,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { if (g_device) { - g_update->Finish(); g_device->FinishRenderingCurrentFrame(); } @@ -479,7 +467,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) if (g_device) { g_device->StartRenderingCurrentFrame(); - g_update->Start(); } } } @@ -601,4 +588,4 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) } } return 0; -} \ No newline at end of file +} diff --git a/Apps/UnitTests/Source/Tests.Device.D3D11.cpp b/Apps/UnitTests/Source/Tests.Device.D3D11.cpp index cec5979db..d91427eeb 100644 --- a/Apps/UnitTests/Source/Tests.Device.D3D11.cpp +++ b/Apps/UnitTests/Source/Tests.Device.D3D11.cpp @@ -89,17 +89,14 @@ TEST(Device, BackBuffer) config.Height = dimensions[0].cy; Babylon::Graphics::Device device{config}; - Babylon::Graphics::DeviceUpdate update{device.GetUpdate("update")}; for (size_t i = 1; i < std::size(dimensions); ++i) { device.StartRenderingCurrentFrame(); - update.Start(); device.UpdateBackBuffer(renderTargetTextures[i].View.get()); device.UpdateSize(dimensions[i].cx, dimensions[i].cy); - update.Finish(); device.FinishRenderingCurrentFrame(); } } diff --git a/Apps/UnitTests/Source/Tests.ExternalTexture.DeviceLoss.cpp b/Apps/UnitTests/Source/Tests.ExternalTexture.DeviceLoss.cpp index ad463799a..beed8135a 100644 --- a/Apps/UnitTests/Source/Tests.ExternalTexture.DeviceLoss.cpp +++ b/Apps/UnitTests/Source/Tests.ExternalTexture.DeviceLoss.cpp @@ -81,10 +81,8 @@ TEST(ExternalTexture, RestoreAfterDeviceLoss) Babylon::Graphics::Configuration config = g_deviceConfig; config.Device = deviceA; Babylon::Graphics::Device device{config}; - Babylon::Graphics::DeviceUpdate update{device.GetUpdate("update")}; device.StartRenderingCurrentFrame(); - update.Start(); auto nativeTexture1 = Helpers::CreateTexture( device.GetPlatformInfo().Device, TEX_SIZE, TEX_SIZE, 1, true); @@ -132,12 +130,10 @@ TEST(ExternalTexture, RestoreAfterDeviceLoss) }); startupDone.get_future().get(); - update.Finish(); device.FinishRenderingCurrentFrame(); // --- Phase 1: render red into texture 1, readback --- device.StartRenderingCurrentFrame(); - update.Start(); std::promise render1Done; loader.Dispatch([&render1Done](Napi::Env env) { @@ -153,7 +149,6 @@ TEST(ExternalTexture, RestoreAfterDeviceLoss) }); render1Done.get_future().get(); - update.Finish(); device.FinishRenderingCurrentFrame(); auto pixels1 = Helpers::ReadPixels(device.GetPlatformInfo(), nativeTexture1, TEX_SIZE, TEX_SIZE); @@ -188,7 +183,6 @@ TEST(ExternalTexture, RestoreAfterDeviceLoss) Babylon::Plugins::ExternalTexture externalTexture2{nativeTexture2}; device.StartRenderingCurrentFrame(); - update.Start(); std::promise restoreDone; loader.Dispatch([&externalTexture2, &restoreDone](Napi::Env env) { @@ -205,12 +199,10 @@ TEST(ExternalTexture, RestoreAfterDeviceLoss) }); restoreDone.get_future().get(); - update.Finish(); device.FinishRenderingCurrentFrame(); // Render blue into restored RTT. device.StartRenderingCurrentFrame(); - update.Start(); std::promise render2Done; loader.Dispatch([&render2Done](Napi::Env env) { @@ -226,7 +218,6 @@ TEST(ExternalTexture, RestoreAfterDeviceLoss) }); render2Done.get_future().get(); - update.Finish(); device.FinishRenderingCurrentFrame(); auto pixels2 = Helpers::ReadPixels(device.GetPlatformInfo(), nativeTexture2, TEX_SIZE, TEX_SIZE); diff --git a/Apps/UnitTests/Source/Tests.ExternalTexture.Msaa.cpp b/Apps/UnitTests/Source/Tests.ExternalTexture.Msaa.cpp index 53ac756df..8f835f3ac 100644 --- a/Apps/UnitTests/Source/Tests.ExternalTexture.Msaa.cpp +++ b/Apps/UnitTests/Source/Tests.ExternalTexture.Msaa.cpp @@ -27,10 +27,8 @@ namespace std::vector RenderAndReadback(uint32_t samples) { Babylon::Graphics::Device device{g_deviceConfig}; - Babylon::Graphics::DeviceUpdate update{device.GetUpdate("update")}; device.StartRenderingCurrentFrame(); - update.Start(); auto nativeTexture = Helpers::CreateTexture( device.GetPlatformInfo().Device, TEX_SIZE, TEX_SIZE, 1, true, samples); @@ -86,7 +84,6 @@ namespace renderDone.get_future().get(); - update.Finish(); device.FinishRenderingCurrentFrame(); auto pixels = Helpers::ReadPixels( diff --git a/Apps/UnitTests/Source/Tests.ExternalTexture.Render.cpp b/Apps/UnitTests/Source/Tests.ExternalTexture.Render.cpp index d9595d924..f807b53dd 100644 --- a/Apps/UnitTests/Source/Tests.ExternalTexture.Render.cpp +++ b/Apps/UnitTests/Source/Tests.ExternalTexture.Render.cpp @@ -40,10 +40,8 @@ TEST(ExternalTexture, RenderTextureArray) #endif Babylon::Graphics::Device device{g_deviceConfig}; - Babylon::Graphics::DeviceUpdate update{device.GetUpdate("update")}; device.StartRenderingCurrentFrame(); - update.Start(); auto inputTexture = Helpers::CreateTextureArrayWithData( device.GetPlatformInfo().Device, TEX_SIZE, TEX_SIZE, sliceColors, SLICE_COUNT); @@ -92,7 +90,6 @@ TEST(ExternalTexture, RenderTextureArray) startupDone.get_future().wait(); - update.Finish(); device.FinishRenderingCurrentFrame(); for (uint32_t sliceIndex = 0; sliceIndex < SLICE_COUNT; ++sliceIndex) @@ -102,7 +99,6 @@ TEST(ExternalTexture, RenderTextureArray) #endif device.StartRenderingCurrentFrame(); - update.Start(); std::promise renderDone; @@ -128,7 +124,6 @@ TEST(ExternalTexture, RenderTextureArray) << "Slice " << sliceIndex << ": renderSlice timed out"; ASSERT_NO_THROW(renderFuture.get()) << "Slice " << sliceIndex << ": renderSlice rejected"; - update.Finish(); device.FinishRenderingCurrentFrame(); #ifdef HAS_RENDERDOC diff --git a/Apps/UnitTests/Source/Tests.ExternalTexture.cpp b/Apps/UnitTests/Source/Tests.ExternalTexture.cpp index 504a44872..2e699de8d 100644 --- a/Apps/UnitTests/Source/Tests.ExternalTexture.cpp +++ b/Apps/UnitTests/Source/Tests.ExternalTexture.cpp @@ -19,10 +19,8 @@ TEST(ExternalTexture, Construction) GTEST_SKIP(); #else Babylon::Graphics::Device device{g_deviceConfig}; - Babylon::Graphics::DeviceUpdate update{device.GetUpdate("update")}; device.StartRenderingCurrentFrame(); - update.Start(); auto nativeTexture = Helpers::CreateTexture(device.GetPlatformInfo().Device, 256, 256); Babylon::Plugins::ExternalTexture externalTexture{nativeTexture}; @@ -31,7 +29,6 @@ TEST(ExternalTexture, Construction) EXPECT_EQ(externalTexture.Width(), 256u); EXPECT_EQ(externalTexture.Height(), 256u); - update.Finish(); device.FinishRenderingCurrentFrame(); #endif } @@ -42,10 +39,8 @@ TEST(ExternalTexture, CreateForJavaScript) GTEST_SKIP(); #else Babylon::Graphics::Device device{g_deviceConfig}; - Babylon::Graphics::DeviceUpdate update{device.GetUpdate("update")}; device.StartRenderingCurrentFrame(); - update.Start(); auto nativeTexture = Helpers::CreateTexture(device.GetPlatformInfo().Device, 256, 256); Babylon::Plugins::ExternalTexture externalTexture{nativeTexture}; @@ -73,7 +68,6 @@ TEST(ExternalTexture, CreateForJavaScript) done.get_future().wait(); - update.Finish(); device.FinishRenderingCurrentFrame(); #endif } @@ -84,10 +78,8 @@ TEST(ExternalTexture, Update) GTEST_SKIP(); #else Babylon::Graphics::Device device{g_deviceConfig}; - Babylon::Graphics::DeviceUpdate update{device.GetUpdate("update")}; device.StartRenderingCurrentFrame(); - update.Start(); auto nativeTexture = Helpers::CreateTexture(device.GetPlatformInfo().Device, 256, 256); Babylon::Plugins::ExternalTexture externalTexture{nativeTexture}; @@ -96,12 +88,10 @@ TEST(ExternalTexture, Update) EXPECT_EQ(externalTexture.Width(), 256u); EXPECT_EQ(externalTexture.Height(), 256u); - update.Finish(); device.FinishRenderingCurrentFrame(); // Update the external texture to point at a new native texture with different dimensions. device.StartRenderingCurrentFrame(); - update.Start(); auto nativeTexture2 = Helpers::CreateTexture(device.GetPlatformInfo().Device, 128, 128); externalTexture.Update(nativeTexture2); @@ -110,7 +100,6 @@ TEST(ExternalTexture, Update) EXPECT_EQ(externalTexture.Width(), 128u); EXPECT_EQ(externalTexture.Height(), 128u); - update.Finish(); device.FinishRenderingCurrentFrame(); #endif } @@ -121,10 +110,8 @@ TEST(ExternalTexture, AddToContextAsyncAndUpdate) GTEST_SKIP(); #else Babylon::Graphics::Device device{g_deviceConfig}; - Babylon::Graphics::DeviceUpdate update{device.GetUpdate("update")}; device.StartRenderingCurrentFrame(); - update.Start(); auto nativeTexture = Helpers::CreateTexture(device.GetPlatformInfo().Device, 256, 256); Babylon::Plugins::ExternalTexture externalTexture{nativeTexture}; @@ -163,7 +150,6 @@ TEST(ExternalTexture, AddToContextAsyncAndUpdate) addToContext.get_future().wait(); // Close the frame in which the deprecated shim's synchronous CreateForJavaScript ran. - update.Finish(); device.FinishRenderingCurrentFrame(); // Wait for promise to resolve. @@ -171,14 +157,12 @@ TEST(ExternalTexture, AddToContextAsyncAndUpdate) // Start a new frame. device.StartRenderingCurrentFrame(); - update.Start(); // Update the external texture to a new texture. auto nativeTexture2 = Helpers::CreateTexture(device.GetPlatformInfo().Device, 256, 256); externalTexture.Update(nativeTexture2); Helpers::DestroyTexture(nativeTexture2); - update.Finish(); device.FinishRenderingCurrentFrame(); #endif } diff --git a/Apps/UnitTests/Source/Tests.ShaderCache.cpp b/Apps/UnitTests/Source/Tests.ShaderCache.cpp index 241480151..9d62f9184 100644 --- a/Apps/UnitTests/Source/Tests.ShaderCache.cpp +++ b/Apps/UnitTests/Source/Tests.ShaderCache.cpp @@ -27,10 +27,8 @@ TEST(ShaderCache, SaveAndLoad) Babylon::Plugins::ShaderCache::Enable(); Babylon::Graphics::Device device{g_deviceConfig}; - Babylon::Graphics::DeviceUpdate update{device.GetUpdate("update")}; device.StartRenderingCurrentFrame(); - update.Start(); Babylon::AppRuntime::Options options{}; @@ -73,10 +71,8 @@ TEST(ShaderCache, SaveAndLoad) auto sceneIsReadyFuture = sceneIsReady.get_future(); while (sceneIsReadyFuture.wait_for(16ms) != std::future_status::ready) { - update.Finish(); device.FinishRenderingCurrentFrame(); device.StartRenderingCurrentFrame(); - update.Start(); } const auto shaderCachePath = GetExecutableDirectory() / "shaderCache.bin"; @@ -99,7 +95,6 @@ TEST(ShaderCache, SaveAndLoad) EXPECT_FALSE(ec) << "Failed to remove " << shaderCachePath << ": " << ec.message(); EXPECT_TRUE(removed) << "Expected shader cache file to be removed: " << shaderCachePath; - update.Finish(); device.FinishRenderingCurrentFrame(); Babylon::Plugins::ShaderCache::Disable(); diff --git a/Apps/UnitTests/Source/Tests.ShaderCompilation.cpp b/Apps/UnitTests/Source/Tests.ShaderCompilation.cpp index a2b920e0f..17dbbdad8 100644 --- a/Apps/UnitTests/Source/Tests.ShaderCompilation.cpp +++ b/Apps/UnitTests/Source/Tests.ShaderCompilation.cpp @@ -19,10 +19,8 @@ extern Babylon::Graphics::Configuration g_deviceConfig; TEST(ShaderCompilation, CompileComprehensiveGLSL) { Babylon::Graphics::Device device{g_deviceConfig}; - Babylon::Graphics::DeviceUpdate update{device.GetUpdate("update")}; device.StartRenderingCurrentFrame(); - update.Start(); Babylon::AppRuntime::Options options{}; @@ -65,12 +63,9 @@ TEST(ShaderCompilation, CompileComprehensiveGLSL) auto sceneIsReadyFuture = sceneIsReady.get_future(); while (sceneIsReadyFuture.wait_for(16ms) != std::future_status::ready) { - update.Finish(); device.FinishRenderingCurrentFrame(); device.StartRenderingCurrentFrame(); - update.Start(); } - update.Finish(); device.FinishRenderingCurrentFrame(); } diff --git a/Apps/UnitTests/Source/Tests.UniformPadding.cpp b/Apps/UnitTests/Source/Tests.UniformPadding.cpp index 164303a76..02ac76fc8 100644 --- a/Apps/UnitTests/Source/Tests.UniformPadding.cpp +++ b/Apps/UnitTests/Source/Tests.UniformPadding.cpp @@ -26,10 +26,8 @@ extern Babylon::Graphics::Configuration g_deviceConfig; TEST(UniformPadding, SubVec4UniformsDoNotOverflow) { Babylon::Graphics::Device device{g_deviceConfig}; - Babylon::Graphics::DeviceUpdate update{device.GetUpdate("update")}; device.StartRenderingCurrentFrame(); - update.Start(); Babylon::AppRuntime::Options options{}; options.UnhandledExceptionHandler = [](const Napi::Error& error) { @@ -102,6 +100,5 @@ TEST(UniformPadding, SubVec4UniformsDoNotOverflow) done.get_future().get(); - update.Finish(); device.FinishRenderingCurrentFrame(); } diff --git a/Core/Graphics/Include/Shared/Babylon/Graphics/Device.h b/Core/Graphics/Include/Shared/Babylon/Graphics/Device.h index 1ad970c89..2066e33a8 100644 --- a/Core/Graphics/Include/Shared/Babylon/Graphics/Device.h +++ b/Core/Graphics/Include/Shared/Babylon/Graphics/Device.h @@ -66,9 +66,16 @@ namespace Babylon::Graphics class DeviceUpdate { public: + [[deprecated("DeviceUpdate is a no-op; frame synchronization is handled by " + "StartRenderingCurrentFrame/FinishRenderingCurrentFrame.")]] void Start() {} + + [[deprecated("DeviceUpdate is a no-op; frame synchronization is handled by " + "StartRenderingCurrentFrame/FinishRenderingCurrentFrame.")]] void Finish() {} + [[deprecated("DeviceUpdate is a no-op; frame synchronization is handled by " + "StartRenderingCurrentFrame/FinishRenderingCurrentFrame.")]] void RequestFinish(std::function onFinishCallback) { onFinishCallback(); @@ -114,6 +121,7 @@ namespace Babylon::Graphics void EnableRendering(); void DisableRendering(); + [[deprecated("DeviceUpdate is a no-op; remove GetUpdate/Start/Finish calls.")]] DeviceUpdate GetUpdate(const char* /*updateName*/) { return {}; } void StartRenderingCurrentFrame();