background-content: 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 https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1347
This commit is contained in:
parent
3a474556b8
commit
32dbcd9352
@ -309,7 +309,7 @@ setup_pipeline (MetaBackgroundContent *self,
|
||||
guint8 opacity;
|
||||
float color_component;
|
||||
CoglFramebuffer *fb;
|
||||
CoglPipelineFilter filter;
|
||||
CoglPipelineFilter min_filter, mag_filter;
|
||||
|
||||
opacity = clutter_actor_get_paint_opacity (actor);
|
||||
if (opacity < 255)
|
||||
@ -408,11 +408,17 @@ setup_pipeline (MetaBackgroundContent *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