From 7aa72a163376336dfa100101bd329a9915144ddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BCndig?= Date: Sat, 27 Jan 2024 22:33:40 +0100 Subject: [PATCH] EMSCRIPTEN: OPENGL: Disable GLAD --- configure | 4 ++-- graphics/opengl/debug.cpp | 9 +++++++++ graphics/opengl/system_headers.h | 8 ++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 0ebf8e9b470..50aa26c3403 100755 --- a/configure +++ b/configure @@ -6351,6 +6351,7 @@ if test "$_opengl_mode" != none ; then sdl) # This case is for pure SDL backend. Many platforms overload it and create a new backend # They still make use of SDL but it's handled below in the default case + _opengl_glad=yes case $_sdlversion in 1.2.*) # Stock SDL 1.2 only supports OpenGL contexts. @@ -6367,7 +6368,7 @@ if test "$_opengl_mode" != none ; then ;; emscripten) _opengl_mode=gles2 - _opengl_glad=no + _opengl_glad=no # https://github.com/Dav1dde/glad-web/issues/12 append_var OPENGL_LIBS "-s FULL_ES2=1 -s MAX_WEBGL_VERSION=1" ;; *) @@ -6377,7 +6378,6 @@ if test "$_opengl_mode" != none ; then esac ;; esac - _opengl_glad=yes ;; switch) _opengl_mode=gles2 diff --git a/graphics/opengl/debug.cpp b/graphics/opengl/debug.cpp index c5273cb7bb4..6b0d95278b4 100644 --- a/graphics/opengl/debug.cpp +++ b/graphics/opengl/debug.cpp @@ -39,10 +39,19 @@ Common::String getGLErrStr(GLenum error) { return "GL_INVALID_VALUE"; case GL_INVALID_OPERATION: return "GL_INVALID_OPERATION"; +// OpenGL ES 2.0 doesn't have GL_STACK_OVERFLOW and GL_STACK_UNDERFLOW +// see https://registry.khronos.org/OpenGL/api/GLES2/gl2.h and https://registry.khronos.org/OpenGL/api/GLES2/gl2ext.h +#ifdef USE_FORCED_GLES2 + case GL_STACK_OVERFLOW_KHR: + return "GL_STACK_OVERFLOW_KHR"; + case GL_STACK_UNDERFLOW_KHR: + return "GL_STACK_UNDERFLOW_KHR"; +#else case GL_STACK_OVERFLOW: return "GL_STACK_OVERFLOW"; case GL_STACK_UNDERFLOW: return "GL_STACK_UNDERFLOW"; +#endif case GL_OUT_OF_MEMORY: return "GL_OUT_OF_MEMORY"; default: diff --git a/graphics/opengl/system_headers.h b/graphics/opengl/system_headers.h index f26fc141b5f..145b38221d7 100644 --- a/graphics/opengl/system_headers.h +++ b/graphics/opengl/system_headers.h @@ -84,6 +84,14 @@ #define GL_MAX_SAMPLES 0x8D57 #endif + #if !defined(GL_STACK_OVERFLOW_KHR) + #define GL_STACK_OVERFLOW_KHR 0x0503 + #endif + + #if !defined(GL_STACK_UNDERFLOW_KHR) + #define GL_STACK_UNDERFLOW_KHR 0x0504 + #endif + #elif USE_FORCED_GLES #define GL_GLEXT_PROTOTYPES