Touch latency: triple buffering?

I'm trying to figure out why my Metal project has worse touch latency than a standard UIView-based implementation. All I'm doing is drawing circles where the touches are, and the UIView-based implementation is significantly tighter.


I have two questions:


1. A little probing and it looks like Metal frames are triple buffered (i.e., if you stop updating rendering, you'll see the three frames cycling over and over). Is it that I'm seeing a 2 frame delay (33ms) before the updated data appears?


2. Frequently, the touch updating itself becomes choppy in the Metal app. Whereas the UIView-based app smoothly updates touch movements at 60Hz, sometimes the Metal app will go 33ms between touchesMoved updates, which makes the motion choppy. Why would that be?

Replies

Are you doing whatever makes sense from 16:25?


https://developer.apple.com/videos/wwdc/2015/?id=233

From that talk it sounds like I should be getting the quicker display update automatically in iOS 9 (which I'm running) without any additional configuration.


Unless there are 'animations active in my app' without me knowing about it? I'm not doing any UIView work in the Metal app, but do I have to explicitly disable the possibility of animations for my MTKView or something?

Am I understanding the flow of this Metal system trace correctly?


http://bitshapesoftware.com/extra/metal-trace.png


Do I have the option to double buffer to save a frame of latency? And if the system is automatically downgrading me to triple buffering, how do I find out why?

Do I have the option to double buffer to save a frame of latency? And if the system is automatically downgrading me to triple buffering, how do I find out why?

Does the Metal System Trace instrument (in Xcode 7) tell you anything useful?


This talk has some examples of how to use it: https://developer.apple.com/videos/wwdc/2015/?id=610

I think it confirms that I'm triple buffered, and that I'm definitely not overrunning my CPU time per frame. Sorry - I have a comment with a trace screenshot waiting for moderation that shows what I see.

I also tried this out on the Metal template, it doesn't seem possible to achieve double buffering as demonstrated in that WWDC talk.

It's over one year later, and I'm seeing something similar to this. Has anyone managed to achieve the 1 frame latency described in that 2015 WWDC talk?