From f087c828cd0c4f58d0b98bdc73061204b831dd0b Mon Sep 17 00:00:00 2001 From: ywen Date: Thu, 28 May 2015 14:10:53 +0800 Subject: Fix a GL error leak issue glFinish() dequeues a native buffer, and it fails when the bufeer has been abandoned, this is ok and will not casue the app crash GL_OUT_OF_MEMORY is generated in this case, and it is not reset until glGetError called. This is happened in build layer function, glGetError is called after glTexImg2d, and get GL_OUT_OF_MEMORY, then this function return as OOM, and app crash Fix it by adding a glGetError after glFinish Change-Id: I8803a726b6f609c4a2f8a6aa6bb7ff7064808932 --- libs/hwui/Caches.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp index cdf81508d7c4..77b66f213712 100644 --- a/libs/hwui/Caches.cpp +++ b/libs/hwui/Caches.cpp @@ -25,6 +25,7 @@ #include "LayerRenderer.h" #include "ShadowTessellator.h" #include "RenderState.h" +#include "utils/GLUtils.h" namespace android { @@ -368,6 +369,12 @@ void Caches::flush(FlushMode mode) { clearGarbage(); glFinish(); + + // glFinish() need dequeue buffer, and it is not 100% success + // It generates gl error sometimes, this error will be there + // until glGetError called. Call GLUtils::dumpGLErrors to clean + // the error in case it leaks to other functions + GLUtils::dumpGLErrors(); } /////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3-59-g8ed1b