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 22 namespace android { 23 namespace automotive { 24 namespace evs { 25 namespace support { 26 getEGLError(void)27const char* getEGLError(void) { 28 switch (eglGetError()) { 29 case EGL_SUCCESS: 30 return "EGL_SUCCESS"; 31 case EGL_NOT_INITIALIZED: 32 return "EGL_NOT_INITIALIZED"; 33 case EGL_BAD_ACCESS: 34 return "EGL_BAD_ACCESS"; 35 case EGL_BAD_ALLOC: 36 return "EGL_BAD_ALLOC"; 37 case EGL_BAD_ATTRIBUTE: 38 return "EGL_BAD_ATTRIBUTE"; 39 case EGL_BAD_CONTEXT: 40 return "EGL_BAD_CONTEXT"; 41 case EGL_BAD_CONFIG: 42 return "EGL_BAD_CONFIG"; 43 case EGL_BAD_CURRENT_SURFACE: 44 return "EGL_BAD_CURRENT_SURFACE"; 45 case EGL_BAD_DISPLAY: 46 return "EGL_BAD_DISPLAY"; 47 case EGL_BAD_SURFACE: 48 return "EGL_BAD_SURFACE"; 49 case EGL_BAD_MATCH: 50 return "EGL_BAD_MATCH"; 51 case EGL_BAD_PARAMETER: 52 return "EGL_BAD_PARAMETER"; 53 case EGL_BAD_NATIVE_PIXMAP: 54 return "EGL_BAD_NATIVE_PIXMAP"; 55 case EGL_BAD_NATIVE_WINDOW: 56 return "EGL_BAD_NATIVE_WINDOW"; 57 case EGL_CONTEXT_LOST: 58 return "EGL_CONTEXT_LOST"; 59 default: 60 return "Unknown error"; 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