Add shutdown command again

This commit is contained in:
Jupeyy 2020-09-03 11:43:32 +02:00
parent 49d2e36e26
commit 6b3ad82786

View file

@ -2371,15 +2371,34 @@ void CCommandProcessorFragment_OpenGL3_3::Cmd_Init(const SCommand_Init *pCommand
void CCommandProcessorFragment_OpenGL3_3::Cmd_Shutdown(const SCommand_Shutdown *pCommand)
{
glUseProgram(0);
m_pPrimitiveProgram->DeleteProgram();
m_pBorderTileProgram->DeleteProgram();
m_pBorderTileProgramTextured->DeleteProgram();
m_pBorderTileLineProgram->DeleteProgram();
m_pBorderTileLineProgramTextured->DeleteProgram();
m_pQuadProgram->DeleteProgram();
m_pQuadProgramTextured->DeleteProgram();
m_pTileProgram->DeleteProgram();
m_pTileProgramTextured->DeleteProgram();
m_pTextProgram->DeleteProgram();
m_pSpriteProgram->DeleteProgram();
m_pSpriteProgramMultiple->DeleteProgram();
//clean up everything
delete m_pPrimitiveProgram;
//delete m_QuadProgram;
delete m_pTileProgram;
delete m_pTileProgramTextured;
delete m_pBorderTileProgram;
delete m_pBorderTileProgramTextured;
delete m_pBorderTileLineProgram;
delete m_pBorderTileLineProgramTextured;
delete m_pQuadProgram;
delete m_pQuadProgramTextured;
delete m_pTileProgram;
delete m_pTileProgramTextured;
delete m_pTextProgram;
delete m_pSpriteProgram;
delete m_pSpriteProgramMultiple;
glBindVertexArray(0);
glDeleteBuffers(MAX_STREAM_BUFFER_COUNT, m_PrimitiveDrawBufferID);
@ -4274,6 +4293,12 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt
if(InitError == -2)
{
CCommandProcessorFragment_OpenGL::SCommand_Shutdown CmdGL;
CmdBuffer.AddCommand(CmdGL);
RunBuffer(&CmdBuffer);
WaitForIdle();
CmdBuffer.Reset();
g_Config.m_GfxOpenGLMajor = 1;
g_Config.m_GfxOpenGLMinor = 5;
g_Config.m_GfxOpenGLPatch = 0;
@ -4346,6 +4371,12 @@ int CGraphicsBackend_SDL_OpenGL::Shutdown()
{
// issue a shutdown command
CCommandBuffer CmdBuffer(1024, 512);
CCommandProcessorFragment_OpenGL::SCommand_Shutdown CmdGL;
CmdBuffer.AddCommand(CmdGL);
RunBuffer(&CmdBuffer);
WaitForIdle();
CmdBuffer.Reset();
CCommandProcessorFragment_SDL::SCommand_Shutdown Cmd;
CmdBuffer.AddCommand(Cmd);
RunBuffer(&CmdBuffer);