QML 渲染引擎:帧刷新事件

2022-01-19 00:00:00 qt qml c++

性能注意事项和建议文章说:

作为应用程序开发人员,您必须努力允许渲染引擎以实现一致的每秒 60 帧的刷新率.60FPS 意味着每个之间大约有 16 毫秒可以进行处理的框架,其中包括处理需要将绘制图元上传到图形硬件.

As an application developer, you must strive to allow the rendering engine to achieve a consistent 60 frames-per-second refresh rate. 60 FPS means that there is approximately 16 milliseconds between each frame in which processing can be done, which includes the processing required to upload the draw primitives to the graphics hardware.

是否有事件或信号或任何形式的回调使代码在刷新时被调用?

Is there an event or signal or any form of callback to make the code be called with that refresh?

目标是消除在 UI 线程槽中处理来自渲染线程的信号的需要.如果新数据到达,那么它将被绘制或标记为下一次要绘制的刷新(使用 update() 调用).

The goal is to eliminate the need for handling the signal from the rendering thread in the UI thread slot. If the new data arrived then it will be drawn or marked for the next refresh to be drawn (with update() call).

推荐答案

QQuickWindow 有一堆信号用于同步目的 - beforeRendering(), afterRendering()beforeSynchronizing()afterSynchronizing()frameSwapped().任君挑选.

QQuickWindow has a bunch of signals for the purpose of synchronization - beforeRendering(), afterRendering(), beforeSynchronizing(), afterSynchronizing(), frameSwapped(). Take your pick.

相关文章