![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include <qquick3dcomputepass_p.h>
Public Types | |
| enum | ExecutionMode { EveryFrame , OnRequest } |
| enum | ExecutionStage { StartOfFrame , PreColor } |
| Public Types inherited from QQuick3DPropertyChangedTracker | |
| enum class | DirtyPropertyHint { Value , Reference } |
| using | UniformProperty = QSSGUserShaderAugmentation::Property |
| using | UniformPropertyList = QVector<UniformProperty> |
Public Slots | |
| void | setComputeShader (const QUrl &computeShader) |
| void | setExecutionMode (ExecutionMode executionMode) |
| void | setExecutionStage (ExecutionStage executionStage) |
| Public Slots inherited from QQuick3DObject | |
| void | update () |
| void | setParentItem (QQuick3DObject *parentItem) |
| Public Slots inherited from QObject | |
| void | deleteLater () |
| \threadsafe | |
Signals | |
| void | computeShaderChanged () |
| void | executionModeChanged () |
| void | executionStageChanged () |
| Signals inherited from QQuick3DObject | |
| void | parentChanged () |
| void | childrenChanged () |
| void | stateChanged () |
| Signals inherited from QObject | |
| void | destroyed (QObject *=nullptr) |
| This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked. | |
| void | objectNameChanged (const QString &objectName, QPrivateSignal) |
| This signal is emitted after the object's name has been changed. | |
Public Member Functions | |
| QQuick3DComputePass (QQuick3DObject *parent=nullptr) | |
| \qmltype ComputePass \inherits Object3D \inqmlmodule QtQuick3D | |
| QQmlListProperty< QQuick3DShaderUtilsRenderCommand > | commands () |
| QUrl | computeShader () const |
| \qmlproperty url ComputePass::computeShader This property holds the URL of the compute shader used by the pass. | |
| ExecutionMode | executionMode () const |
| \qmlproperty enumeration ComputePass::executionMode | |
| ExecutionStage | executionStage () const |
| Q_INVOKABLE void | requestExecution () |
| \qmlmethod void ComputePass::requestExecution() | |
| Public Member Functions inherited from QObject | |
| Q_INVOKABLE | QObject (QObject *parent=nullptr) |
| Constructs an object with parent object parent. | |
| virtual | ~QObject () |
| Destroys the object, deleting all its child objects. | |
| virtual bool | event (QEvent *event) |
| This virtual function receives events to an object and should return true if the event e was recognized and processed. | |
| virtual bool | eventFilter (QObject *watched, QEvent *eventevent) |
| Filters events if this object has been installed as an event filter for the watched object. | |
| QString | objectName () const |
| Q_WEAK_OVERLOAD void | setObjectName (const QString &namename) |
| Sets the object's name to name. | |
| void | setObjectName (QAnyStringView namename) |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| QBindable< QString > | bindableObjectName () |
| bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false. | |
| bool | isWindowType () const |
Returns true if the object is a window; otherwise returns false. | |
| bool | isQuickItemType () const |
Returns true if the object is a QQuickItem; otherwise returns false. | |
| bool | isQmlExposed () const noexcept |
| Returns whether the object has been created by the QML engine or ownership has been explicitly set via QJSEngine::setObjectOwnership(). | |
| bool | signalsBlocked () const noexcept |
Returns true if signals are blocked; otherwise returns false. | |
| bool | blockSignals (bool b) noexcept |
| If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). | |
| QThread * | thread () const |
| Returns the thread in which the object lives. | |
| bool | moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL) |
Changes the thread affinity for this object and its children and returns true on success. | |
| int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
| This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds. | |
| int | startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer) |
| void | killTimer (int idid) |
| Kills the timer with timer identifier, id. | |
| void | killTimer (Qt::TimerId idid) |
| template<typename T> | |
| T | findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
| Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object. | |
| template<typename T> | |
| QList< T > | findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
| Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. | |
| template<typename T> | |
| T | findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| template<typename T> | |
| QList< T > | findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| const QObjectList & | children () const |
| Returns a list of child objects. | |
| void | setParent (QObject *parent) |
| Makes the object a child of parent. | |
| void | installEventFilter (QObject *filterObj) |
| Installs an event filter filterObj on this object. | |
| void | removeEventFilter (QObject *objobj) |
| Removes an event filter object obj from this object. | |
| QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType typetype=Qt::AutoConnection) const |
| bool | disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const |
| bool | disconnect (const QObject *receiver, const char *member=nullptr) const |
| void | dumpObjectTree () const |
| Dumps a tree of children to the debug output. | |
| void | dumpObjectInfo () const |
| Dumps information about signal connections, etc. | |
| bool | setProperty (const char *namename, const QVariant &valuevalue) |
| Sets the value of the object's name property to value. | |
| bool | setProperty (const char *namename, QVariant &&valuevalue) |
| QVariant | property (const char *namename) const |
| Returns the value of the object's name property. | |
| QList< QByteArray > | dynamicPropertyNames () const |
| QBindingStorage * | bindingStorage () |
| const QBindingStorage * | bindingStorage () const |
| QObject * | parent () const |
| Returns a pointer to the parent object. | |
| bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. | |
| Public Member Functions inherited from QQmlParserStatus | |
| QQmlParserStatus () | |
| virtual | ~QQmlParserStatus () |
| Public Member Functions inherited from QQuick3DPropertyChangedTracker | |
| template<typename T> | |
| QQuick3DPropertyChangedTracker (QQuick3DObject *owner, QQuick3DSuperClassInfo< T > info) | |
| virtual | ~QQuick3DPropertyChangedTracker () |
Protected Member Functions | |
| void | markAllDirty () override |
| QSSGRenderGraphObject * | updateSpatialNode (QSSGRenderGraphObject *node) override |
| void | itemChange (QQuick3DObject::ItemChange, const QQuick3DObject::ItemChangeData &) override |
| void | markTrackedPropertyDirty (QMetaProperty property, QQuick3DPropertyChangedTracker::DirtyPropertyHint hint) override |
| Protected Member Functions inherited from QQuick3DObject | |
| virtual void | itemChange (ItemChange, const ItemChangeData &) |
| QQuick3DObject (QQuick3DObjectPrivate &dd, QQuick3DObject *parent=nullptr) | |
| void | classBegin () override |
| Invoked after class creation, but before any properties have been set. | |
| void | componentComplete () override |
| Invoked after the root component that caused this instantiation has completed construction. | |
| bool | isComponentComplete () const |
| virtual void | preSync () |
| Protected Member Functions inherited from QObject | |
| QObject * | sender () const |
| Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr. | |
| int | senderSignalIndex () const |
| int | receivers (const char *signal) const |
| Returns the number of receivers connected to the signal. | |
| bool | isSignalConnected (const QMetaMethod &signal) const |
| virtual void | timerEvent (QTimerEvent *eventevent) |
| This event handler can be reimplemented in a subclass to receive timer events for the object. | |
| virtual void | childEvent (QChildEvent *eventevent) |
| This event handler can be reimplemented in a subclass to receive child events. | |
| virtual void | customEvent (QEvent *eventevent) |
| This event handler can be reimplemented in a subclass to receive custom events. | |
| virtual void | connectNotify (const QMetaMethod &signal) |
| virtual void | disconnectNotify (const QMetaMethod &signal) |
| QObject (QObjectPrivate &dd, QObject *parent=nullptr) | |
| Protected Member Functions inherited from QQuick3DPropertyChangedTracker | |
| QList< UniformProperty > | extractProperties () |
| void | addPropertyWatcher (QMetaProperty property, DirtyPropertyHint hint, QQuick3DObject *objectobject=nullptr) |
| void | addDirtyProperty (int pid) |
| void | updateTrackedSceneManager (QQuick3DSceneManager *sceneManager) |
Properties | |
| QQmlListProperty< QQuick3DShaderUtilsRenderCommand > | commands |
| \qmlproperty list<Command> ComputePass::commands This property holds the list of commands for the compute pass. | |
| QUrl | computeShader |
| ExecutionMode | executionMode |
| ExecutionStage | executionStage |
| Properties inherited from QQuick3DObject | |
| QQuick3DObject * | parent |
| \qmlproperty Object3D QtQuick3D::Object3D::parent This property holds the parent of the Object3D in a 3D scene. | |
| Properties inherited from QObject | |
| QString | objectName |
| the name of this object | |
Additional Inherited Members | |
| Static Public Member Functions inherited from QObject | |
| static QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
| \threadsafe | |
| static QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType typetype=Qt::AutoConnection) |
| template<typename Func1, typename Func2> | |
| static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType typetype=Qt::AutoConnection) |
| template<typename Func1, typename Func2> | |
| static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot) |
| static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
| \threadsafe | |
| static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
| static bool | disconnect (const QMetaObject::Connection &) |
| Disconnects connection and resets it to \l{QMetaObject::Connection::operator bool()}{invalid}. | |
| static bool | disconnect (QMetaObject::Connection &) |
| static bool | disconnect (QMetaObject::Connection &&conn) |
| Disconnect a connection. | |
| template<typename Func1, typename Func2> | |
| static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot) |
| template<typename Func1> | |
| static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero) |
| Protected Attributes inherited from QObject | |
| QScopedPointer< QObjectData > | d_ptr |
| Protected Attributes inherited from QQuick3DPropertyChangedTracker | |
| QHash< int, Tracked > | m_trackedProperties |
| QQuick3DObject * | m_owner = nullptr |
| const char * | m_superClassName = nullptr |
| QList< UniformProperty > | m_propertyList |
| Related Symbols inherited from QObject | |
| template< class T > T | qobject_cast (const QObject *objectobject) |
| Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns \nullptr. | |
| QObjectList | |
| \macro Q_CLASSINFO(Name, Value) | |
Definition at line 26 of file qquick3dcomputepass_p.h.
| Enumerator | |
|---|---|
| EveryFrame | |
| OnRequest | |
Definition at line 36 of file qquick3dcomputepass_p.h.
| Enumerator | |
|---|---|
| StartOfFrame | |
| PreColor | |
Definition at line 42 of file qquick3dcomputepass_p.h.
|
explicit |
\qmltype ComputePass \inherits Object3D \inqmlmodule QtQuick3D
Defines a custom compute shader pass.
A ComputePass runs a GLSL compute shader as part of the 3D scene's rendering pipeline. Unlike a \l RenderPass or an \l Effect, a ComputePass does not render any geometry itself; it is used to prepare or process data that is later consumed by a material, an \l Effect, or another ComputePass – typically data written into a \l ShaderImage or a \l ShaderStorageBuffer.
A ComputePass becomes active for a scene when it is placed as a child of a \l View3D, a \l Node, or another pass. Within a single frame, a ComputePass by default executes after the scene's internal preparation passes, which produce the depth, normal, and ambient occlusion textures, the shadow maps, the screen texture, the reflection probes, and the textures of texture provider extensions, and before the scene's main pass. Its results are therefore visible to the main pass and the effects of the same frame, but not to those preparation passes. See \l executionStage for executing the pass before them. By default the pass executes in every rendered frame; see \l executionMode and \l requestExecution() for executing it only when needed.
DEPTH_TEXTURE, SCREEN_TEXTURE, the ambient occlusion, and the reflection probes are one frame behind the main pass, and see uninitialized content in the first frame. Set \l executionStage to ComputePass.StartOfFrame to avoid this.The order against other passes, \l RenderPass and ComputePass alike, is expressed by nesting: a nested pass runs before its parent, so a pass that produces data for another one is declared inside its consumer. The relative order of passes at the same nesting depth is not defined. See \l{Pass Ordering} for the details.
The following example dispatches a compute shader that fills a \l ShaderImage with a solid color, one invocation per texel:
\qml import QtQuick3D
View3D { ShaderImage { id: myImage width: 256 height: 256 }
ComputePass { computeShader: "fill.comp" property ShaderImage targetImage: myImage commands: [ Dispatch { groupCountX: (myImage.width + 7) / 8 groupCountY: (myImage.height + 7) / 8 } ] } } \endqml
Definition at line 318 of file qquick3dcomputepass.cpp.
| QQmlListProperty< QQuick3DShaderUtilsRenderCommand > QQuick3DComputePass::commands | ( | ) |
| QUrl QQuick3DComputePass::computeShader | ( | ) | const |
\qmlproperty url ComputePass::computeShader This property holds the URL of the compute shader used by the pass.
As with the shader properties of \l RenderPass, \l Effect, and \l CustomMaterial, relative URLs are resolved relative to the component's (the {.qml} file's) location, and it is possible to omit the file scheme.
Definition at line 546 of file qquick3dcomputepass.cpp.
|
signal |
| QQuick3DComputePass::ExecutionMode QQuick3DComputePass::executionMode | ( | ) | const |
\qmlproperty enumeration ComputePass::executionMode
This property determines in which frames the pass executes.
\value ComputePass.EveryFrame The pass executes in every frame the View3D renders. This is the default. \value ComputePass.OnRequest The pass executes once when it first can, and after that once for each call to \l requestExecution().
Use OnRequest for a pass that initializes data, and for a pass whose input changes only occasionally, calling \l requestExecution() when the input changes:
\qml PerspectiveCamera { id: camera onScenePositionChanged: cullPass.requestExecution() }
ComputePass { id: cullPass executionMode: ComputePass.OnRequest computeShader: "cull.comp" // reads CAMERA_POSITION } \endqml
A pass that is due to execute but cannot, for example because its shader failed to compile or the View3D has no camera, keeps the request until it can. A pass whose \l Dispatch has a group count of 0 does not execute, so a pass is disabled by setting a group count to 0. An OnRequest pass executes once when it is enabled if it has a request pending, including the initial one.
EveryFrame, the pass executes only in the frames that are rendered for some other reason.false. For occasional resets, such as restarting a simulation, use \l{ShaderStorageBuffer::requestClear()}{requestClear()}.Definition at line 608 of file qquick3dcomputepass.cpp.
|
signal |
| QQuick3DComputePass::ExecutionStage QQuick3DComputePass::executionStage | ( | ) | const |
\qmlproperty enumeration ComputePass::executionStage
This property determines where in the frame the pass executes. The
stages are listed in the order they execute in.
\value ComputePass.StartOfFrame
The pass executes before any of the built-in passes, and before
texture and buffer provider extensions. This stage is meant for
producing data that the built-in passes consume, for example a
buffer a vertex shader reads, so that the shadow maps are rendered
from the same data as the scene. A pass in this stage cannot rely on
the built-in textures: \c SCREEN_TEXTURE, \c DEPTH_TEXTURE,
\c AO_TEXTURE, and \c NORMAL_ROUGHNESS_TEXTURE are not available
to it, and the shadow maps, when the scene has them, are from the
previous frame, and do not exist yet in the first frame. Similarly,
the output of a texture or buffer provider extension, such as a
\l{ShaderStorageBuffer::bufferProvider}{bufferProvider}, is from the
previous frame.
\value ComputePass.PreColor
The pass executes together with the scene's \l{RenderPass}{RenderPasses},
after the built-in passes that produce the depth, normal, ambient
occlusion, and screen textures, the shadow maps, and the reflection
probes, and before the main pass, which renders the scene's opaque
and transparent objects. This is the default.
A pass never executes in a later stage than a pass it is nested in, so
that a nested pass always executes before its ancestors. A pass therefore
executes in the earliest of its own stage and the stages of the passes
it is nested in. A \l RenderPass nested in a ComputePass in the
\c StartOfFrame stage executes in that stage too, with the same
limitations on the built-in textures. A pass
that only produces data for a \c StartOfFrame pass does not need to set
the stage itself:
\qml
ComputePass {
id: consumer
executionMode: ComputePass.OnRequest
executionStage: ComputePass.StartOfFrame
ComputePass {
id: producer
Executes in the StartOfFrame stage, before consumer. } } \endqml
Definition at line 670 of file qquick3dcomputepass.cpp.
|
signal |
|
overrideprotected |
Definition at line 400 of file qquick3dcomputepass.cpp.
|
inlineoverrideprotectedvirtual |
Reimplemented from QQuick3DObject.
Definition at line 72 of file qquick3dcomputepass_p.h.
|
overrideprotectedvirtual |
Implements QQuick3DPropertyChangedTracker.
Definition at line 414 of file qquick3dcomputepass.cpp.
| void QQuick3DComputePass::requestExecution | ( | ) |
\qmlmethod void ComputePass::requestExecution()
Requests that the pass executes in the next frame. This also makes the View3D render that frame, so the request does not wait for something else to change in the scene. Several calls before that frame result in a single execution. A request made while the pass cannot execute, for example while the View3D is not rendering, is kept until it can. When several View3D objects in the same window show the scene the pass belongs to, the pass executes in only one of them per request, since they share its buffers and images.
This works with any \l executionMode.
Definition at line 700 of file qquick3dcomputepass.cpp.
Definition at line 551 of file qquick3dcomputepass.cpp.
|
slot |
Definition at line 613 of file qquick3dcomputepass.cpp.
|
slot |
Definition at line 675 of file qquick3dcomputepass.cpp.
|
overrideprotectedvirtual |
Reimplemented from QQuick3DObject.
Definition at line 324 of file qquick3dcomputepass.cpp.
|
read |
\qmlproperty list<Command> ComputePass::commands This property holds the list of commands for the compute pass.
The commands in the list are executed in the order they appear in the list. The only commands relevant to a ComputePass are \l Dispatch and \l AddDefine.
Dispatch specifies how many work groups to dispatch the compute shader with. A ComputePass without a Dispatch command does not execute its shader. If more than one Dispatch command is present, only the first one is executed. Setting any group count of the Dispatch command to 0 disables the ComputePass.
AddDefine injects a {#define} into the shader compilation for a \l ComputePass. This lets you branch shader behavior at compile time depending on which pass is being executed.
Definition at line 29 of file qquick3dcomputepass_p.h.
|
readwrite |
Definition at line 30 of file qquick3dcomputepass_p.h.
|
readwrite |
Definition at line 31 of file qquick3dcomputepass_p.h.
|
readwrite |
Definition at line 32 of file qquick3dcomputepass_p.h.