Skip to main content
GameDev.net gamedev.net
🔒 Locked

glGetError

Started by Prune Sep 10, 2014 at 9:03 PM 2 replies 2.7k views
Original Post
Prune
Prune

Will I get a significant performance hit if I call glGetError() per frame, even if just before the SwapBuffers call (and I'm using vsync)?

For example, if I have a persistently mapped buffer, and I've initiated a transfer, then does the glGetError() act like a barrier and would thus potentially be a significant hit?

"But who prays for Satan? Who, in eighteen centuries, has had the common humanity to pray for the one sinner that needed it most?" --Mark Twain

~~~~~~~~~~~~~~~Looking for a high-performance, easy to use, and lightweight math library? http://www.cmldev.net/ (note: I'm not associated with that project; just a user)
Kaptein
Kaptein

Not really, as its something the driver just sets once and forgets. In a release build you should check everywhere during init and then at opportune places in the renderer (then disable it after first error).

In debug builds just check everywhere you think it will help, such as after rendering particles etc. as it will help you get started narrowing down bugs.

Xycaleth
Xycaleth

Calling glGetError() will give some performance hit. Most GL drivers nowadays are threaded - when you call glDoTheThing(), the call and its arguments are pushed to a queue which is executed by another thread. By calling glGetError(), you force a sync point in the driver so it has to wait for the GL command to finish before the error can be read.

You can make use of the debug output functions which can report errors asynchronously, which shouldn't give as much of a performance hit.

Fiddler
Fiddler

Or simply have a debug and a release version of your application.

[OpenTK: C# OpenGL 4.4, OpenGL ES 3.0 and OpenAL 1.1. Now with Linux/KMS support!]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.