Hi!
I am currently finalizing a new app that uses Metal to render a 3D scene and a UIKit overlay to display controls for interacting with objects in the scene. The render loop is driven via a CADisplayLink with its preferredFramesPerSecond
set to 60.
I have recently noticed an issue where the app reports a steady 60 fps frame rate in the Xcode debug navigator, but still felt sluggish on the device. This feeling was only present on devices with ProMotion and often started after interactions with the UIKit overlay. I started investigating by using Metal System Trace and quickly found an explanation for the sluggish feeling: occasionally, the app would switch from its nominal 16ms-16ms-16ms cadence to 12ms-20ms-12ms, thus still averaging 60 fps, but with inconsistent frame times.
Pictures of the timeline can be found here.
I have tried setting the CAMetalLayer
's presentsWithTransaction
to true
, waiting for the command buffer to be scheduled and then presenting the drawable, but, unfortunately, the problem persists.
If anybody can think of a potential reason / solution for this, I would be very thankful.