1 /* 2 * Copyright (C) 2017 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 #include <EGL/egl.h> 18 #include <GLES3/gl3.h> 19 20 #include <stdio.h> 21 getEGLError(void)22const char* getEGLError(void) { 23 switch (eglGetError()) { 24 case EGL_SUCCESS: 25 return "EGL_SUCCESS"; 26 case EGL_NOT_INITIALIZED: 27 return "EGL_NOT_INITIALIZED"; 28 case EGL_BAD_ACCESS: 29 return "EGL_BAD_ACCESS"; 30 case EGL_BAD_ALLOC: 31 return "EGL_BAD_ALLOC"; 32 case EGL_BAD_ATTRIBUTE: 33 return "EGL_BAD_ATTRIBUTE"; 34 case EGL_BAD_CONTEXT: 35 return "EGL_BAD_CONTEXT"; 36 case EGL_BAD_CONFIG: 37 return "EGL_BAD_CONFIG"; 38 case EGL_BAD_CURRENT_SURFACE: 39 return "EGL_BAD_CURRENT_SURFACE"; 40 case EGL_BAD_DISPLAY: 41 return "EGL_BAD_DISPLAY"; 42 case EGL_BAD_SURFACE: 43 return "EGL_BAD_SURFACE"; 44 case EGL_BAD_MATCH: 45 return "EGL_BAD_MATCH"; 46 case EGL_BAD_PARAMETER: 47 return "EGL_BAD_PARAMETER"; 48 case EGL_BAD_NATIVE_PIXMAP: 49 return "EGL_BAD_NATIVE_PIXMAP"; 50 case EGL_BAD_NATIVE_WINDOW: 51 return "EGL_BAD_NATIVE_WINDOW"; 52 case EGL_CONTEXT_LOST: 53 return "EGL_CONTEXT_LOST"; 54 default: 55 return "Unknown error"; 56 } 57 } 58 getGLFramebufferError(void)59const char* getGLFramebufferError(void) { 60 switch (glCheckFramebufferStatus(GL_FRAMEBUFFER)) { 61 case GL_FRAMEBUFFER_COMPLETE: 62 return "GL_FRAMEBUFFER_COMPLETE"; 63 case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 64 return "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT"; 65 case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 66 return "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"; 67 case GL_FRAMEBUFFER_UNSUPPORTED: 68 return "GL_FRAMEBUFFER_UNSUPPORTED"; 69 case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 70 return "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS"; 71 default: 72 return "Unknown error"; 73 } 74 } 75