Making redundant OpenGL calls

烂漫一生 提交于 2019-12-01 02:16:31

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/4905728/making-redundant-opengl-calls

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!