From eb3f55ae27a2ac5e77642523d9e73afd2f7c8c46 Mon Sep 17 00:00:00 2001 From: Vladislav Belov Date: Wed, 8 Jul 2026 08:13:48 +0200 Subject: [PATCH] Removes unused ogl_SquelchError --- source/lib/ogl.cpp | 40 ---------------------------------------- source/lib/ogl.h | 15 --------------- 2 files changed, 55 deletions(-) diff --git a/source/lib/ogl.cpp b/source/lib/ogl.cpp index 97bb151f7e..917c8753bf 100644 --- a/source/lib/ogl.cpp +++ b/source/lib/ogl.cpp @@ -293,46 +293,6 @@ void ogl_WarnIfErrorLoc(const char *file, int line) debug_printf("%s:%d: OpenGL error(s) occurred: %s (%04x)\n", file, line, ogl_GetErrorName(first_error), (unsigned int)first_error); } -// ignore and reset the specified error (as returned by glGetError). -// any other errors that have occurred are reported as ogl_WarnIfError would. -// -// this is useful for suppressing annoying error messages, e.g. -// "invalid enum" for GL_CLAMP_TO_EDGE even though we've already -// warned the user that their OpenGL implementation is too old. -bool ogl_SquelchError(GLenum err_to_ignore) -{ - // glGetError may return multiple errors, so we poll it in a loop. - // the debug_printf should only happen once (if this is set), though. - bool error_enountered = false; - bool error_ignored = false; - GLenum first_error = 0; - - for(;;) - { - GLenum err = glGetError(); - if(err == GL_NO_ERROR) - break; - - if(err == err_to_ignore) - { - error_ignored = true; - continue; - } - - if(!error_enountered) - first_error = err; - - error_enountered = true; - dump_gl_error(err); - } - - if(error_enountered) - debug_printf("OpenGL error(s) occurred: %04x\n", (unsigned int)first_error); - - return error_ignored; -} - - //---------------------------------------------------------------------------- // feature and limit detect //---------------------------------------------------------------------------- diff --git a/source/lib/ogl.h b/source/lib/ogl.h index 3efd65b51b..d5ef118202 100644 --- a/source/lib/ogl.h +++ b/source/lib/ogl.h @@ -118,19 +118,4 @@ extern void ogl_WarnIfErrorLoc(const char *file, int line); **/ extern const char* ogl_GetErrorName(GLenum err); -/** - * ignore and reset the specified OpenGL error. - * - * this is useful for suppressing annoying error messages, e.g. - * "invalid enum" for GL_CLAMP_TO_EDGE even though we've already - * warned the user that their OpenGL implementation is too old. - * - * call after the fact, i.e. the error has been raised. if another or - * different error is pending, those are reported immediately. - * - * @param err_to_ignore: one of the glGetError enums. - * @return true if the requested error was seen and ignored - **/ -extern bool ogl_SquelchError(GLenum err_to_ignore); - #endif // INCLUDED_OGL