简体   繁体   中英

Making redundant OpenGL calls

I was wondering if it is recommended to eliminate all redundant opengl calls.

For instance, should I be doing something like (wrapped in a function):

if(foobuffer != boundbuffer) {
  glBindBuffer(GL_BAR_BUFFER, foobuffer);
  boundbuffer = foobuffer;
}

Or is the driver automatically doing such things and this is actually a redundant reduntant-check?

You should probably avoid it. Here (specifically 22.040, you'll have to scroll down the page since there's no anchor for it), it is noted that redundant calls are generally bad practice even though some implementations attempt to minimize the impact.

Tools like gDEBugger can be used to help track down where you might be making redundant calls, too, if you're in a position where you're not sure how many you may be making in your code base.

I've just been eliminating many such calls from an Android application, so I can tell you first-hand that it matters on that platform (on that specific OS version and hardware). It increased the framerate by a few fps, I'd say about 5-10% profit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM