From 18aaa86761982bd6d735f74b7749d297365c45db Mon Sep 17 00:00:00 2001 From: reuk Date: Thu, 8 Sep 2022 17:41:31 +0100 Subject: [PATCH] OpenGL: Reduce error checking in Release builds --- modules/juce_opengl/juce_opengl.cpp | 2 ++ modules/juce_opengl/native/juce_OpenGL_win32.h | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/juce_opengl/juce_opengl.cpp b/modules/juce_opengl/juce_opengl.cpp index 103dc0e0d8..3ffa2e3169 100644 --- a/modules/juce_opengl/juce_opengl.cpp +++ b/modules/juce_opengl/juce_opengl.cpp @@ -215,7 +215,9 @@ static void checkGLError (const char* file, const int line) static void clearGLError() noexcept { + #if JUCE_DEBUG while (glGetError() != GL_NO_ERROR) {} + #endif } struct OpenGLTargetSaver diff --git a/modules/juce_opengl/native/juce_OpenGL_win32.h b/modules/juce_opengl/native/juce_OpenGL_win32.h index 8833dcccdc..dc956b7984 100644 --- a/modules/juce_opengl/native/juce_OpenGL_win32.h +++ b/modules/juce_opengl/native/juce_OpenGL_win32.h @@ -228,16 +228,19 @@ private: { #if JUCE_DEBUG constexpr auto contextFlags = WGL_CONTEXT_DEBUG_BIT_ARB; + constexpr auto noErrorChecking = GL_FALSE; #else constexpr auto contextFlags = 0; + constexpr auto noErrorChecking = GL_TRUE; #endif const int attribs[] = { - WGL_CONTEXT_MAJOR_VERSION_ARB, components->major, - WGL_CONTEXT_MINOR_VERSION_ARB, components->minor, - WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, - WGL_CONTEXT_FLAGS_ARB, contextFlags, + WGL_CONTEXT_MAJOR_VERSION_ARB, components->major, + WGL_CONTEXT_MINOR_VERSION_ARB, components->minor, + WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB, + WGL_CONTEXT_FLAGS_ARB, contextFlags, + WGL_CONTEXT_OPENGL_NO_ERROR_ARB, noErrorChecking, 0 };