glFlush() time varies from frame to frame with same content on iPhone
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
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)!.
精彩评论