sdlayer.cpp: Don't destroy window resouces if switching between software rendering on glsurface and Polymost/Polymer

git-svn-id: https://svn.eduke32.com/eduke32@6938 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
pogokeen 2018-07-14 21:36:34 +00:00
parent a13a8bf579
commit 1b932fddaf
3 changed files with 18 additions and 3 deletions

View file

@ -9941,7 +9941,6 @@ int32_t videoSetGameMode(char davidoption, int32_t daxdim, int32_t daydim, int32
if (videoGetRenderMode() >= REND_POLYMOST)
{
//POGOTODO: if we switch to software & then back to GL, this call tries to delete textures that were already lost from the GL Context deletion
polymost_glreset();
polymost_glinit();
}

View file

@ -171,11 +171,15 @@ void glsurface_destroy()
glDeleteBuffers(1, &quadVertsID);
quadVertsID = 0;
glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);
glDeleteTextures(1, &bufferTexID);
bufferTexID = 0;
glDeleteTextures(1, &paletteTexID);
paletteTexID = 0;
glUseProgram(0);
glDeleteProgram(shaderProgramID);
shaderProgramID = 0;
}

View file

@ -1453,8 +1453,13 @@ int32_t setvideomode_sdlcommon(int32_t *x, int32_t *y, int32_t c, int32_t fs, in
{
if (bpp > 8)
polymost_glreset();
else if (!nogl)
}
if (!nogl)
{
if (bpp == 8)
glsurface_destroy();
if ((fs == fullscreen) && (*x == xres) && (*y == yres) && (bpp != 0) && !videomodereset)
return 0;
}
#endif
@ -1586,7 +1591,14 @@ int32_t videoSetMode(int32_t x, int32_t y, int32_t c, int32_t fs)
int32_t regrab = 0, ret;
ret = setvideomode_sdlcommon(&x, &y, c, fs, &regrab);
if (ret != 1) return ret;
if (ret != 1)
{
if (ret == 0)
{
setvideomode_sdlcommonpost(x, y, c, fs, regrab);
}
return ret;
}
// deinit
destroy_window_resources();