Can eglSwapInterval(0) cause screen tearing?

给你一囗甜甜゛ 提交于 2020-01-16 07:50:23

问题


When I read eglSwapInterval() api in those documents(https://www.khronos.org/registry/egl/sdk/docs/man/html/eglSwapInterval.xhtml, https://www.opengl.org/wiki/Swap_Interval). When I call eglSwapInterval() with zero value, eglSwapBuffers() call will do swapping back and front buffer without waiting vblank. That means buffer swapping can occur at any time. So, this can cause screen tearing?

Or buffer swapping is also prevented during the vsync pulse in this case?


回答1:


Yes. A zero swap interval specifies that you want to swap immediately, without waiting for vsync. If this is what your EGL implementation actually does, it'll cause tearing. From the EGL spec:

If interval is set to a value of 0, buffer swaps are not synchronized to a video frame, and the swap happens as soon as all rendering commands outstanding for the current context are complete. interval is silently clamped to minimum and maximum implementation dependent values before being stored; these values are defined by EGLConfig attributes EGL_MIN_SWAP_INTERVAL and EGL_MAX_SWAP_INTERVAL respectively.

As the spec suggests, you might not actually get a zero swap interval (if you don't, you won't get tearing). It depends on whether your EGL implementation supports a swap interval of zero (you can query the config to find out), and whether the underlying windowing system is capable of it.



来源:https://stackoverflow.com/questions/32282252/can-eglswapinterval0-cause-screen-tearing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!