- Home /
Odd frame buffer swap timing in Android with VSYNC ON
Hi,
First time poster here. I'm not sure if this is the right place to ask. If not, please point me to the right place.
I created a blank project (Unity 2019.1.7f1) with a solid color sprite that alternates between black and white on every frame. I'm using Vsync. Specifically, I'm rendering at 15 fps with QualitySettings.vSyncCount = 4).
Then I'm using a high precision light sensor pointed to the device screen to measure the actual timing. The result is quite unexpected: on iOS devices, the timing is absolutely precise and I get around 66 ms all the time.
However, on Android builds I get 66 ms most of the time but it stutters from time to time and I get very odd results, with deviations of up to 55%.
To sync up with the frame buffer swap, I tried both Camera.OnPostRender() and WaitForEndOfFrame() in a coroutine with the same results. There is NOTHING else running (no more scripts) and nothing else in the scene, so I wouldn't say it's related to the CPU or GPU load.
I have also tried with stroboscopic light native Android apps that blink the whole screen at a given rate and got very stable results as well. So I think it's reasonable to narrow it down to something in the Android implementation of the Unity renderer.
Precise timing from frame to frame is very important in my application. What can I do?.
Any help would be greatly appreciated! Thanks in advance, Mike
UPDATE: Now I'm setting VSyncCount to 2 and updating the sprite every other frame. I'm also measuring the delta between sprite updates using DateTime.Now.Ticks. The interval stays within range until I touch the screen. Then the minimum goes down to 33 ms and the max up to 153 ms. If I don't touch the screen it takes longer, but the times will eventually drift.
Your answer
Follow this Question
Related Questions
Vsync on or off? 1 Answer
Black Spots using Android 0 Answers
How to recover Auto Graphics API for Android back to default? 0 Answers
Unity Rending Mobile Bug (Android Pixel 4) 0 Answers
Rendering problem? 0 Answers