mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-10 03:35:32 +00:00
video: check graphics flags the same way in SDL_RecreateWindow as in SDL_CreateWindow
- single check to validate the graphics flags - check it before tearing down the window
This commit is contained in:
parent
eef4d3c86a
commit
dad8df3ed1
|
@ -1874,6 +1874,13 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
||||||
SDL_bool loaded_vulkan = SDL_FALSE;
|
SDL_bool loaded_vulkan = SDL_FALSE;
|
||||||
SDL_bool need_vulkan_unload = SDL_FALSE;
|
SDL_bool need_vulkan_unload = SDL_FALSE;
|
||||||
SDL_bool need_vulkan_load = SDL_FALSE;
|
SDL_bool need_vulkan_load = SDL_FALSE;
|
||||||
|
Uint32 graphics_flags;
|
||||||
|
|
||||||
|
/* ensure no more than one of these flags is set */
|
||||||
|
graphics_flags = flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_METAL | SDL_WINDOW_VULKAN);
|
||||||
|
if ((graphics_flags & (graphics_flags - 1)) != 0) {
|
||||||
|
return SDL_SetError("Conflicting window flags specified");
|
||||||
|
}
|
||||||
|
|
||||||
if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
|
if ((flags & SDL_WINDOW_OPENGL) && !_this->GL_CreateContext) {
|
||||||
return SDL_ContextNotSupported("OpenGL");
|
return SDL_ContextNotSupported("OpenGL");
|
||||||
|
@ -1937,18 +1944,6 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
||||||
need_vulkan_load = SDL_TRUE;
|
need_vulkan_load = SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & SDL_WINDOW_VULKAN) && (flags & SDL_WINDOW_OPENGL)) {
|
|
||||||
return SDL_SetError("Vulkan and OpenGL not supported on same window");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((flags & SDL_WINDOW_METAL) && (flags & SDL_WINDOW_OPENGL)) {
|
|
||||||
return SDL_SetError("Metal and OpenGL not supported on same window");
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((flags & SDL_WINDOW_METAL) && (flags & SDL_WINDOW_VULKAN)) {
|
|
||||||
return SDL_SetError("Metal and Vulkan not supported on same window");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (need_gl_unload) {
|
if (need_gl_unload) {
|
||||||
SDL_GL_UnloadLibrary();
|
SDL_GL_UnloadLibrary();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue