0

I am developing an application in C++ (MVS2008) and I have problem like described in this thread:

NVIDIA OpenGL driver lost connection

what i want to ask is not for a solution, or why is this happenning (like in the posted thread), i want to ask if i can "catch" this error and do something before the application crushes, like an output log with some relevant information of the application state.

The error occurs every now and then while running the application without clear causes, therefore i would like such a thing.

1 Answer 1

0

Modern Windows versions put a number of hard constraints on the responsiveness of applications. If a process spends too much time in a graphics operation driver call or takes too long to fetch events from Windows a watchdog triggers and Windows assumes that the process got stuck in an infinite loop or violates the responsivenes demands and may "do" something about it.

Try what happens if you break down a single glDraw… call into a number of smaller batches. In general you want to minimize the number of glDraw… calls, but if a single glDraw… call takes more than 10ms or so to complete, you're far beyond OpenGL overhead territory anyway.

Note that due to the asynchronous nature of OpenGL that watchdog may bark in a OpenGL finishing call glFinish or SwapBuffers. In that case it may help to help to add glFlush commands between the draw batches. If that doesn't help try glFinish (which will have a performance impact). If that doesn't help, too. Create an auxiliary OpenGL context in a separate thread that renders to a texture using a FBO and have the main thread display only the contents of this intermediary texture. And if that doesn't help, create the auxiliary context on a PBuffer instead on the same window as your main context.

1
  • Hey, thanks for the answer. Thing is, I am aware why this error occurs and how i can force the application reproduce it but i would like a way to return the application to a valid state after this error occurs Feb 2, 2016 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.