aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-06-19 13:05:12 -0400
committerSimon Ser <contact@emersion.fr>2023-06-19 19:14:28 +0200
commit876687000d4de503cdb01fcd8fa14f1b05dd9a1e (patch)
treeb438f8aa15357a0a4123769f9b8207278636f94b
parentc08762901e9840d8dca008dcc8d0b5602602fd0a (diff)
render: Use wlroots scale filter
-rw-r--r--meson.build2
-rw-r--r--sway/desktop/render.c33
-rw-r--r--sway/meson.build1
3 files changed, 7 insertions, 29 deletions
diff --git a/meson.build b/meson.build
index 559ee962..eeee39cd 100644
--- a/meson.build
+++ b/meson.build
@@ -48,7 +48,6 @@ wlroots = dependency('wlroots', version: wlroots_version)
wlroots_features = {
'xwayland': false,
'libinput_backend': false,
- 'gles2_renderer': false,
'session': false,
}
foreach name, _ : wlroots_features
@@ -75,7 +74,6 @@ pango = dependency('pango')
pangocairo = dependency('pangocairo')
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf'))
pixman = dependency('pixman-1')
-glesv2 = wlroots_features['gles2_renderer'] ? dependency('glesv2') : null_dep
libevdev = dependency('libevdev')
libinput = wlroots_features['libinput_backend'] ? dependency('libinput', version: '>=1.21.0') : null_dep
xcb = dependency('xcb', required: get_option('xwayland'))
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index 21014042..f08e2c6c 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -27,10 +27,6 @@
#include "sway/tree/view.h"
#include "sway/tree/workspace.h"
-#if WLR_HAS_GLES2_RENDERER
-#include <wlr/render/gles2.h>
-#endif
-
struct render_data {
struct render_context *ctx;
const pixman_region32_t *damage;
@@ -71,30 +67,15 @@ static int scale_length(int length, int offset, float scale) {
return roundf((offset + length) * scale) - roundf(offset * scale);
}
-static void set_scale_filter(struct wlr_output *wlr_output,
- struct wlr_texture *texture, enum scale_filter_mode scale_filter) {
-#if WLR_HAS_GLES2_RENDERER
- if (!wlr_texture_is_gles2(texture)) {
- return;
- }
-
- struct wlr_gles2_texture_attribs attribs;
- wlr_gles2_texture_get_attribs(texture, &attribs);
-
- glBindTexture(attribs.target, attribs.tex);
-
- switch (scale_filter) {
+static enum wlr_scale_filter_mode get_scale_filter(struct sway_output *output) {
+ switch (output->scale_filter) {
case SCALE_FILTER_LINEAR:
- glTexParameteri(attribs.target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- break;
+ return WLR_SCALE_FILTER_BILINEAR;
case SCALE_FILTER_NEAREST:
- glTexParameteri(attribs.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- break;
- case SCALE_FILTER_DEFAULT:
- case SCALE_FILTER_SMART:
- assert(false); // unreachable
+ return WLR_SCALE_FILTER_NEAREST;
+ default:
+ abort(); // unreachable
}
-#endif
}
static void render_texture(struct render_context *ctx, struct wlr_texture *texture,
@@ -128,7 +109,6 @@ static void render_texture(struct render_context *ctx, struct wlr_texture *textu
transform_output_damage(&damage, output->wlr_output);
transform = wlr_output_transform_compose(transform, output->wlr_output->transform);
- set_scale_filter(output->wlr_output, texture, output->scale_filter);
wlr_render_pass_add_texture(ctx->pass, &(struct wlr_render_texture_options) {
.texture = texture,
.src_box = src_box,
@@ -136,6 +116,7 @@ static void render_texture(struct render_context *ctx, struct wlr_texture *textu
.transform = transform,
.alpha = &alpha,
.clip = &damage,
+ .filter_mode = get_scale_filter(output),
});
damage_finish:
diff --git a/sway/meson.build b/sway/meson.build
index bc193bf9..3abd778d 100644
--- a/sway/meson.build
+++ b/sway/meson.build
@@ -223,7 +223,6 @@ sway_deps = [
math,
pango,
pcre2,
- glesv2,
pixman,
threads,
wayland_server,