From 4b8798a80098e568c2717814cad9599e8e3ad2c8 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Tue, 19 Dec 2023 19:25:00 +0100 Subject: [PATCH] shaped-texture: Don't use mipmaps for small textures Mipmapping extremely small textures is pointless. We chose a lower limit of 8 pixels in each direction. Part-of: --- src/compositor/meta-shaped-texture.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c index 345c20c1e..9f4e4cee0 100644 --- a/src/compositor/meta-shaped-texture.c +++ b/src/compositor/meta-shaped-texture.c @@ -640,6 +640,7 @@ do_paint_content (MetaShapedTexture *stex, MetaMultiTexture *paint_tex = stex->texture; CoglFramebuffer *framebuffer; int sample_width, sample_height; + int texture_width, texture_height; gboolean debug_paint_opaque_region; int n_planes; @@ -651,6 +652,9 @@ do_paint_content (MetaShapedTexture *stex, if (dst_width == 0 || dst_height == 0) /* no contents yet */ return; + texture_width = meta_multi_texture_get_width (stex->texture); + texture_height = meta_multi_texture_get_height (stex->texture); + content_rect = (MtkRectangle) { .x = 0, .y = 0, @@ -676,8 +680,8 @@ do_paint_content (MetaShapedTexture *stex, } else { - sample_width = meta_multi_texture_get_width (stex->texture); - sample_height = meta_multi_texture_get_height (stex->texture); + sample_width = texture_width; + sample_height = texture_height; } if (meta_monitor_transform_is_rotated (stex->transform)) flip_ints (&sample_width, &sample_height); @@ -702,7 +706,9 @@ do_paint_content (MetaShapedTexture *stex, */ if (stex->create_mipmaps && transforms.x_scale < 0.5 && - transforms.y_scale < 0.5) + transforms.y_scale < 0.5 && + texture_width >= 8 && + texture_height >= 8) { paint_tex = meta_texture_mipmap_get_paint_texture (stex->texture_mipmap); min_filter = COGL_PIPELINE_FILTER_LINEAR_MIPMAP_NEAREST;