I develop a safety critical application which must work at 30 frame per second. In case it is not able to provide the 30fps or any other error happens we draw black screen instea开发者_开发问答d.
I'd like to query the error flag by a glGetError call as often as it is feasible, but I afraid it can block the drawing thread for a longer time (for a few ms).
Can the glGetError call block the thread until the latest opengl command has not been processed?
If no, how do I know if there was an error during the execution of the the latest opengl command?
Technical parameters: - Linux 2.6.20-1.21 - Nvidia Quadro NVS 285 - libGL.so.100.14.19
Nothing in the GL specification guarantees anything regarding blocking (or performance characteristics for that matter).
Now, glGetError for most implementations I've seen actually works without any interaction with the GPU hardware, just the API part of the driver side. In short, it ought not to block (caveat: implementation detail).
As a side note, the various places where a GL error ought to be generated and checked on the GPU, the specification pretty much says the behavior is undefined as opposed to error-generating, specifically to not have this issue.
Finally, glxSwapBuffer will more likely be a place where you'll see blocking happen, because your GPU is still busy drawing previous frames (so the drivers usually pick that point to make sure the CPU does not get too far ahead).
精彩评论