本页内容

ComputeCommand QML Type

用于向 GPU 上的计算着色器分发任务的组件。更多...

Import Statement: import Qt3D.Render 2.12
In C++: QComputeCommand
Inherits:

Component3D

Status: Deprecated

此类型已弃用。我们强烈建议不要在新代码中使用它。

属性

详细说明

ComputeCommand 用于向计算着色器分配任务。计算着色器在与 ComputeCommand 添加到同一实体的 Material 组件中进行指定。workGroupX 、workGroupY 和workGroupZ 属性用于指定计算着色器调用时的工作组大小。FrameGraph 中必须存在DispatchCompute 节点,才能实际发出这些命令。可以通过 run type 属性控制计算命令的执行行为。

注意:如果 渲染策略设置为RenderSettings.OnDemand,且运行类型设置为 Continuous,同时场景未发生任何变化,则 ComputeCommand 不会被反复调用。若要使 ComputeCommand 在场景未发生其他变化(即未触发新帧渲染)时仍被反复调用,必须将渲染策略设置为RenderSettings.Always。

属性文档

runType : enumeration

指定计算命令是应每帧执行一次,还是手动触发。

常量描述
ComputeCommand.Continuous计算命令每帧执行一次。这是默认设置。
ComputeCommand.Manual“ComputeCommand”将执行指定帧数,之后该组件会自动禁用。

workGroupX : int

指定 X 工作组的大小。

workGroupY : int

指定 Y 工作组的大小。

workGroupZ : int

指定 Z 工作组的大小。

© 2026 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.