glFlush() time varies from frame to frame with same content on iPhone

折月煮酒 提交于 2019-12-22 10:45:03

问题


this question is related to presentRenderbuffer : GL_RENDERBUFFER_OES takes long time

I have a simple 2D game(with several sprites). glFlush() execution time varies from 1ms to 30ms with same frame content. Do you know why? I am sure that I don't have frame content changed from one frame to another when I compute this, it's a static scene with about 30 sprites. I use ~5MB texture memory with additional 4MB allocated for texture loading. I use opengles 1.1 on a single thread. I have other treads, but they are not using opengl. This behavior is on iPhone 3G with iOS 4.2


回答1:


I tried this on my iPad (3rd gen), and when you compile for iPad glFlush() takes something like 0.5ms for small amounts of geometry (2 triangles), and 15ms for more geometry (2 tris+100 points). The majority of the time is waiting for the displaylink to callback. But when you compile for iPhone, glFlush() takes a minimum of 15ms, and that's where the majority of the game time is spent (if you have a relatively empty frame!). And if you go into 2x mode (app running in iPhone mode, on an iPad), the time it takes for glFlush to complete alternates on every frame: 15ms,30ms,15ms,30ms. I guess iPhone is architected differently from iPad, and there is some kind of frame limiter inside the glFlush() command on the iPhone, (remember, I only tried iPHone mode on my iPad)!.



来源:https://stackoverflow.com/questions/5146987/glflush-time-varies-from-frame-to-frame-with-same-content-on-iphone

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