开发者

Is there a maximum number of OpenGL ES calls you can make on iPad?

开发者 https://www.devze.com 2023-03-08 07:24 出处:网络
Can anyone tell me if there is a limit to the maximum number of OpenGL ES calls that can be made on iPad (i.e. OpenGL draw calls and state changes)?

Can anyone tell me if there is a limit to the maximum number of OpenGL ES calls that can be made on iPad (i.e. OpenGL draw calls and state changes)?

I am working on a game and seeing low开发者_如何学Go FPS, so I wonder if it has any thing to with my large number of OpenGL calls.


There's no real maximum for OpenGL ES commands, but each one does have some overhead associated with it. Redundant state changes should be eliminated, and expensive state changes should be reduced by grouping geometry in ways that everything using one state is drawn, then the next. Apple has some recommendations for this in their OpenGL ES Programming Guide for iOS.

However, I've rarely found the OpenGL ES commands to be the cause of significant performance degradation in my applications. The larger problems tend to be due to the size of your geometry or from the complexity of any shaders or other effects you apply to your scene. I share some tips that I've applied for reducing geometry size here, and one tool for profiling shaders here, but I'm still learning the ins-and-outs of shader tuning myself.

If you do really care about fine-tuning the OpenGL calls you're making, the best profiling tool to use is the new OpenGL ES Analyzer instrument that comes with Xcode 4. I show a couple of example screens from that instrument in my answer here, where I used it to identify some redundant settings. It will find these calls for you, and point out where they are in your code. You can also use Time Profiler to see if you're putting more load on the CPU than you should be when rendering your frames, and track down the offending lines of code.


As far as I know, there is no such limit as maximum number of glCalls. But definitely, the more the number of gl calls, time taken would be more. Batched rendering is one of the main optimizations that has to be made with OpenGL.


Instead of suspecting the bottleneck, use Instruments to locate it.

Trace Template OpenGL ES Analysis is the weapon of choice. Last time I used it, you had to manually attach it to a running process on the device (all other startup options failed).

0

精彩评论

暂无评论...
验证码 换一张
取 消