QSetFence Class

class Qt3DRender::QSetFence

FrameGraphNode used to insert a fence in the graphics command stream. More...

Header: #include <QSetFence>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
Since: Qt 5.13
Inherits: Qt3DRender::QFrameGraphNode

Public Types

enum HandleType { NoHandle, OpenGLFenceId }


Public Functions

QSetFence(Qt3DCore::QNode *parent = nullptr)
virtual ~QSetFence()
QVariant handle() const
Qt3DRender::QSetFence::HandleType handleType() const


void handleChanged(QVariant handle)
void handleTypeChanged(Qt3DRender::QSetFence::HandleType handleType)

Protected Functions

QSetFence(Qt3DRender::QSetFencePrivate &dd, Qt3DCore::QNode *parent = nullptr)

Detailed Description

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.

QSetFence is a FrameGraph node that inserts a fence into the command stream. It can then be used in conjunction with QWaitFence or by extracting the underlying handle.

The handle property will be updated once the renderer has created the underlying fence resource. The handle will remain valid as long as it remains in the unsignaled state. Once it has reached the signaled state, it will be destroyed and a new handle will be created. That means that depending on how long it takes for the fence to be signaled, the same handle could be used over several frames.

Member Type Documentation

enum QSetFence::HandleType

Property Documentation

[read-only] handle : const QVariant

Holds the underlying fence handle wrapped in a QVariant.

Access functions:

QVariant handle() const

Notifier signal:

void handleChanged(QVariant handle)

[read-only] handleType : const HandleType

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

Access functions:

Qt3DRender::QSetFence::HandleType handleType() const

Notifier signal:

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

Member Function Documentation

QSetFence::QSetFence(Qt3DCore::QNode *parent = nullptr)

Default constructs an instance of QSetFence.

[protected] QSetFence::QSetFence(Qt3DRender::QSetFencePrivate &dd, Qt3DCore::QNode *parent = nullptr)

Default constructs an instance of QSetFence.

[virtual] QSetFence::~QSetFence()

Destroys the instance of QSetFence. The destructor is virtual.

© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.