New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile: allow api users to decide when to SwapBuffers. #9413

Open
bryanturley opened this Issue Dec 22, 2014 · 1 comment

Comments

Projects
None yet
3 participants
@bryanturley

bryanturley commented Dec 22, 2014

While fixing app on x11/egl and porting it to x11/glx I found some need for a redesign.
See https://go-review.googlesource.com/#/c/1851 for some discussion.

Right now the idea is to always vsync on back buffer swap.
This will make any app run at the display devices (probably) fixed refresh rate.
An app that takes 1.1 frames to render will wait 0.9 frames for the next vblank causing your app to run at half of the display's refresh rate when you could be running much faster.
Refresh rates are not required to be 60hz, so you would have to measure your framerate every frame to figure out if you are running slower or faster.

I recommend letting the user trigger a draw and swap and the user running their own timer.
The triggers for draw and swap should be separate so people have the choice to use single buffered contexts (which may be making a comeback oddly).
For running your own timer I recommend timer.NewTicker().
I found it works perfectly as a frame timer with desktop gl.

For controlling whether SwapBuffers() vsync's
This simple function is available with nearly the same definition for egl/glx/wgl.
https://www.khronos.org/registry/egl/sdk/docs/man/html/eglSwapInterval.xhtml
It just takes an integer >= 0 that is the number of vblanks SwapBuffers should wait for.
Something similar exists for darwin but ios looks a bit ugly.

@mikioh mikioh added the repo-mobile label Jan 2, 2015

@bryanturley

This comment has been minimized.

bryanturley commented Feb 11, 2015

I am unwatching/subscribing from this issue, if no one else cares you can delete it.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc changed the title from mobile: allow api users to decide when to SwapBuffers. to x/mobile: allow api users to decide when to SwapBuffers. Apr 14, 2015

@rsc rsc modified the milestones: Unreleased, Unplanned Apr 14, 2015

@rsc rsc removed the repo-mobile label Apr 14, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment