From fdc880671fd0b7225a332717fdaafc835f285878 Mon Sep 17 00:00:00 2001 From: Xottab-DUTY Date: Fri, 27 Dec 2024 12:29:43 +0300 Subject: [PATCH] Sanity: initialize renderer list in the main thread It turned out that it crashes sometimes on some systems. (two users with AMD CPU and Nvidia RTX GPU reported the same crash) This reverts commit 5673c5568b54c175371d83771a6bc2fdf86192e4 --- src/xrEngine/Engine.cpp | 1 + src/xrEngine/EngineAPI.h | 2 +- src/xrEngine/x_ray.cpp | 12 ------------ 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/xrEngine/Engine.cpp b/src/xrEngine/Engine.cpp index 277b90bba4c..85db38de84e 100644 --- a/src/xrEngine/Engine.cpp +++ b/src/xrEngine/Engine.cpp @@ -75,6 +75,7 @@ void CEngine::Initialize(GameModule* game) Device.seqFrame.Add(&g_sound_processor, REG_PRIORITY_NORMAL - 1000); // Place it after Level update Device.seqFrameMT.Add(&g_sound_renderer); + External.CreateRendererList(); CheckAndSetupRenderer(); External.Initialize(game); diff --git a/src/xrEngine/EngineAPI.h b/src/xrEngine/EngineAPI.h index d3e6416a9a5..09e79f5ae90 100644 --- a/src/xrEngine/EngineAPI.h +++ b/src/xrEngine/EngineAPI.h @@ -76,7 +76,7 @@ class ENGINE_API CEngineAPI CEngineAPI(); ~CEngineAPI(); - void CreateRendererList(); + void CreateRendererList(); // Better to call it in the main thread void Initialize(GameModule* game); void Destroy(); }; diff --git a/src/xrEngine/x_ray.cpp b/src/xrEngine/x_ray.cpp index 6234230f59b..0396687ee35 100644 --- a/src/xrEngine/x_ray.cpp +++ b/src/xrEngine/x_ray.cpp @@ -240,13 +240,6 @@ CApplication::CApplication(pcstr commandLine, GameModule* game) Engine.Sound.CreateDevicesList(); }); -#ifdef XR_PLATFORM_WINDOWS - const auto& createRendererList = TaskManager::AddTask([] - { - Engine.External.CreateRendererList(); - }); -#endif - pcstr fsltx = "-fsltx "; string_path fsgame = ""; if (strstr(commandLine, fsltx)) @@ -270,11 +263,6 @@ CApplication::CApplication(pcstr commandLine, GameModule* game) TaskScheduler->Wait(inputTask); InitConsole(); -#ifdef XR_PLATFORM_WINDOWS - TaskScheduler->Wait(createRendererList); -#else - Engine.External.CreateRendererList(); -#endif Engine.Initialize(game); Device.Initialize();