Enabling OpenGL debug output on nVidia drivers

03 Feb 2014

OpenGL's ARB_debug_output/KHR_debug functionality is amazingly useful. Having grown quite used to the level of debug output I was getting on Intel's Mesa OpenGL driver, I was quite disappointed to only get a couple of rare warnings on nVidia's implementation. Mysteriously, I'd seen a couple of references to some more detailed nVidia output (including information about whether buffer objects were being allocated in system or video memory), but without any reference for how to enable them. Perhaps they needed a special debug version of the driver, or perhaps they were not supported on the Linux drivers at all.

It turns out to be much simpler than that. nVidia have a large set of useful debug messages, but almost all of them are disabled by default, and need to be enabled with glDebugMessageControl[ARB]. The easiest thing to do is to enable everything with:

glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0, GL_TRUE);

and enjoy lots of wonderful, juicy debug spam!

I've written a patch to enable this in APItrace, so you can enjoy seeing exactly what kind of memory buffers are placed in and how much of it is wasted by textures with unused mip levels. What fun!