Navigation Menu

Skip to content
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
Open

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

bryanturley opened this issue Dec 22, 2014 · 1 comment
Labels
mobile Android, iOS, and x/mobile
Milestone

Comments

@bryanturley
Copy link

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.

@bryanturley
Copy link
Author

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 mobile: allow api users to decide when to SwapBuffers. 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
@changkun changkun added the mobile Android, iOS, and x/mobile label Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile
Projects
None yet
Development

No branches or pull requests

4 participants