Fix performance issue in Launcher
Bug #3515248
The problem is caused by the fast path when compositing layers on screen.
The fast path draws a single quad using glDrawArrays() whereas the general
path draws an arbitrary mesh using glDrawElements(). It looks like there's
an issue in the driver since glDrawArrays() is significantly slower than
glDrawElements() for a quad (6 vertices!)
This change just gets rid of the fast path.
Change-Id: Ib2361253ec67f44a988270f76c183422f12ce537
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index b8bd7d6..e01e072 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -636,11 +636,13 @@
void OpenGLRenderer::composeLayerRegion(Layer* layer, const Rect& rect) {
#if RENDER_LAYERS_AS_REGIONS
+#if RENDER_LAYERS_RECT_AS_RECT
if (layer->region.isRect()) {
composeLayerRect(layer, rect);
layer->region.clear();
return;
}
+#endif
if (!layer->region.isEmpty()) {
size_t count;
@@ -1646,10 +1648,14 @@
#if RENDER_LAYERS_AS_REGIONS
if (!layer->region.isEmpty()) {
+#if RENDER_LAYERS_RECT_AS_RECT
if (layer->region.isRect()) {
const Rect r(x, y, x + layer->layer.getWidth(), y + layer->layer.getHeight());
composeLayerRect(layer, r);
} else if (layer->mesh) {
+#else
+ if (layer->mesh) {
+#endif
const float a = alpha / 255.0f;
const Rect& rect = layer->layer;