mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
SDL - add SDL_WINDOW_VULKAN and make Android_CreateWindow only create an EGLSurface when SDL_WINDOW_VULKAN is not present. This makes it so the ANativeWindow* can be used with vkCreateAndroidSurfaceKHR, otherwise it will fail because having both an EGLSurface and VkSurfaceKHR attached to a window is not allowed according to the Vulkan spec:
"In particular, only one VkSurfaceKHR can exist at a time for a given window. Similarly, a native window cannot be used by both a VkSurfaceKHR and EGLSurface simultaneously" CR: SamL
This commit is contained in:
parent
a0aff76416
commit
ccf0566ca4
@ -116,7 +116,8 @@ typedef enum
|
|||||||
SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */
|
SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */
|
||||||
SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
|
SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */
|
||||||
SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
|
SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */
|
||||||
SDL_WINDOW_POPUP_MENU = 0x00080000 /**< window should be treated as a popup menu */
|
SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */
|
||||||
|
SDL_WINDOW_VULKAN = 0x00100000 /**< window usable for Vulkan surface */
|
||||||
} SDL_WindowFlags;
|
} SDL_WindowFlags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1321,7 +1321,7 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define CREATE_FLAGS \
|
#define CREATE_FLAGS \
|
||||||
(SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP)
|
(SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN )
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
|
SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
|
||||||
|
@ -70,6 +70,9 @@ Android_CreateWindow(_THIS, SDL_Window * window)
|
|||||||
return SDL_SetError("Could not fetch native window");
|
return SDL_SetError("Could not fetch native window");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Do not create EGLSurface for Vulkan window since it will then make the window
|
||||||
|
incompatible with vkCreateAndroidSurfaceKHR */
|
||||||
|
if ((window->flags & SDL_WINDOW_VULKAN) == 0) {
|
||||||
data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window);
|
data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window);
|
||||||
|
|
||||||
if (data->egl_surface == EGL_NO_SURFACE) {
|
if (data->egl_surface == EGL_NO_SURFACE) {
|
||||||
@ -77,6 +80,7 @@ Android_CreateWindow(_THIS, SDL_Window * window)
|
|||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
return SDL_SetError("Could not create GLES window surface");
|
return SDL_SetError("Could not create GLES window surface");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
window->driverdata = data;
|
window->driverdata = data;
|
||||||
Android_Window = window;
|
Android_Window = window;
|
||||||
|
Loading…
Reference in New Issue
Block a user