///////////////////////////////////////////////////////
| 41 | { |
| 42 | //////////////////////////////////////////////////////////// |
| 43 | bool checkError(std::string_view file, unsigned int line, std::string_view expression) |
| 44 | { |
| 45 | const auto logError = [&](const char* error, const char* description) |
| 46 | { |
| 47 | sf::err() << "An internal EGL call failed in " << std::filesystem::path(file).filename() << "(" << line << ")." |
| 48 | << "\nExpression:\n " << expression << "\nError description:\n " << error << "\n " |
| 49 | << description << '\n' |
| 50 | << std::endl; |
| 51 | |
| 52 | return false; |
| 53 | }; |
| 54 | |
| 55 | switch (eglGetError()) |
| 56 | { |
| 57 | case EGL_SUCCESS: |
| 58 | return true; |
| 59 | |
| 60 | case EGL_NOT_INITIALIZED: |
| 61 | return logError("EGL_NOT_INITIALIZED", |
| 62 | "EGL is not initialized, or could not be initialized, for the specified display"); |
| 63 | |
| 64 | case EGL_BAD_ACCESS: |
| 65 | return logError("EGL_BAD_ACCESS", |
| 66 | "EGL cannot access a requested resource (for example, a context is bound in another " |
| 67 | "thread)"); |
| 68 | |
| 69 | case EGL_BAD_ALLOC: |
| 70 | return logError("EGL_BAD_ALLOC", "EGL failed to allocate resources for the requested operation"); |
| 71 | |
| 72 | case EGL_BAD_ATTRIBUTE: |
| 73 | return logError("EGL_BAD_ATTRIBUTE", |
| 74 | "an unrecognized attribute or attribute value was passed in an attribute list"); |
| 75 | |
| 76 | case EGL_BAD_CONTEXT: |
| 77 | return logError("EGL_BAD_CONTEXT", "an EGLContext argument does not name a valid EGLContext"); |
| 78 | |
| 79 | case EGL_BAD_CONFIG: |
| 80 | return logError("EGL_BAD_CONFIG", "an EGLConfig argument does not name a valid EGLConfig"); |
| 81 | |
| 82 | case EGL_BAD_CURRENT_SURFACE: |
| 83 | return logError("EGL_BAD_CURRENT_SURFACE", |
| 84 | "the current surface of the calling thread is a window, pbuffer, or pixmap that is no " |
| 85 | "longer valid"); |
| 86 | |
| 87 | case EGL_BAD_DISPLAY: |
| 88 | return logError("EGL_BAD_DISPLAY", |
| 89 | "an EGLDisplay argument does not name a valid EGLDisplay; or, EGL is not initialized on " |
| 90 | "the specified EGLDisplay"); |
| 91 | |
| 92 | |
| 93 | case EGL_BAD_SURFACE: |
| 94 | return logError("EGL_BAD_SURFACE", |
| 95 | "an EGLSurface argument does not name a valid surface (window, pbuffer, or pixmap) " |
| 96 | "configured for rendering"); |
| 97 | |
| 98 | case EGL_BAD_MATCH: |
| 99 | return logError("EGL_BAD_MATCH", |
| 100 | "arguments are inconsistent; for example, an otherwise valid context requires buffers " |