glFinish() as a blocking call to get frame onset time #9793
bsureshkrishna
started this conversation in
Engine Core
Replies: 1 comment 6 replies
-
Last time I checked, searching in Github will only give you results from the main branch. Godot moved away from OpenGL ES in favor of Vulkan in Godot 4, and then OpenGL was reintroduced. That is from where you found that code. It is likely that using Godot 3.x is better for your use case. By the way, vulkan more options for synchronization than OpenGL. Although I cannot tell you how to get the same result as you would with OpenGL, I can't rule it out either. In any case, search for VSync in project settings. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I dont know much about Godot, and so this is a naive question, but hopefully along the right lines and posted in the right place.
I am interested in using Godot for visual experimental research, so being able to control exactly what is on the monitor at a given time. If vsync is on, the _process runs once per frame. Delta does give the interval between successive calls to _process - I assume this delta is either the interval between the previous call and the current call, or the interval between the two previous calls ?
However, it seems to me there are at least two ways in which the interval between successive calls to _process would vary from the inter-frame interval (on the monitor)... one is a lag between the call to _process and the succeeding frame display (because, say, Windows decided to steal some cycles) or because _process is called at different times within the inter-frame interval, since I am guessing that, within a frame, the call to _process is not tied to the Vsync or vertical blanking interval in any way. For example, _process() may run as fast as possible between frames and then if there are two buffers, the flip of the back buffer happens during the vertical blanking interval, but _process() may have finished well before that….
Put differently, in Godot, what can we know about the time logged about when _process is called, and the actual buffer flip and display at the openGL/monitor level ? In openGL, glFinish() waits until the graphics card is done and is ready to accept commands again, and so (with many caveats), gets the time at which the display happened (when vsync is on). Pyglet exposes this for example, and Psychopy uses this to know better (with caveats) when the stimulus came on. Now I am wondering if this particular option is exposed or available in Godot. I understand that as a game engine, Godot would much rather be doing other things during that time and this is not that important and so glFinish is not available ?
I did search for glFlush (which does not block) in the Github for GodotEngine and got nothing; searching for glFinish gave this -
but I have no idea what this means for my use-case.
Thank you !
Beta Was this translation helpful? Give feedback.
All reactions