RobertBeckebans / RBDOOM-3-BFG

Doom 3 BFG Edition source port with updated DX12 / Vulkan renderer and modern game engine features
https://www.moddb.com/mods/rbdoom-3-bfg
GNU General Public License v3.0
1.37k stars 244 forks source link

Game startup and shutdown fixes #849

Open SRSaunders opened 3 months ago

SRSaunders commented 3 months ago

Possibly fixes #844, but not yet confirmed.

I have decided to push this anyways since it fixes known issues with game startup and shutdown:

  1. Windows only: Fixes issues for non-contiguous display numbers caused by having multiple display adaptors installed with active desktop monitors plugged into each one. This can result in display numbering gaps representing unused outputs on the display cards (or even internal iGPUs). Allows display selection menu to work properly in this circumstance. Also removes assumption that display 1 is always defined and available. Not an issue with a single display adaptor with multiple monitors on Windows, or with any combo for SDL on Linux or macOS.
  2. Windows only: Fixes edge conditions with determining the pimary display and the maximum display number. Added code to fall back to minimum active display if primary display not found. According to Windows forums this can happen rarely on some PC configs, and could result in startup failures in windowed-mode with previous code.
  3. Windows only: Moved display mode reset code from DestroyDeviceAndSwapChain() to GLimp_Shutdown() for better error recovery. Windowing shutdown code retained in DestroyDeviceAndSwapChain().
  4. Windows only: Removed and/or commented out some redundant/unused code in DeviceManager_DX12.cpp
  5. All Platforms: Made safeMode more robust for startup display mode selection and error recovery.
  6. All Platforms: Fixed Shutdown() code to wait on nvrhi device idle vs. GL_BlockingSwapBuffers() which was an OpenGL holdover. Waiting on device idle is more robust for slow renderers which otherwise can complain about vertexCache.Shutdown() causing missing resources if queues are not empty and rendering is not completely finished.
  7. All Platforms: Fixed a bunch of status and error messages to be more relevant to the nvrhi code base vs. OpenGL.