From dd7a38069ffd31a68fa995acae814dff48cdb6a1 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 24 Oct 2023 01:17:43 +0200 Subject: [PATCH 1/2] gl: Remove optimization that does the wrong thing Drawing a texture-scale node like a texture node when the filter is set to "linear" doesn't work, because the texture node switches to trilinear when mipmaps are available. --- gsk/gl/gskglrenderjob.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/gsk/gl/gskglrenderjob.c b/gsk/gl/gskglrenderjob.c index efe6a59850..b7dc7d6a88 100644 --- a/gsk/gl/gskglrenderjob.c +++ b/gsk/gl/gskglrenderjob.c @@ -3784,12 +3784,6 @@ gsk_gl_render_job_visit_texture_scale_node (GskGLRenderJob *job, GskTextureKey key; guint texture_id; - if (filter == GSK_SCALING_FILTER_LINEAR) - { - gsk_gl_render_job_visit_texture (job, texture, bounds); - return; - } - gsk_gl_render_job_untransform_bounds (job, &job->current_clip->rect.bounds, &clip_rect); if (!graphene_rect_intersection (bounds, &clip_rect, &clip_rect)) From c9b83dfa1dc3fe83c570458acb403f1f4485f7c8 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 24 Oct 2023 01:32:46 +0200 Subject: [PATCH 2/2] testsuite: Add a test for texture-scale filters Check that the right filter is chosen and that that filter is implemented correctly. The test is disabled for Cairo because Cairo (or rather Pixman) doesn't follow the filtering specifications for GL/Vulkan and in particular the nearest filter picks a different pixel. --- .../gsk/compare/texture-scale-filters-3d.node | 30 ++++++++++++++++++ .../gsk/compare/texture-scale-filters-3d.png | Bin 0 -> 295 bytes testsuite/gsk/meson.build | 1 + 3 files changed, 31 insertions(+) create mode 100644 testsuite/gsk/compare/texture-scale-filters-3d.node create mode 100644 testsuite/gsk/compare/texture-scale-filters-3d.png diff --git a/testsuite/gsk/compare/texture-scale-filters-3d.node b/testsuite/gsk/compare/texture-scale-filters-3d.node new file mode 100644 index 0000000000..040da4b221 --- /dev/null +++ b/testsuite/gsk/compare/texture-scale-filters-3d.node @@ -0,0 +1,30 @@ +texture-scale { + bounds: 4 4 24 24; + filter: nearest; + texture: "texture1" url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAJ0lEQVQYlWNkYPjwnwEPYMInSbqC\ +AwwCDAcYBPCb4HAAlc9Ie0cCAB8uBo20gfbVAAAAAElFTkSuQmCC\ +"); +} +repeat { + bounds: 32 0 32 32; + child: texture-scale { + bounds: 0 0 1 1; + filter: nearest; + texture: "texture1"; + } +} +repeat { + bounds: 0 32 32 32; + child: texture-scale { + bounds: 0 0 1 1; + texture: "texture1"; + } +} +repeat { + bounds: 32 32 32 32; + child: texture-scale { + bounds: 0 0 1 1; + filter: trilinear; + texture: "texture1"; + } +} diff --git a/testsuite/gsk/compare/texture-scale-filters-3d.png b/testsuite/gsk/compare/texture-scale-filters-3d.png new file mode 100644 index 0000000000000000000000000000000000000000..b3af8ab632e1985b1349d088b0fc83a6ae8e92ee GIT binary patch literal 295 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=?>t=`Ln`LHy>XE9kb?-@!`=u7 zuZ=9XH*tG=@rNa_zjRp7DDL9?iS?fS_BV>wJo*#vF3eo^ZPM-ePoB9eFm7ph_GhO_ z{vY4I!`t5f@BJh^fg#FaG86~fIXriNVI3^J`}K9R^^*jr%y0O_`0p3Xw3y{j58vAU z*8eA`hWvtJle<4H=4cywGi5OP!thUqxtkAceD`+yvOg>;4PqB~zIWU9+>!I&S*r%J eRE