Files
fennec/include/fennec/platform/opengl/egl/error.h
2026-01-06 19:48:28 -05:00

62 lines
2.5 KiB
C

// =====================================================================================================================
// fennec, a free and open source game engine
// Copyright © 2025 - 2026 Medusa Slockbower
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// =====================================================================================================================
///
/// \file fennec/platform/opengl/egl/error.h
/// \brief
///
///
/// \details
/// \author Medusa Slockbower
///
/// \copyright Copyright © 2025 - 2026 Medusa Slockbower ([GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html))
///
///
#ifndef FENNEC_PLATFORM_OPENGL_EGL_ERROR_H
#define FENNEC_PLATFORM_OPENGL_EGL_ERROR_H
#include <fennec/platform/opengl/glad/egl.h>
#include <fennec/string/cstring.h>
/// \brief convert egl error to a readable string
/// \param err the error code
/// \returns the error string corresponding to \f$err\f$
inline fennec::cstring eglErrorString(EGLint err) {
switch (err) {
case EGL_SUCCESS: return "None";
case EGL_NOT_INITIALIZED: return "Not Initialized";
case EGL_BAD_ACCESS: return "Bad Access";
case EGL_BAD_ALLOC: return "Bad Alloc";
case EGL_BAD_ATTRIBUTE: return "Bad Attribute";
case EGL_BAD_CONTEXT: return "Bad Context";
case EGL_BAD_CONFIG: return "Bad Config";
case EGL_BAD_CURRENT_SURFACE: return "Bad Current Surface";
case EGL_BAD_DISPLAY: return "Bad Display";
case EGL_BAD_SURFACE: return "Bad Surface";
case EGL_BAD_MATCH: return "Bad Match";
case EGL_BAD_PARAMETER: return "Bad Parameter";
case EGL_BAD_NATIVE_PIXMAP: return "Bad Native Pixmap";
case EGL_BAD_NATIVE_WINDOW: return "Bad Native Window";
case EGL_CONTEXT_LOST: return "Context Lost";
default: return "Unknown Error";
}
}
#endif // FENNEC_PLATFORM_OPENGL_EGL_ERROR_H