diff options
author | 2022-03-16 03:32:33 +0100 | |
---|---|---|
committer | 2022-03-15 22:32:33 -0400 | |
commit | 92ece92fedb15efa82a12901bc343b46a0f06905 (patch) | |
tree | dc16d467c041bb86470b409111d156ef803b73d3 /src/osd/sdl/window.cpp | |
parent | 8d267ad2c7d3e757bf47d05ce816e060e37de401 (diff) |
Updated BGFX fixes; verified as working on Linux and Windows. (#9420)
* -bgfx: Improved stability when encountering missing files, and improved multi-window stability. [Ryan Holtz]
* -osd: Added video-init fallback functionality to other OSDs. [Ryan Holtz]
* -bgfx: Fixed issues from the previous batch of changes. [Ryan Holtz]
* -osdwindow: Remove no-longer-needed addition of post_create(). [Ryan Holtz]
Diffstat (limited to 'src/osd/sdl/window.cpp')
-rw-r--r-- | src/osd/sdl/window.cpp | 54 |
1 files changed, 41 insertions, 13 deletions
diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index 17e10f575dd..12dbae4f6e9 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -92,25 +92,53 @@ bool sdl_osd_interface::window_init() { osd_printf_verbose("Enter sdlwindow_init\n"); - // initialize the drawers + // initialize the renderer + const int fallbacks[VIDEO_MODE_COUNT] = { + -1, // NONE -> no fallback + -1, // No GDI on Linux + VIDEO_MODE_OPENGL, // BGFX -> OpenGL +#if (USE_OPENGL) + VIDEO_MODE_SDL2ACCEL, // OpenGL -> SDL2Accel +#endif + -1, // SDL2ACCEL -> SOFT + -1, // No D3D on Linux + -1, // SOFT -> no fallback + }; - switch (video_config.mode) + int current_mode = video_config.mode; + while (current_mode != VIDEO_MODE_NONE) { - case VIDEO_MODE_BGFX: - renderer_bgfx::init(machine()); - break; + bool error = false; + switch(current_mode) + { + case VIDEO_MODE_BGFX: + renderer_bgfx::init(machine()); + break; #if (USE_OPENGL) - case VIDEO_MODE_OPENGL: - renderer_ogl::init(machine()); - break; + case VIDEO_MODE_OPENGL: + renderer_ogl::init(machine()); + break; #endif - case VIDEO_MODE_SDL2ACCEL: - renderer_sdl2::init(machine()); - break; - case VIDEO_MODE_SOFT: - renderer_sdl1::init(machine()); + case VIDEO_MODE_SDL2ACCEL: + renderer_sdl2::init(machine()); + break; + case VIDEO_MODE_SOFT: + renderer_sdl1::init(machine()); + break; + default: + fatalerror("Unknown video mode."); + break; + } + if (error) + { + current_mode = fallbacks[current_mode]; + } + else + { break; + } } + video_config.mode = current_mode; /* We may want to set a number of the hints SDL2 provides. * The code below will document which hints were set. |