mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 20:51:31 +00:00
Fix crash if the requested gl_msaa_samples are unavailable.
For some reasons setting the MSAA fails at window creation and not at GL context creation. And of course SDL is unable to detect before, that the requested number of MSAA samples is invalid... Implement a work around: Fall back to gl_msaa_samples == 0 if the window cannot be created.
This commit is contained in:
parent
a1e93ca647
commit
a47a9daf67
1 changed files with 16 additions and 13 deletions
|
@ -56,6 +56,7 @@ static SDL_Surface* window = NULL;
|
|||
// some compatibility defines
|
||||
#define SDL_SRCCOLORKEY SDL_TRUE
|
||||
#define SDL_FULLSCREEN SDL_WINDOW_FULLSCREEN
|
||||
#define SDL_OPENGL SDL_WINDOW_OPENGL
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -288,11 +289,14 @@ GLimp_InitGraphics(qboolean fullscreen, int *pwidth, int *pheight)
|
|||
SetSDLIcon();
|
||||
#endif
|
||||
|
||||
cvar_t *gl_msaa_samples = Cvar_Get("gl_msaa_samples", "0", CVAR_ARCHIVE);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (!CreateSDLWindow(flags, width, height))
|
||||
{
|
||||
#if 0 // DG: do we really need to do this? it makes things complicated and belongs into ref dll
|
||||
if (flags & SDL_WINDOW_OPENGL)
|
||||
{
|
||||
if (gl_msaa_samples->value)
|
||||
{
|
||||
Com_Printf("SDL SetVideoMode failed: %s\n", SDL_GetError());
|
||||
|
@ -305,9 +309,8 @@ GLimp_InitGraphics(qboolean fullscreen, int *pwidth, int *pheight)
|
|||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
|
||||
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
|
||||
}
|
||||
else
|
||||
#endif // 0
|
||||
if (width != 640 || height != 480 || (flags & SDL_FULLSCREEN))
|
||||
}
|
||||
else if (width != 640 || height != 480 || (flags & SDL_FULLSCREEN))
|
||||
{
|
||||
Com_Printf("SDL SetVideoMode failed: %s\n", SDL_GetError());
|
||||
Com_Printf("Reverting to windowed gl_mode 4 (640x480).\n");
|
||||
|
|
Loading…
Reference in a new issue