mirror of https://github.com/libsdl-org/SDL
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 need_vulkan_unload = 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) {
|
||||
return SDL_ContextNotSupported("OpenGL");
|
||||
|
@ -1937,18 +1944,6 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags)
|
|||
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) {
|
||||
SDL_GL_UnloadLibrary();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue