1 /*
2  * Copyright (C) 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #define LOG_TAG "OpenGLRenderer"
18 
19 #include <GLES2/gl2.h>
20 #include <GLES2/gl2ext.h>
21 
22 #include <utils/Log.h>
23 
24 #include "GLUtils.h"
25 
26 namespace android {
27 namespace uirenderer {
28 
dumpGLErrors()29 void GLUtils::dumpGLErrors() {
30     GLenum status = GL_NO_ERROR;
31     while ((status = glGetError()) != GL_NO_ERROR) {
32         switch (status) {
33         case GL_INVALID_ENUM:
34             ALOGE("GL error:  GL_INVALID_ENUM");
35             break;
36         case GL_INVALID_VALUE:
37             ALOGE("GL error:  GL_INVALID_VALUE");
38             break;
39         case GL_INVALID_OPERATION:
40             ALOGE("GL error:  GL_INVALID_OPERATION");
41             break;
42         case GL_OUT_OF_MEMORY:
43             ALOGE("GL error:  Out of memory!");
44             break;
45         default:
46             ALOGE("GL error: 0x%x", status);
47         }
48     }
49 }
50 
51 }; // namespace uirenderer
52 }; // namespace android
53