From d71d801f2d9881d8e332e77be0fc21fa3045f035 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Mon, 30 Apr 2018 12:07:03 +0200 Subject: [PATCH] If SDL window fails, retry without MSAA (multisample antialiasing) --- src/libsdl/sdl.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/libsdl/sdl.c b/src/libsdl/sdl.c index 0b17c16..29344cd 100644 --- a/src/libsdl/sdl.c +++ b/src/libsdl/sdl.c @@ -64,6 +64,7 @@ int init_sdl(const char *progname, int width, int height, int sound_samplerate, } sdl_initialized = 1; +retry_without_multisampling: if (multisampling > 1) { SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); @@ -77,7 +78,16 @@ int init_sdl(const char *progname, int width, int height, int sound_samplerate, /* open window */ gl_window = SDL_CreateWindow(progname, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, width, height, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); if (!gl_window) { - print_error("Failed to open SDL window: %s (try without multisampling)\n", SDL_GetError()); + if (multisampling) { + print_info("Failed to open SDL window: %s (retrying without multisampling)\n", SDL_GetError()); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); + multisampling = 0; + goto retry_without_multisampling; + } + print_error("Failed to open SDL window: %s\n", SDL_GetError()); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, multisampling); rc = EIO; goto error; } -- 2.13.6