开发者

presentRenderbuffer : GL_RENDERBUFFER_OES takes long time

I added a profiler to my game and isolated this function. It, sometimes, cause FPS drop. This is my result:

Present buffer time: 22
Present buffer time: 1
Present buffer time: 9
Present buffer time: 1
Present buffer time: 20
Present buffer time: 6
Present buffer time: 4
Present buffer time: 4
Present buffer time: 22
Present buffer time: 4
Present buffer time: 8
Present buffer time: 4
Present buffer time: 4
Present buffer time: 15
Present buffer time: 1
Present buffer time: 1
Present buffer time: 1
Present buffer time: 11
Present buffer time: 1
Present buffer time: 6
Present buffer time: 1
Present buffer time: 1
Present buffer time: 25
Present buffer time: 6
Present buffer time: 7
Present buffer time: 1
Present buffer time: 10
Present buffer time: 7
Present buffer time: 3
Present buffer time: 1
Present buffer time: 12
Present buffer time: 9
Present buffer time: 6
Present buffer time: 9

Do you know why at every few frame开发者_运维百科s this function takes more time?

This is my code:


    f64 time = -System::GetTime();      
    [m_context presentRenderbuffer:GL_RENDERBUFFER_OES];
    Log("Present buffer time: %d\n", u32((System::GetTime() + time) * 1000.));


If you are not calling glFlush() explicitly, the driver is forced to do it when you present the buffer, because at the point of presentRenderbuffer call the rendering operations on the buffer may not be completed yet.

Try calling glFlush before presenting the buffer and measuring time of it separately.


The render buffer presentations that actually go to the display may be being quantized to a 30 Hz or 60 Hz refresh rate. The fast renders may actually just be throwing away the previous render before the earlier one completes.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜