OpenGL debug makes it impossible to work

Hello, I just updated to the latest develop branch which seems to add support for more opengl profiles, but the 4.3 profile which is supposed to improve the debugging makes it impossible to work, as soon as the app launches, I get a bunch of those warnings

OpenGL DBG message: Buffer detailed info: Buffer object 1 (bound to GL_ELEMENT_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.
JUCE Assertion failure in juce_OpenGLContext.cpp:630
A breakpoint instruction (__debugbreak() statement or a similar call) was executed in

When continuing running, as soon as something change in the software, I get again those errors. So I can’t even click or do anything without being constantly paused by Visual Studio.

Is there an option to either remove GL debugging (didn’t find anything in the projucer), or not breaking on warning but only on errors at least ?

FWIW, I’ve had to not use the latest JUCE + OpenGL to get by, and posted the same issue a little while ago: Windows: OpenGL debug assertions hit when updating to latest JUCE 7/develop

From what I recall, the JUCE devs are working on some OpenGL stuff… hopefully this’ll be fixed in the midst of whatever changes they have in the works.

As temporary fix use something like this on juce_OpenGLContext.cpp:630


glDebugMessageCallback ([] (GLenum, GLenum type, GLuint, GLenum severity, GLsizei, const GLchar* message, const void*)
		{
			// This may reiterate issues that are also flagged by JUCE_CHECK_OPENGL_ERROR.
			// The advantage of this callback is that it will catch *all* errors, even if we
			// forget to check manually.
			
            DBG ("OpenGL DBG message: " << message);

			// Only severe errors
			if(type == GL_DEBUG_TYPE_ERROR && severity == GL_DEBUG_SEVERITY_HIGH)
			{
				jassertfalse;
			}
			
		}, nullptr);

Ideally the debug messenger impl should print all info (source, type, severity and error id).
Perhaps even make creation a user responsibility.

e.g. I use a custom messenger with more settings like this:

std::unique_ptr<gl::DebugMessenger> debugMessenger; // member of MainComponent

void MainComponent::initialise() // GL renderer callback
{
    debugMessenger = gl::DebugMessenger::create();
}
1 Like

I’m also hitting that assert, hopefully someone from JUCE is fixing this soon. Meanwhile the temporary fix @parawave provided makes it work for now - thanks :slight_smile:

Thanks for reporting, this change avoids asserting on low-severity issues:

3 Likes

Thanks, works now :slight_smile:

now a new message is collapsing my output window since it is repeated constantly

OpenGL DBG message: Buffer detailed info: Buffer object 3 (bound to GL_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW) will use VIDEO memory as the source for buffer object operations.

From what I have seen, it is an unimportant message, it does not even have a level, it is a notification included from version 4.3, GL_DEBUG_SEVERITY_NOTIFICATION, seems like it can be ignored

https://www.khronos.org/opengl/wiki/Debug_Output

it seems that the fix above only suppresses the jasserts, but still DBGs to console, which can easily flood out all other messages

The solution is to disable specific messages

gl::glDebugMessageControl(gl::GL_DEBUG_SOURCE_API, gl::GL_DEBUG_TYPE_OTHER, gl::GL_DEBUG_SEVERITY_NOTIFICATION, 0, 0,gl::GL_FALSE );

https://registry.khronos.org/OpenGL-Refpages/gl4/html/glDebugMessageControl.xhtml

2 Likes

By the way, is there a bug in the function callback. “type” must be the second parameter

        glDebugMessageCallback ([] (GLenum type, GLenum, GLuint, GLenum severity, GLsizei, const GLchar* message, const void*)
        {
            // This may reiterate issues that are also flagged by JUCE_CHECK_OPENGL_ERROR.
            // The advantage of this callback is that it will catch *all* errors, even if we
            // forget to check manually.
            DBG ("OpenGL DBG message: " << message);
            jassertquiet (type != GL_DEBUG_TYPE_ERROR && severity != GL_DEBUG_SEVERITY_HIGH);
        }, nullptr);


    typedef void (APIENTRY *DEBUGPROC)(
        GLenum source,
        GLenum type,
        GLuint id,
        GLenum severity,
        GLsizei length,
        const GLchar *message,
        const void *userParam);

Thanks for reporting, that’s fixed here: