QWaitFence Class

class Qt3DRender ::QWaitFence

FrameGraphNode used to wait for a fence in the graphics command stream to become signaled. 更多...

头: #include <QWaitFence>
CMake: find_package(Qt6 COMPONENTS 3drender REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
Since: Qt 5.13
继承: Qt3DRender::QFrameGraphNode

特性

公共函数

QVariant handle () const
Qt3DRender::QWaitFence::HandleType handleType () const
void setHandle (QVariant handle )
void setHandleType (Qt3DRender::QWaitFence::HandleType type )
void setTimeout (quint64 timeout )
void setWaitOnCPU (bool waitOnCPU )
quint64 timeout () const
bool waitOnCPU () const

信号

void handleChanged (QVariant handle )
void handleTypeChanged (Qt3DRender::QWaitFence::HandleType handleType )
void timeoutChanged (quint64 timeoutChanged )
void waitOnCPUChanged (bool waitOnCPU )

详细描述

Fence allow to synchronosize GPU and CPU workloads. GPU commands usually are non-blocking. When issued, commands are inserted in command buffers which will be read at a later time by the GPU. In some cases, you want to continue processing or issue specific command only when you are sure a command has been executed by the hardware. Fences are a way to do so. This is especially important when using 3rd party engines with Qt3D, Qt3D should only access shared resources when we know the other engine command are done modifying the resource.

QWaitFence is a FrameGraph node that will force to wait for it to become signaled before subsequent commands are inserted into the command stream. It can then be used in conjunction with QSetFence and contains properties to configure how long it should wait and whether it should block on the CPU side.

注意: Qt 3D uploads GPU resources (Texture, Shaders, Buffers) before issuing draw calls.

特性文档编制

handle : QVariant

Holds the underlying fence handle wrapped in a QVariant .

访问函数:

QVariant handle () const
void setHandle (QVariant handle )

通知程序信号:

void handleChanged (QVariant handle )

handleType : HandleType

Specifies the type of handle being used. Currently only OpenGL Fence ids are supported.

访问函数:

Qt3DRender::QWaitFence::HandleType handleType () const
void setHandleType (Qt3DRender::QWaitFence::HandleType type )

通知程序信号:

void handleTypeChanged (Qt3DRender::QWaitFence::HandleType handleType )

timeout : quint64

Specifies the maximum amount of time in nanoseconds to wait for the fence to become signaled.

访问函数:

quint64 timeout () const
void setTimeout (quint64 timeout )

通知程序信号:

void timeoutChanged (quint64 timeoutChanged )

waitOnCPU : bool

Specifies whether the CPU should be block while waiting for the fence to become signaled. This is false by default.

访问函数:

bool waitOnCPU () const
void setWaitOnCPU (bool waitOnCPU )

通知程序信号:

void waitOnCPUChanged (bool waitOnCPU )