Fix SDL2 fallback when no FSAA is available.

On my old laptop, when running "./quakespasm -fsaa 2", quakespasm would error out with a "Couldn't create window" message. Our "no FSAA available" fallback was applied at OpenGL context creation time, but according to the SDL2 wiki FSAA settings should be done before creation of the window (see https://wiki.libsdl.org/SDL_GLattr#multisample). Moved it there.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1084 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Sander van Dijk 2014-10-05 17:06:35 +00:00
parent 4b011d6285
commit f6d44a3a10

View file

@ -502,22 +502,23 @@ static int VID_SetMode (int width, int height, int bpp, qboolean fullscreen)
if (!draw_context)
{
flags = SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN;
draw_context = SDL_CreateWindow (caption, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, flags);
if (!draw_context) { // scale back fsaa
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
draw_context = SDL_CreateWindow (caption, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, flags);
}
if (!draw_context) { // scale back SDL_GL_DEPTH_SIZE
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
draw_context = SDL_CreateWindow (caption, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, flags);
}
if (!draw_context)
Sys_Error ("Couldn't create window");
gl_context = SDL_GL_CreateContext (draw_context);
if (!gl_context) { // scale back fsaa
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
gl_context = SDL_GL_CreateContext (draw_context);
}
if (!gl_context) { // scale back SDL_GL_DEPTH_SIZE
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
gl_context = SDL_GL_CreateContext (draw_context);
if (!gl_context)
Sys_Error ("Couldn't craete GL context");
}
if (!gl_context)
Sys_Error ("Couldn't create GL context");
}
/* Ensure the window is not fullscreen */