PDA

View Full Version : Dump all OpenGL State to log file



Dark Photon
08-23-2011, 08:02 AM
Is there some code out there that'll dump all possible OpenGL state, given the current GL version and supported extensions, for debugging purposes?

Or even some code that just dumps all OpenGL state for a specific GL version (2.1, 3.0, whatever)?

Would be a quick way to get a line on what's going on (or what's wrong) when debugging someone else's code.

Thanks.

mbentrup
08-23-2011, 01:15 PM
Check out apitrace: https://github.com/apitrace

It can record a run of your application and you can then replay it and view the GL state at any point.

Dark Photon
08-23-2011, 06:31 PM
Hey, thanks! That's got some real potential! Tried it out, and while it doesn't catch every GL call or dump every state attribute, it sure does a whole lot.

Once I get my head in the code, may be able to help extend it.

Here are a few random things I noticed through a quick spin with the latest source:

apitrace: warning: __gl_param_size: unknown GLenum 0x86A0
apitrace: warning: unknown function "glcuR0d4nX"

Looks like some/all of the NVidia bindless vtx attrib calls are caught/logged, but didn't see the bindless vtx attrib state in the -D dumps. Didn't render my apps' batches properly -- maybe a bindless save/replay issue -- not sure. Also, I regularly use glXWaitGL as a unique "breakpoint" to flag interesting points in the code for debugging, and it didn't catch that.

Anyway, thanks again! Will definitely be working with this app more in the future.

_x57_
08-25-2011, 09:30 AM
For debugging purposes I like gDebugger (http://www.gremedy.com/) very much.

You simply run the executable of the debugged project with it (preferably a build with debug info), break at some point and inspect the opengl state in the state viewer.
It shows either
- all opengl state
- or only the state that has been changed from its default
- or only the state that differs from a state in a state snapshot file which can also be written from within the viewer. Pretty nice. Currently it supports GL up to 3.2 + extensions.

Of course it can do much more like buffer inspection and so on...

Dark Photon
08-26-2011, 06:03 PM
Yeah, thanks. Have used gDebugger. But in later version on Linux, the GUI seems to have painting problems (missing widgets, etc.). So was looking for something lower tech.

_x57_
08-29-2011, 12:18 AM
I already wondered why you wouldn't know it ;)
I knew gDebugger for a long time, however it was too expensive and i only shortly realized it was free now...