public static string GetErrorMessage(EglErrorCode code) { switch (code) { case EglErrorCode.Success: return("The last function succeeded without error."); case EglErrorCode.NotInitialized: return("EGL is not initialized, or could not be initialized, for the specified EGL display connection."); case EglErrorCode.BadAccess: return("EGL cannot access a requested resource (for example a context is bound in another thread)."); case EglErrorCode.BadAllocation: return("EGL failed to allocate resources for the requested operation."); case EglErrorCode.BadAttribute: return("An unrecognized attribute or attribute value was passed in the attribute list."); case EglErrorCode.BadContext: return("An EGLContext argument does not name a valid EGL rendering context."); case EglErrorCode.BadConfig: return("An IntPtr argument does not name a valid EGL frame buffer configuration."); case EglErrorCode.BadCurrentSurface: return("The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid."); case EglErrorCode.BadDisplay: return("An IntPtr argument does not name a valid EGL display connection."); case EglErrorCode.BadSurface: return("An IntPtr argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering."); case EglErrorCode.BadMatch: return("Arguments are inconsistent (for example, a valid context requires buffers not supplied by a valid surface)."); case EglErrorCode.BadParameter: return("One or more argument values are invalid."); case EglErrorCode.BadNativePixmap: return("A NativePixmapType argument does not refer to a valid native pixmap."); case EglErrorCode.BadNativeWindow: return("A NativeWindowType argument does not refer to a valid native window."); case EglErrorCode.ContextLost: return("The EGL context was lost. The application must destroy all contexts and reinitialise OpenGL ES state and objects to continue rendering."); default: return($"An unknown EGL error occured [{code}] (or there is no known message for this error code)."); } }
private EglException(EglErrorCode error, string message) : base($"{error} - {message} - {Egl.GetErrorMessage(error)}") { ErrorCode = error; }