First use of awaitFrame()
awaits extra draw frame when used with Main dispatcher
#3432
Labels
awaitFrame()
awaits extra draw frame when used with Main dispatcher
#3432
When using
awaitFrame()
for the first time on the main dispatcher, there is a wasted draw frame with the current implementation. This is due to the extradispatch()
call that is made forupdateChoreographerAndPostFrameCallback
before frame callback is set. Sincedispatch()
on theHandlerContext
posts a message at the end of the mainLooper
queue, it is very likely that a frame render event would have already occurred by the timeChoreographer.postFrameCallback {}
is called, at which case,awaitFrame()
actually awaits until the second frame before returning.The following code snippet demonstrates the issue (I do admit it is a bit exaggerated in this code snippet):
The output for this would be:
The code defines the expected order output, however the output shows that the
awaitFrame()
call is made last, and after the second frame callbacks have been made. I have a potential fix in #3431The text was updated successfully, but these errors were encountered: