From: Andreas Eversberg Date: Mon, 30 Apr 2018 10:07:03 +0000 (+0200) Subject: If SDL window fails, retry without MSAA (multisample antialiasing) X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=mercenary-reloaded.git;a=commitdiff_plain;h=d71d801f2d9881d8e332e77be0fc21fa3045f035 If SDL window fails, retry without MSAA (multisample antialiasing) --- 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; }