Make GLES2 optional

master
Simon Ser 2 years ago committed by Simon Zeni
parent 456f49db35
commit 5b64e2fc31

@ -43,6 +43,24 @@ subproject(
required: false, required: false,
version: wlroots_version, version: wlroots_version,
) )
wlroots = dependency('wlroots', version: wlroots_version)
wlroots_features = {
'xwayland': false,
'libinput_backend': false,
'gles2_renderer': false,
'session': false,
}
foreach name, _ : wlroots_features
var_name = 'have_' + name.underscorify()
have = wlroots.get_variable(pkgconfig: var_name, internal: var_name) == 'true'
wlroots_features += { name: have }
endforeach
if get_option('xwayland').enabled() and not wlroots_features['xwayland']
error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support')
endif
null_dep = dependency('', required: false)
jsonc = dependency('json-c', version: '>=0.13') jsonc = dependency('json-c', version: '>=0.13')
pcre2 = dependency('libpcre2-8') pcre2 = dependency('libpcre2-8')
@ -50,14 +68,13 @@ wayland_server = dependency('wayland-server', version: '>=1.21.0')
wayland_client = dependency('wayland-client') wayland_client = dependency('wayland-client')
wayland_cursor = dependency('wayland-cursor') wayland_cursor = dependency('wayland-cursor')
wayland_protos = dependency('wayland-protocols', version: '>=1.24') wayland_protos = dependency('wayland-protocols', version: '>=1.24')
wlroots = dependency('wlroots', version: wlroots_version)
xkbcommon = dependency('xkbcommon') xkbcommon = dependency('xkbcommon')
cairo = dependency('cairo') cairo = dependency('cairo')
pango = dependency('pango') pango = dependency('pango')
pangocairo = dependency('pangocairo') pangocairo = dependency('pangocairo')
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf')) gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf'))
pixman = dependency('pixman-1') pixman = dependency('pixman-1')
glesv2 = dependency('glesv2') glesv2 = wlroots_features['gles2_renderer'] ? dependency('glesv2') : null_dep
libevdev = dependency('libevdev') libevdev = dependency('libevdev')
libinput = dependency('libinput', version: '>=1.21.0') libinput = dependency('libinput', version: '>=1.21.0')
xcb = dependency('xcb', required: get_option('xwayland')) xcb = dependency('xcb', required: get_option('xwayland'))
@ -71,18 +88,6 @@ rt = cc.find_library('rt')
xcb_icccm = dependency('xcb-icccm', required: get_option('xwayland')) xcb_icccm = dependency('xcb-icccm', required: get_option('xwayland'))
threads = dependency('threads') # for pthread_setschedparam threads = dependency('threads') # for pthread_setschedparam
wlroots_features = {
'xwayland': false,
}
foreach name, _ : wlroots_features
var_name = 'have_' + name.underscorify()
have = wlroots.get_variable(pkgconfig: var_name, internal: var_name) == 'true'
wlroots_features += { name: have }
endforeach
if get_option('xwayland').enabled() and not wlroots_features['xwayland']
error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support')
endif
have_xwayland = xcb.found() and wlroots_features['xwayland'] have_xwayland = xcb.found() and wlroots_features['xwayland']
if get_option('sd-bus-provider') == 'auto' if get_option('sd-bus-provider') == 'auto'

@ -1,11 +1,10 @@
#define _POSIX_C_SOURCE 200809L #define _POSIX_C_SOURCE 200809L
#include <assert.h> #include <assert.h>
#include <GLES2/gl2.h>
#include <stdlib.h> #include <stdlib.h>
#include <strings.h> #include <strings.h>
#include <time.h> #include <time.h>
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wlr/render/gles2.h> #include <wlr/config.h>
#include <wlr/render/wlr_renderer.h> #include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_buffer.h> #include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_damage_ring.h> #include <wlr/types/wlr_damage_ring.h>
@ -28,6 +27,10 @@
#include "sway/tree/view.h" #include "sway/tree/view.h"
#include "sway/tree/workspace.h" #include "sway/tree/workspace.h"
#if WLR_HAS_GLES2_RENDERER
#include <wlr/render/gles2.h>
#endif
struct render_data { struct render_data {
pixman_region32_t *damage; pixman_region32_t *damage;
float alpha; float alpha;
@ -74,6 +77,7 @@ static void scissor_output(struct wlr_output *wlr_output,
static void set_scale_filter(struct wlr_output *wlr_output, static void set_scale_filter(struct wlr_output *wlr_output,
struct wlr_texture *texture, enum scale_filter_mode scale_filter) { struct wlr_texture *texture, enum scale_filter_mode scale_filter) {
#if WLR_HAS_GLES2_RENDERER
if (!wlr_texture_is_gles2(texture)) { if (!wlr_texture_is_gles2(texture)) {
return; return;
} }
@ -94,6 +98,7 @@ static void set_scale_filter(struct wlr_output *wlr_output,
case SCALE_FILTER_SMART: case SCALE_FILTER_SMART:
assert(false); // unreachable assert(false); // unreachable
} }
#endif
} }
static void render_texture(struct wlr_output *wlr_output, static void render_texture(struct wlr_output *wlr_output,

Loading…
Cancel
Save