SDL Renderer: specify the correct flag when recreating the window

This commit is contained in:
Sylvain Becker 2020-12-02 13:45:24 +01:00
parent 035f8f2391
commit 754286c61c
4 changed files with 5 additions and 5 deletions

View File

@ -1640,7 +1640,7 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
window_flags = SDL_GetWindowFlags(window); window_flags = SDL_GetWindowFlags(window);
if (!(window_flags & SDL_WINDOW_METAL)) { if (!(window_flags & SDL_WINDOW_METAL)) {
changed_window = SDL_TRUE; changed_window = SDL_TRUE;
if (SDL_RecreateWindow(window, (window_flags & ~SDL_WINDOW_OPENGL) | SDL_WINDOW_METAL) < 0) { if (SDL_RecreateWindow(window, (window_flags & ~(SDL_WINDOW_VULKAN | SDL_WINDOW_OPENGL)) | SDL_WINDOW_METAL) < 0) {
return NULL; return NULL;
} }
} }

View File

@ -1545,7 +1545,7 @@ GL_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture)
} }
SDL_Renderer * static SDL_Renderer *
GL_CreateRenderer(SDL_Window * window, Uint32 flags) GL_CreateRenderer(SDL_Window * window, Uint32 flags)
{ {
SDL_Renderer *renderer; SDL_Renderer *renderer;
@ -1568,7 +1568,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, RENDERER_CONTEXT_MAJOR); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, RENDERER_CONTEXT_MAJOR);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, RENDERER_CONTEXT_MINOR); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, RENDERER_CONTEXT_MINOR);
if (SDL_RecreateWindow(window, window_flags | SDL_WINDOW_OPENGL) < 0) { if (SDL_RecreateWindow(window, (window_flags & ~(SDL_WINDOW_VULKAN | SDL_WINDOW_METAL)) | SDL_WINDOW_OPENGL) < 0) {
goto error; goto error;
} }
} }

View File

@ -1165,7 +1165,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, RENDERER_CONTEXT_MAJOR); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, RENDERER_CONTEXT_MAJOR);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, RENDERER_CONTEXT_MINOR); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, RENDERER_CONTEXT_MINOR);
if (SDL_RecreateWindow(window, window_flags | SDL_WINDOW_OPENGL) < 0) { if (SDL_RecreateWindow(window, (window_flags & ~(SDL_WINDOW_VULKAN | SDL_WINDOW_METAL)) | SDL_WINDOW_OPENGL) < 0) {
goto error; goto error;
} }
} }

View File

@ -2012,7 +2012,7 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, RENDERER_CONTEXT_MAJOR); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, RENDERER_CONTEXT_MAJOR);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, RENDERER_CONTEXT_MINOR); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, RENDERER_CONTEXT_MINOR);
if (SDL_RecreateWindow(window, window_flags | SDL_WINDOW_OPENGL) < 0) { if (SDL_RecreateWindow(window, (window_flags & ~(SDL_WINDOW_VULKAN | SDL_WINDOW_METAL)) | SDL_WINDOW_OPENGL) < 0) {
goto error; goto error;
} }
} }