简体   繁体   English

SceneKit统计信息显示中的“Metal Flush”是什么?

[英]What are “Metal Flush” in the SceneKit stats display?

I'm trying to troubleshoot drops in FPS. 我正在尝试解决FPS中的丢弃问题。 I see that Metal Flushes are what takes up most of the rendering time. 我发现Metal Flushes占用了大部分渲染时间。 Is that a good thing? 那是件好事儿吗?

SceneKit统计信息显示

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: 不确定这一点,因为Apple似乎没有记录究竟“金属冲洗”到底是什么,但我会根据之前的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. 在GPU驱动的应用程序的执行周期中,CPU将数据推送到GPU,等待GPU完成对此数据的操作(可能在此期间执行其他工作),并且一旦GPU完成,推送更多数据并请求更多操作。 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. 通常,“刷新”意味着CPU正在等待GPU完成操作(“清除旧数据”),以便它可以将更多数据推送到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. 因此,如果我的解释是正确的,那就意味着“金属冲洗”测量C​​PU等待视频内存释放的时间,以便它可以推送更多数据并向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. CPU和GPU之间总会有一些通信开销,所以如果你的大部分渲染时间被“Metal Flush”占用,那么这可能意味着你的应用程序运行得足够快,帧之间的大部分延迟都是只是沟通开销。 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. 另一方面,您可能会将大量数据推送到GPU,并且复制数据和处理数据所需的时间可能会导致延迟。 In that case, it would be a bad thing. 在那种情况下,这将是一件坏事。

In the end, the important thing here is to ensure your FPS is consistently high. 最后,重要的是确保您的FPS一直很高。 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. 如果您的FPS因“金属冲洗”而下降,您可能想要尝试将数据传输空间化 - 例如,以块的形式存储纹理和/或使用较低分辨率的纹理可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM