wayland: Don't force the window into OpenGL mode if we want Vulkan.

This commit is contained in:
Ryan C. Gordon 2020-02-14 01:08:21 -05:00
parent 14bf532df3
commit 7ad77bccb2

View File

@ -118,7 +118,9 @@ handle_configure_zxdg_shell_surface(void *data, struct zxdg_surface_v6 *zxdg, ui
window->h = wind->resize.height; window->h = wind->resize.height;
wl_surface_set_buffer_scale(wind->surface, get_window_scale_factor(window)); wl_surface_set_buffer_scale(wind->surface, get_window_scale_factor(window));
WAYLAND_wl_egl_window_resize(wind->egl_window, window->w * get_window_scale_factor(window), window->h * get_window_scale_factor(window), 0, 0); if (wind->egl_window) {
WAYLAND_wl_egl_window_resize(wind->egl_window, window->w * get_window_scale_factor(window), window->h * get_window_scale_factor(window), 0, 0);
}
zxdg_surface_v6_ack_configure(zxdg, serial); zxdg_surface_v6_ack_configure(zxdg, serial);
@ -223,7 +225,9 @@ handle_configure_xdg_shell_surface(void *data, struct xdg_surface *xdg, uint32_t
window->h = wind->resize.height; window->h = wind->resize.height;
wl_surface_set_buffer_scale(wind->surface, get_window_scale_factor(window)); wl_surface_set_buffer_scale(wind->surface, get_window_scale_factor(window));
WAYLAND_wl_egl_window_resize(wind->egl_window, window->w * get_window_scale_factor(window), window->h * get_window_scale_factor(window), 0, 0); if (wind->egl_window) {
WAYLAND_wl_egl_window_resize(wind->egl_window, window->w * get_window_scale_factor(window), window->h * get_window_scale_factor(window), 0, 0);
}
xdg_surface_ack_configure(xdg, serial); xdg_surface_ack_configure(xdg, serial);
@ -624,9 +628,11 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
c = _this->driverdata; c = _this->driverdata;
window->driverdata = data; window->driverdata = data;
if (!(window->flags & SDL_WINDOW_OPENGL)) { if (!(window->flags & SDL_WINDOW_VULKAN)) {
SDL_GL_LoadLibrary(NULL); if (!(window->flags & SDL_WINDOW_OPENGL)) {
window->flags |= SDL_WINDOW_OPENGL; SDL_GL_LoadLibrary(NULL);
window->flags |= SDL_WINDOW_OPENGL;
}
} }
if (window->x == SDL_WINDOWPOS_UNDEFINED) { if (window->x == SDL_WINDOWPOS_UNDEFINED) {
@ -690,14 +696,16 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window)
} }
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
data->egl_window = WAYLAND_wl_egl_window_create(data->surface, if (window->flags & SDL_WINDOW_OPENGL) {
data->egl_window = WAYLAND_wl_egl_window_create(data->surface,
window->w * data->scale_factor, window->h * data->scale_factor); window->w * data->scale_factor, window->h * data->scale_factor);
/* Create the GLES window surface */ /* Create the GLES window surface */
data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->egl_window); data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->egl_window);
if (data->egl_surface == EGL_NO_SURFACE) { if (data->egl_surface == EGL_NO_SURFACE) {
return SDL_SetError("failed to create a window surface"); return SDL_SetError("failed to create an EGL window surface");
}
} }
if (c->shell.xdg) { if (c->shell.xdg) {
@ -781,7 +789,10 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window)
struct wl_region *region; struct wl_region *region;
wl_surface_set_buffer_scale(wind->surface, get_window_scale_factor(window)); wl_surface_set_buffer_scale(wind->surface, get_window_scale_factor(window));
WAYLAND_wl_egl_window_resize(wind->egl_window, window->w * get_window_scale_factor(window), window->h * get_window_scale_factor(window), 0, 0);
if (wind->egl_window) {
WAYLAND_wl_egl_window_resize(wind->egl_window, window->w * get_window_scale_factor(window), window->h * get_window_scale_factor(window), 0, 0);
}
region = wl_compositor_create_region(data->compositor); region = wl_compositor_create_region(data->compositor);
wl_region_add(region, 0, 0, window->w, window->h); wl_region_add(region, 0, 0, window->w, window->h);
@ -813,8 +824,12 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window)
SDL_WindowData *wind = window->driverdata; SDL_WindowData *wind = window->driverdata;
if (data) { if (data) {
SDL_EGL_DestroySurface(_this, wind->egl_surface); if (wind->egl_surface) {
WAYLAND_wl_egl_window_destroy(wind->egl_window); SDL_EGL_DestroySurface(_this, wind->egl_surface);
}
if (wind->egl_window) {
WAYLAND_wl_egl_window_destroy(wind->egl_window);
}
if (wind->server_decoration) { if (wind->server_decoration) {
zxdg_toplevel_decoration_v1_destroy(wind->server_decoration); zxdg_toplevel_decoration_v1_destroy(wind->server_decoration);