I'm trying to troubleshoot drops in FPS. I see that Metal Flushes are what takes up most of the rendering time. Is that a good thing?
-
Did you figure it out ? – Coldsteel48 Nov 01 '16 at 03:48
-
1Sort of... I got a dramatic improvement in that department by reducing the size and resolution of my textures. So I guess we can conclude that a "Metal Flush" is the transfer of image data from main memory to video memory or something. – Ghislain Leblanc Nov 04 '16 at 14:14
-
but even for a whole black scene without anything it takes 5-6 ms – Coldsteel48 Dec 28 '16 at 21:27
-
I'm sure there is always at least SOME overhead... I really wish Apple would document this better so we can get a real answer as to what exactly is a Metal Flush. – Ghislain Leblanc Dec 29 '16 at 18:29
-
On mine Metal Flush takes about 100ms (on devices). I'm putting a bounty on this. – mauris Mar 07 '17 at 13:05
-
Try using lower res on your textures. I can almost guarantee dramatic improvements. – Ghislain Leblanc Mar 07 '17 at 16:22
-
it seems like mine was due to lighting. still can't explain why but removing deferred lighting helped. – mauris Mar 08 '17 at 16:07
1 Answers
I am not sure about this, since Apple does not seem to have documented what exactly a "Metal Flush" is anywhere, but I'll answer based on previous experience with OpenGL:
During the execution cycle of a GPU-powered application, the CPU will push data to the GPU, wait for the GPU to finish operating on this data (possibly doing other work in the meantime), and as soon as the GPU is done, push more data and request more operations. Typically, "flushing" would mean that the CPU is waiting on the GPU to finish operations ("flushing out old data") so that it can push more data to the GPU.
So, if my interpretation is correct, that would mean that "Metal flush" measures the time the CPU spends waiting on video memory to free up so it can push more data and request operations to the GPU. In that case, it could be a good thing or a bad thing:
There will always be some communication overhead between the CPU and the GPU, so if most of your rendering time is being taken up by "Metal Flush", it might mean that your application is just running fast enough that most of the delay between frames is just communications overhead. In that case, it would be a good thing.
On the other hand, you might be pushing a lot of data to the GPU and the time needed to copy the data and process it might be causing delays. In that case, it would be a bad thing.
In the end, the important thing here is to ensure your FPS is consistently high. If your FPS is dropping due to "Metal Flush", you might want to try to space out your data transfers - for instance, storing textures in chunks and/or using lower resolution textures would probably help with that.

- 10,174
- 2
- 28
- 39