sidneytowers Posted September 23 Posted September 23 This is an issue with DirectX12 and Vulkan only, presumably due to their multi-threaded rendering implementation. With the following code within the main function, the engine properly resets with DirectX11, but crashes for both DirectX12 and Vulkan, but with different crash errors as can be seen after the main code in this post. As hinted at, these kinds of crashes or freezes do not occur with DirectX11, which restarts as it should. // const Engine::InitParameters init_parameters; // UnigineLogic AppSystemLogic system_logic; AppWorldLogic world_logic; AppEditorLogic editor_logic; // init engine Unigine::EnginePtr engine(init_parameters, argc, argv); // RestartEngine: // enter main loop engine->main(&system_logic, &world_logic, &editor_logic); // if (IsResetting) { IsResetting = false; engine.shutdown(); engine.init(init_parameters, argc, argv); goto RestartEngine; } // return 0; Vulkan: Assertion failed: index < size_t(length) && "Vector::operator[]: bad index", file D:\BA\work\fb3821776bc41fe5\include\UnigineVector.h, line 1085 DirectX12: Usually freezes, but occasionly crashes with the following error instead: Unhandled exception (Access Violation Executing Location 0x00000245C7A42840) thrown in RenderShadows::CPUShaderRenderShadowsAsync::process(int thred_num, int threds_count) Line 2271
silent Posted September 23 Posted September 23 Hi Sidney, We will assess our options here; however, generally speaking, we no longer wish to support multiple engine initialization and shutdowns due to the complex logic involved in resource management and the lengthy shutdown times. Additionally, the DX12 and Vulkan APIs introduce significant complexity compared to DX11 to this process. Instead, we recommend loading the engine once and then simply performing a world load/quit if necessary. You can also use the `memory_clear` in between to free some free up. Although, if that approach does not meet your needs, we would appreciate hearing the specific use case in which multiple initializations are necessary and what kind of features are still missing that not allowing you to run the engine once. Perhaps we can enhance the engine's behavior in this regard as well. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
sidneytowers Posted September 23 Author Posted September 23 Completely understandable. Currently developing a settings menu system for my game and wanted to have the availability to swap between RHIs for the Windows build, given that it can support, DX11, DX12, and Vulkan, though it is fine to leave out such functionality given its minute use-case. An important instance that I have found so far, though, is the ability to swap which graphics card of the user's the engine is utilizing for rendering via the video_adapter command. This command seems to require the entire program to restart, but I wish to support this functionality without making the process inconvenient for the user. These are the only two issues requiring a restart that I have found so far (unsure if i'll run into more) and can completely push this off on the user to just restart the game manually if they've changed, but would prefer not to if possible. Regardless, thank you for your time.
silent Posted September 23 Posted September 23 Yes, regarding the changes to the graphical API, I believe the only proper approach is to save the user input in the configuration and perform a full application restart. We attempted to implement this functionality on the fly, but encountered numerous unexpected issues, including GPU driver crashes and complete operating system hangs. The engine itself attempts to operate on the most powerful device available by default. The case of GPU changing on-fly is also a quite challenging task. However, I believe this could also be addressed through a launcher that appears during the initial game startup or through user input that requires a restart within the game. How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Recommended Posts