summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Lin <danny@kdrag0n.dev>2021-04-11 16:35:08 -0700
committeralk3pInjection <webmaster@raspii.tech>2021-09-27 21:17:05 +0800
commit6b847185514d3e2de01aa0cf6b0f91f47da05f9f (patch)
tree2c94f750435fe2f9703c68c4d4d3a34de1d77e5e
parente7648d1a6ccb4ac73c10a95495c4e7603bcfe888 (diff)
[ProtonAOSP] blur: Limit blur to the two frontmost layers
Rendering 3 or more layers of blur on top of each other makes little to no visual difference in the final result, but it comes at a big performance penalty. Only blurring the two frontmost layers saves a lot of GPU time with minimal difference in output quality. Change-Id: I9ec8129751a183db00ad200080207434f086a63e
-rw-r--r--libs/renderengine/gl/GLESRenderEngine.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/renderengine/gl/GLESRenderEngine.cpp b/libs/renderengine/gl/GLESRenderEngine.cpp
index 0285c2f6f0..04568de87b 100644
--- a/libs/renderengine/gl/GLESRenderEngine.cpp
+++ b/libs/renderengine/gl/GLESRenderEngine.cpp
@@ -1062,6 +1062,14 @@ status_t GLESRenderEngine::drawLayers(const DisplaySettings& display,
}
}
}
+
+ // Limit blur to the two frontmost layers for performance. We need one at the front
+ // and one behind for cross-fading and additional blurring. Rendering additional layers
+ // comes at a big performance penalty and makes little to no noticeable difference.
+ while (blurLayers.size() > 2) {
+ blurLayers.pop_front();
+ }
+
const auto blurLayersSize = blurLayers.size();
if (blurLayersSize == 0) {