diff options
author | Chris Craik <ccraik@google.com> | 2015-06-23 18:01:00 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-06-23 18:01:02 +0000 |
commit | 0d99d43e819c90f009077b234572e353f2e453fa (patch) | |
tree | 34d8b3350ad51d202ada468e7f7737d5069603fe /libs/hwui | |
parent | ff0924c72dabc7072cd85a76a5b26f097107146c (diff) | |
parent | 5686bae28926dae6e4b4d380d75d18e77335c9d3 (diff) | |
download | frameworks_base-0d99d43e819c90f009077b234572e353f2e453fa.zip frameworks_base-0d99d43e819c90f009077b234572e353f2e453fa.tar.gz frameworks_base-0d99d43e819c90f009077b234572e353f2e453fa.tar.bz2 |
Merge "Dump GL errors and crash on failure to allocate texture for layer" into mnc-dev
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/LayerRenderer.cpp | 9 | ||||
-rw-r--r-- | libs/hwui/utils/GLUtils.cpp | 7 | ||||
-rw-r--r-- | libs/hwui/utils/GLUtils.h | 5 |
3 files changed, 10 insertions, 11 deletions
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp index d9b40ae..00add29 100644 --- a/libs/hwui/LayerRenderer.cpp +++ b/libs/hwui/LayerRenderer.cpp @@ -14,15 +14,13 @@ * limitations under the License. */ -#define LOG_TAG "OpenGLRenderer" -#define ATRACE_TAG ATRACE_TAG_VIEW - #include "LayerCache.h" #include "LayerRenderer.h" #include "Matrix.h" #include "Properties.h" #include "Rect.h" #include "renderstate/RenderState.h" +#include "utils/GLUtils.h" #include "utils/TraceUtils.h" #include <ui/Rect.h> @@ -238,8 +236,9 @@ Layer* LayerRenderer::createRenderLayer(RenderState& renderState, uint32_t width layer->allocateTexture(); // This should only happen if we run out of memory - if (glGetError() != GL_NO_ERROR) { - ALOGE("Could not allocate texture for layer (fbo=%d %dx%d)", fbo, width, height); + if (CC_UNLIKELY(GLUtils::dumpGLErrors())) { + LOG_ALWAYS_FATAL("Could not allocate texture for layer (fbo=%d %dx%d)", + fbo, width, height); renderState.bindFramebuffer(previousFbo); layer->decStrong(nullptr); return nullptr; diff --git a/libs/hwui/utils/GLUtils.cpp b/libs/hwui/utils/GLUtils.cpp index 9b298ca..55104de 100644 --- a/libs/hwui/utils/GLUtils.cpp +++ b/libs/hwui/utils/GLUtils.cpp @@ -14,8 +14,6 @@ * limitations under the License. */ -#define LOG_TAG "OpenGLRenderer" - #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> @@ -26,9 +24,11 @@ namespace android { namespace uirenderer { -void GLUtils::dumpGLErrors() { +bool GLUtils::dumpGLErrors() { + bool errorObserved = false; GLenum status = GL_NO_ERROR; while ((status = glGetError()) != GL_NO_ERROR) { + errorObserved = true; switch (status) { case GL_INVALID_ENUM: ALOGE("GL error: GL_INVALID_ENUM"); @@ -46,6 +46,7 @@ void GLUtils::dumpGLErrors() { ALOGE("GL error: 0x%x", status); } } + return errorObserved; } }; // namespace uirenderer diff --git a/libs/hwui/utils/GLUtils.h b/libs/hwui/utils/GLUtils.h index 890e374..7020461 100644 --- a/libs/hwui/utils/GLUtils.h +++ b/libs/hwui/utils/GLUtils.h @@ -20,12 +20,11 @@ namespace android { namespace uirenderer { class GLUtils { -private: public: /** - * Print out any GL errors with ALOGE + * Print out any GL errors with ALOGE, returns true if any errors were found. */ - static void dumpGLErrors(); + static bool dumpGLErrors(); }; // class GLUtils |