This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,24 @@ AndroidEnvironmentGL::AndroidEnvironmentGL()
2020 return ;
2121 }
2222
23+ // See if we can use the EGL_ANDROID_presentation_time extension. This
24+ // extension may be available from API18 onward.
25+ // If this extension is available, it will be invoked with the target vsync
26+ // for the current frame before calling eglSwapBuffers. This helps when the
27+ // engine over-stuffs the buffer queue. This can happen when a frame goes over
28+ // budget into the next vsync period, and a subsequent frame is quickly
29+ // submitted in the same vsync period. Dequeuing buffers will then be slow
30+ // until the engine stops submitting frames and lets the GPU catch up.
31+ // However, using this extension means the SurfaceFlinger will only use the
32+ // newest buffer for the current vsync, and the GPU and CPU will stay more
33+ // in sync.
34+ // See https://developer.android.com/games/sdk/frame-pacing for more
35+ // details and diagrams.
2336 auto * extensions = eglQueryString (display_, EGL_EXTENSIONS);
2437 if (strstr (extensions, " EGL_ANDROID_presentation_time" )) {
2538 presentation_time_proc_ =
2639 reinterpret_cast <PFNEGLPRESENTATIONTIMEANDROIDPROC>(
27- eglGetProcAddress (" sEGL_ANDROID_presentation_time " ));
40+ eglGetProcAddress (" eglPresentationTimeANDROID " ));
2841 }
2942
3043 valid_ = true ;
You can’t perform that action at this time.
0 commit comments