mac/iOS: allow Metal in windows created without an explicit backend

Fixes SDL_CreateWindowAndRenderer (and similar situations) not choosing a Metal backend. See #3991.

Passing an explicit backend into CreateWindow, eg SDL_WINDOW_OPENGL or SDL_WINDOW_METAL, will still prevent the window from being used with other backend types.
This commit is contained in:
Alex Szpakowski
2021-02-15 11:49:09 -04:00
committed by Sam Lantinga
parent 9c1871c144
commit 9b9d0d484d
2 changed files with 13 additions and 11 deletions

View File

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