PresentRenderbuffer: GL_RENDERBUFFER_OES is time consuming

I added a profiler to my game and isolated this function. Sometimes this leads to a drop in FPS. 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 this function takes more time in every few frames?

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.));
+3
source share
2 answers

Unless you explicitly call glFlush(), the driver is forced to do this when you present the buffer, because at the point the presentRenderbuffercall, the rendering operations in the buffer are not yet complete.

Try calling glFlushbefore presenting the buffer and its measurement time separately.

+3
source

, , 30 60 . , .

0

Source: https://habr.com/ru/post/1795080/


All Articles