summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-01-13 16:13:50 +0100
committerSimon Ser <contact@emersion.fr>2020-01-15 18:01:50 +0100
commit70ea19150a642504f43e8e69c71624914cd80b8d (patch)
treedfae37072bd10800ee2e437dccce746e86a7ed7c
parent230523731d91a4f37a0c52f72d03b86269a8b3fa (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
-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 2e66abd4d..4aa7bd850 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);