QComputeCommand Class
class Qt3DRender::QComputeCommandQComponent to issue work for the compute shader on GPU. More...
Header: | #include <QComputeCommand> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS 3drender) target_link_libraries(mytarget PRIVATE Qt6::3drender) |
qmake: | QT += 3drender |
Instantiated By: | ComputeCommand |
Inherits: | Qt3DCore::QComponent |
Properties
- runType : RunType
- workGroupX : int
- workGroupY : int
- workGroupZ : int
Public Functions
QComputeCommand(Qt3DCore::QNode *parent = nullptr) | |
Qt3DRender::QComputeCommand::RunType | runType() const |
int | workGroupX() const |
int | workGroupY() const |
int | workGroupZ() const |
Public Slots
void | setRunType(Qt3DRender::QComputeCommand::RunType runType) |
void | setWorkGroupX(int workGroupX) |
void | setWorkGroupY(int workGroupY) |
void | setWorkGroupZ(int workGroupZ) |
void | trigger(int frameCount = 1) |
void | trigger(int workGroupX, int workGroupY, int workGroupZ, int frameCount = 1) |
Signals
void | runTypeChanged() |
void | workGroupXChanged() |
void | workGroupYChanged() |
void | workGroupZChanged() |
Detailed Description
A Qt3DRender::QComputeCommand is used to issue work for the compute shader. The compute shader is specified in the QMaterial component of the same entity the QComputeCommand is added to. The workGroupX, workGroupY and workGroupZ properties specify the work group sizes for the compute shader invocation. Qt3DRender::QDispatchCompute node needs to be present in the FrameGraph to actually issue the commands.
Note: If the rendering policy is set to Qt3DRender::QRenderSettings::OnDemand and there are no changes to the scene, the ComputeCommand will not be invoked repeatedly. The Qt3DRender::QRenderSettings::Always render policy must be set for the ComputeCommand to be repeatedly invoked if there are no other changes to the scene that triggers rendering a new frame.
Property Documentation
runType : RunType
Specifies whether the compute command should be performed every frame or manually triggered.
If set to Continuous, Compute command is executed everyframe. This is the default.
If set to Manual CompouteCommand is executed for a given number of frames and then the component disables itself.
Access functions:
Qt3DRender::QComputeCommand::RunType | runType() const |
void | setRunType(Qt3DRender::QComputeCommand::RunType runType) |
Notifier signal:
void | runTypeChanged() |
workGroupX : int
Specifies X workgroup size.
Access functions:
int | workGroupX() const |
void | setWorkGroupX(int workGroupX) |
Notifier signal:
void | workGroupXChanged() |
workGroupY : int
Specifies Y workgroup size.
Access functions:
int | workGroupY() const |
void | setWorkGroupY(int workGroupY) |
Notifier signal:
void | workGroupYChanged() |
workGroupZ : int
Specifies Z workgroup size.
Access functions:
int | workGroupZ() const |
void | setWorkGroupZ(int workGroupZ) |
Notifier signal:
void | workGroupZChanged() |
Member Function Documentation
[explicit]
QComputeCommand::QComputeCommand(Qt3DCore::QNode *parent = nullptr)
The constructor creates a new Qt3DRender::QComputeCommand instance with the specified parent.
[slot]
void QComputeCommand::setWorkGroupX(int workGroupX)
Sets the workgroup for the first dimension to workGroupX.
Note: Setter function for property workGroupX.
See also workGroupX().
[slot]
void QComputeCommand::setWorkGroupY(int workGroupY)
Sets the workgroup for the second dimension to workGroupY.
Note: Setter function for property workGroupY.
See also workGroupY().
[slot]
void QComputeCommand::setWorkGroupZ(int workGroupZ)
Sets the workgroup for the third dimension to workGroupZ.
Note: Setter function for property workGroupZ.
See also workGroupZ().
[slot]
void QComputeCommand::trigger(int frameCount = 1)
When the run type is set to Manual, calling trigger will make the compute command be executed for the next frameCount frames. Upon completion of the execution, the enabled property will be set to false.
[slot]
void QComputeCommand::trigger(int workGroupX, int workGroupY, int workGroupZ, int frameCount = 1)
When the run type is set to Manual, calling trigger will make the compute command be executed for the next frameCount frames. Upon completion of the execution, the enabled property will be set to false. The size of the workgroup previously set will be overridden with workGroupX, workGroupY, workGroupZ.