aboutsummaryrefslogtreecommitdiff
path: root/sway/desktop/render.c
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-01-13 16:13:50 +0100
committerDrew DeVault <sir@cmpwn.com>2020-01-13 12:36:14 -0700
commit679aa6032db5a077b86ecc34ba2a61680a24bcbf (patch)
tree02c1d6546c94f6eedc745b763757a320a1ac2c0d /sway/desktop/render.c
parentc976a149339458799f314fc5af830fbb8d41320a (diff)
Fix unreliable scaling filter
Two changes were made: - Bind the texture before glTexParameteri - Set the scaling filter before each wlr_render_texture_with_matrix call Logging in wlroots allows to check that the scaling filter is properly set prior to rendering. Fixes: 6968fb3123e6 ("add scale_filter output config option") Closes: https://github.com/swaywm/sway/issues/4798
Diffstat (limited to 'sway/desktop/render.c')
-rw-r--r--sway/desktop/render.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sway/desktop/render.c b/sway/desktop/render.c
index 43a12046..477034fc 100644
--- a/sway/desktop/render.c
+++ b/sway/desktop/render.c
@@ -81,6 +81,8 @@ static void set_scale_filter(struct wlr_output *wlr_output,
struct wlr_gles2_texture_attribs attribs;
wlr_gles2_texture_get_attribs(texture, &attribs);
+ glBindTexture(attribs.target, attribs.tex);
+
switch (scale_filter) {
case SCALE_FILTER_LINEAR:
glTexParameteri(attribs.target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -99,6 +101,10 @@ static void render_texture(struct wlr_output *wlr_output,
const struct wlr_box *box, const float matrix[static 9], float alpha) {
struct wlr_renderer *renderer =
wlr_backend_get_renderer(wlr_output->backend);
+ struct sway_output *output = wlr_output->data;
+
+ struct wlr_gles2_texture_attribs attribs;
+ wlr_gles2_texture_get_attribs(texture, &attribs);
pixman_region32_t damage;
pixman_region32_init(&damage);
@@ -114,6 +120,7 @@ static void render_texture(struct wlr_output *wlr_output,
pixman_box32_t *rects = pixman_region32_rectangles(&damage, &nrects);
for (int i = 0; i < nrects; ++i) {
scissor_output(wlr_output, &rects[i]);
+ set_scale_filter(wlr_output, texture, output->scale_filter);
wlr_render_texture_with_matrix(renderer, texture, matrix, alpha);
}
@@ -143,7 +150,6 @@ static void render_surface_iterator(struct sway_output *output, struct sway_view
wlr_matrix_project_box(matrix, &box, transform, rotation,
wlr_output->transform_matrix);
- set_scale_filter(wlr_output, texture, output->scale_filter);
render_texture(wlr_output, output_damage, texture, &box, matrix, alpha);
wlr_presentation_surface_sampled_on_output(server.presentation, surface,
@@ -293,7 +299,6 @@ static void render_saved_view(struct sway_view *view,
wlr_matrix_project_box(matrix, &box, WL_OUTPUT_TRANSFORM_NORMAL, 0,
wlr_output->transform_matrix);
- set_scale_filter(wlr_output, view->saved_buffer->texture, output->scale_filter);
render_texture(wlr_output, damage, view->saved_buffer->texture,
&box, matrix, alpha);