Fix window handling when switch from gl to soft renderer.

Make sure that the window is destroyed at gl renderer shutdown and
recreated by the soft renderer. Don't deinitialize SDL in the
softrenderer, that's done by vid.c. And make sure that we start the soft
renderer with a clean GL state.
This commit is contained in:
Yamagi Burmeister 2018-08-10 12:19:15 +02:00
parent 9d4df05c22
commit be9942d516
4 changed files with 14 additions and 5 deletions

View file

@ -2074,11 +2074,6 @@ SWimp_Shutdown( void )
{ {
SWimp_DestroyRender(); SWimp_DestroyRender();
if (SDL_WasInit(SDL_INIT_EVERYTHING) == SDL_INIT_VIDEO)
SDL_Quit();
else
SDL_QuitSubSystem(SDL_INIT_VIDEO);
X11_active = false; X11_active = false;
} }

View file

@ -185,6 +185,8 @@ GLimp_Init(void)
void void
GLimp_Shutdown(void) GLimp_Shutdown(void)
{ {
ShutdownGraphics();
if (SDL_WasInit(SDL_INIT_EVERYTHING) == SDL_INIT_VIDEO) if (SDL_WasInit(SDL_INIT_EVERYTHING) == SDL_INIT_VIDEO)
{ {
SDL_Quit(); SDL_Quit();
@ -332,6 +334,16 @@ GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight)
return true; return true;
} }
/*
* Shuts the window down.
*/
void
GLimp_ShutdownGraphics(void)
{
SDL_GL_ResetAttributes();
ShutdownGraphics();
}
/* /*
* (Un)grab Input * (Un)grab Input
*/ */

View file

@ -58,6 +58,7 @@ extern int glimp_refreshRate;
qboolean GLimp_Init(void); qboolean GLimp_Init(void);
void GLimp_Shutdown(void); void GLimp_Shutdown(void);
qboolean GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight); qboolean GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight);
void GLimp_ShutdownGraphics(void);
void GLimp_GrabInput(qboolean grab); void GLimp_GrabInput(qboolean grab);
int GLimp_GetRefreshRate(void); int GLimp_GetRefreshRate(void);

View file

@ -337,6 +337,7 @@ VID_ShutdownRenderer(void)
{ {
/* Shut down the renderer */ /* Shut down the renderer */
re.Shutdown(); re.Shutdown();
GLimp_ShutdownGraphics();
Sys_FreeLibrary(reflib_handle); Sys_FreeLibrary(reflib_handle);
reflib_handle = NULL; reflib_handle = NULL;
memset(&re, 0, sizeof(re)); memset(&re, 0, sizeof(re));