- destroy SDL window on Vulkan to OpenGL fallback

https://forum.zdoom.org/viewtopic.php?t=64412
This commit is contained in:
alexey.lysiuk 2019-04-23 13:05:33 +03:00
parent 23e2b1c0c0
commit 6b5f7b4763

View file

@ -145,6 +145,14 @@ namespace Priv
}
}
void DestroyWindow()
{
assert(Priv::window != nullptr);
SDL_DestroyWindow(Priv::window);
Priv::window = nullptr;
}
void SetupPixelFormat(int multisample, const int *glver)
{
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
@ -276,6 +284,11 @@ DFrameBuffer *SDLVideo::CreateFrameBuffer ()
}
catch (CRecoverableError const&)
{
if (Priv::window != nullptr)
{
Priv::DestroyWindow();
}
Priv::vulkanEnabled = false;
}
}
@ -428,8 +441,7 @@ SystemGLFrameBuffer::SystemGLFrameBuffer(void *hMonitor, bool fullscreen)
GLContext = SDL_GL_CreateContext(Priv::window);
if (GLContext == nullptr)
{
SDL_DestroyWindow(Priv::window);
Priv::window = nullptr;
Priv::DestroyWindow();
}
else
{
@ -447,8 +459,7 @@ SystemGLFrameBuffer::~SystemGLFrameBuffer ()
SDL_GL_DeleteContext(GLContext);
}
SDL_DestroyWindow(Priv::window);
Priv::window = nullptr;
Priv::DestroyWindow();
}
}