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