eglSwapBuffers suddenly takes much longer time to finish
Today i found my opengles program frame time sometimes increases for unknown reason, usually its 16ms, but sometimes it will take 33ms to finish one frame. after hours profiling and researching i found the reason : the frame 开发者_JAVA百科time increase is because the 'eglSwapBuffers' takes much longer time than usual. usually time spend on 'eglSwapBuffers' is less than 10 milliseconds, but sometimes it will take about 26 milliseconds.
the scene is static so the frame time is supposed to be stable?
Would anybody know the reason please help, what should i do to make my frame time stable?
There was an answer in a different thread that helped me a lot with this problem.
this kind of behavior is usually caused by window and surface pixel format mismatch eg. 16bit (RGB565) vs 32bit.
I am also meeting such a problem.
I found if the window of eglsurface is resized to more bigger, the time of eglSwapbuffer spent become very long (about 2x than normal state).
In my case it turned out to be the MSAA. Using 4x MSAA, caused my eglSwapBuffers() to go to 30 milliseconds.
I had to take out two lines from my config, and got back to a 2 ms swap.
const EGLint attribs[] = {
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
EGL_DEPTH_SIZE, 16,
EGL_BLUE_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_RED_SIZE, 8,
// EGL_SAMPLE_BUFFERS, 1,
// EGL_SAMPLES, 4,
EGL_NONE
};
精彩评论