mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
shaped-texture: Use the REPLACE combine function on opaque areas
We were setting the pipeline colour to all white (1.0, 1.0, 1.0, 1.0)
and so the default layer combine function multiplied each pixel
(R, G, B, A) by all ones. Obviously multiplying by one four times per
pixel is a waste of effort so we remove the colour setting *and* set
the layer combine function to a trivial shader that will ignore whatever
the current pipeline colour is set to. So now we do **zero** multiplies
per pixel.
On an i7-7700 at UHD 3840x2160 this results in 5% faster render times
and 10% lower power usage (says intel_gpu_top). The benefit is probably
much higher for virtual machines though, as they're no longer being
asked to do CPU-based math on every pixel of a window.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1331
(cherry picked from commit e5542c3210
)
This commit is contained in:
parent
36a6235f3a
commit
3a70ba7ae2
@ -403,17 +403,14 @@ get_unblended_pipeline (MetaShapedTexture *stex,
|
|||||||
CoglContext *ctx)
|
CoglContext *ctx)
|
||||||
{
|
{
|
||||||
CoglPipeline *pipeline;
|
CoglPipeline *pipeline;
|
||||||
CoglColor color;
|
|
||||||
|
|
||||||
if (stex->unblended_pipeline)
|
if (stex->unblended_pipeline)
|
||||||
return stex->unblended_pipeline;
|
return stex->unblended_pipeline;
|
||||||
|
|
||||||
pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
|
pipeline = cogl_pipeline_copy (get_base_pipeline (stex, ctx));
|
||||||
cogl_color_init_from_4ub (&color, 255, 255, 255, 255);
|
cogl_pipeline_set_layer_combine (pipeline, 0,
|
||||||
cogl_pipeline_set_blend (pipeline,
|
"RGBA = REPLACE (TEXTURE)",
|
||||||
"RGBA = ADD (SRC_COLOR, 0)",
|
|
||||||
NULL);
|
NULL);
|
||||||
cogl_pipeline_set_color (pipeline, &color);
|
|
||||||
|
|
||||||
stex->unblended_pipeline = pipeline;
|
stex->unblended_pipeline = pipeline;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user