debugging support routines

It would be nice to have some debug specific calls. Basically the ability to switch to a context used in another thread without modifying the current context (or state) of that other thread. Or any other solution to query states and read out surface content from a debugger app, without the need to write a wrapper dll (which still can’t to all of the said things).

Since these would be debugging calls only, it would be good enough to assume that the target process execution is halted by a debugger, which should solve any thread synchronization issues.

Even though these calls probably belong in wgl and glX, it feels like that will only result in an inconsistent API.

What inspired me was the xbox debugging tools that let you see all render states and surfaces during debugging, very nice tools.

During the last week I made a VC6 add-in that does the same for GL. This was mainly as an exercise to see if it can be done. I was forced to do some nasty hacks to overcome the “thread barrier”, which means it most likely only works with the nvidia driver at the moment. Other than the ugly implementation it seems to work very nicely.

All of the nasty things I had to do could have been solved with more or less two GL calls. Something to the effect of

glDebugSetContext(threadId, glrc)
glDebugClearContext()

The alternative would be to have a whole set of debug functions to query states and read pixels from a specified context.

Enough ranting for now. Let me know if I’ve missed something painfully obvious, either in that this really can’t be done (and I’ve only been lucky getting it to work) or it already has been done before.