Skip to content

Improve error messages for calling OpenGL functions without a context

This tweaks the error reporting that you can enable by setting __GLVND_APP_ERROR_CHECKING to better handle extension functions.

Currently, libglvnd generates a no-op stub for each function that it knows at build time and passes that name to a noop_warn function, which is responsible for spitting out the error message. For any of the dynamically-assigned dispatch stubs (for OpenGL functions that it doesn't know about at build time), though, it just passes the string "OpenGL function" instead of the function name.

With this, the no-op stubs will instead pass the dispatch table index, which it can then use to look up the function name. That way, it can print the name for any OpenGL function, even the dynamic ones.

That's still conditional on whether the DEBUG macro is set, so on a release build, it'll still have a single generic no-op stub instead of one per function. At present, it would need to generate 7448 of those stubs, which can make libGLdispatch.so upwards of 1.2 megabytes larger depending on architecture.

I also changed the Meson build so that it'll set the DEBUG macro for debug builds (just like the autotools build does), so that you can actually use the per-function no-op stubs.

Merge request reports