diff options
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. |