mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
background-actor: Mipmap background texture rendering
gnome-shell displays workspace previews at one tenth scale. That's a
few binary orders of magnitude so even using a LINEAR filter was
resulting in visible jaggies. Now we apply mipmapping so they appear
smooth.
As an added bonus, the mipmaps used occupy roughly 1% the memory of
the original image (0.1 x 0.1 = 0.01) so they actually fit into GPU/CPU
caches now and rendering performance is improved. There's no need to
traverse the original texture which at 4K resolution occupies 33MB,
only a 331KB mipmap.
In my case this reduces the render time for the overview by ~10%.
Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/1416
Origin: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1347
(cherry picked from commit 32dbcd9352
)
This commit is contained in:
parent
eae21f01dd
commit
3dab5120ed
@ -354,7 +354,7 @@ setup_pipeline (MetaBackgroundActor *self,
|
||||
guint8 opacity;
|
||||
float color_component;
|
||||
CoglFramebuffer *fb;
|
||||
CoglPipelineFilter filter;
|
||||
CoglPipelineFilter min_filter, mag_filter;
|
||||
|
||||
opacity = clutter_actor_get_paint_opacity (CLUTTER_ACTOR (self));
|
||||
if (opacity < 255)
|
||||
@ -455,11 +455,17 @@ setup_pipeline (MetaBackgroundActor *self,
|
||||
actor_pixel_rect->width,
|
||||
actor_pixel_rect->height,
|
||||
NULL, NULL))
|
||||
filter = COGL_PIPELINE_FILTER_NEAREST;
|
||||
{
|
||||
min_filter = COGL_PIPELINE_FILTER_NEAREST;
|
||||
mag_filter = COGL_PIPELINE_FILTER_NEAREST;
|
||||
}
|
||||
else
|
||||
filter = COGL_PIPELINE_FILTER_LINEAR;
|
||||
{
|
||||
min_filter = COGL_PIPELINE_FILTER_LINEAR_MIPMAP_NEAREST;
|
||||
mag_filter = COGL_PIPELINE_FILTER_LINEAR;
|
||||
}
|
||||
|
||||
cogl_pipeline_set_layer_filters (self->pipeline, 0, filter, filter);
|
||||
cogl_pipeline_set_layer_filters (self->pipeline, 0, min_filter, mag_filter);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user