![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
#include <qquick3dshaderimage_p.h>
Public Types | |
| enum | ImageShape { Image1D , Image2D , Image3D , Image2DArray , ImageCube } |
| enum | ImageFormat { RGBA8 , R8 , RG8 , R16 , RG16 , RGBA16F , RGBA32F , R16F , R32F , RGB10A2 , R8SI , R32SI , RG32SI , RGBA32SI , R8UI , R32UI , RG32UI , RGBA32UI } |
Public Slots | |
| void | setShape (QQuick3DShaderImage::ImageShape shape) |
| void | setWidth (int widthwidth) |
| void | setHeight (int heightheight) |
| void | setDepth (int depthdepth) |
| void | setArraySize (int arraySize) |
| void | setFormat (QQuick3DShaderImage::ImageFormat formatformat) |
| Public Slots inherited from QQuick3DObject | |
| void | update () |
| void | setParentItem (QQuick3DObject *parentItem) |
| Public Slots inherited from QObject | |
| void | deleteLater () |
| \threadsafe | |
Signals | |
| void | shapeChanged () |
| void | widthChanged () |
| void | heightChanged () |
| void | depthChanged () |
| void | arraySizeChanged () |
| void | formatChanged () |
| 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 | |
| Q_ENUM (ImageFormat) | |
| QQuick3DShaderImage (QQuick3DObject *parent=nullptr) | |
| \qmltype ShaderImage \inherits Object3D \inqmlmodule QtQuick3D | |
| ~QQuick3DShaderImage () override | |
| QQuick3DShaderImage::ImageShape | shape () const |
\qmlproperty enumeration ShaderImage::shape This property holds the shape of the image: the kind of GPU texture that is created, and the GLSL image type that the shader's SHADER_IMAGE declaration has to use. | |
| int | width () const |
| \qmlproperty int ShaderImage::width This property holds the width of the image, in texels. | |
| int | height () const |
| \qmlproperty int ShaderImage::height This property holds the height of the image, in texels. | |
| int | depth () const |
| \qmlproperty int ShaderImage::depth This property holds the depth of the image, in texels. | |
| int | arraySize () const |
| \qmlproperty int ShaderImage::arraySize This property holds the number of images in the array. | |
| QQuick3DShaderImage::ImageFormat | format () const |
| \qmlproperty enumeration ShaderImage::format This property holds the pixel format of the image. | |
| 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 () |
Protected Member Functions | |
| QSSGRenderGraphObject * | updateSpatialNode (QSSGRenderGraphObject *node) override |
| void | markAllDirty () override |
| void | markSizeDirty () |
| 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) | |
Properties | |
| ImageShape | shape |
| int | width |
| int | height |
| int | depth |
| int | arraySize |
| ImageFormat | format |
| 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 |
| 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 25 of file qquick3dshaderimage_p.h.
| Enumerator | |
|---|---|
| RGBA8 | |
| R8 | |
| RG8 | |
| R16 | |
| RG16 | |
| RGBA16F | |
| RGBA32F | |
| R16F | |
| R32F | |
| RGB10A2 | |
| R8SI | |
| R32SI | |
| RG32SI | |
| RGBA32SI | |
| R8UI | |
| R32UI | |
| RG32UI | |
| RGBA32UI | |
Definition at line 47 of file qquick3dshaderimage_p.h.
| Enumerator | |
|---|---|
| Image1D | |
| Image2D | |
| Image3D | |
| Image2DArray | |
| ImageCube | |
Definition at line 38 of file qquick3dshaderimage_p.h.
|
explicit |
\qmltype ShaderImage \inherits Object3D \inqmlmodule QtQuick3D
Declares a GPU image resource that shaders can read and write.
A ShaderImage is a GPU-side image resource with an explicit \l shape, size and pixel \l format, with no content of its own. Unlike \l Texture, it is not loaded from an image file or a \l TextureData. It is meant to be written to or read from directly in shader code (typically in a \l ComputePass, via imageStore()/imageLoad(), but also from a \l CustomMaterial or an \l Effect), rather than sampled as a regular texture.
A ShaderImage is exposed to a shader by using it as a property in the ComputePass, RenderPass, Effect or CustomMaterial:
\qml ShaderImage { id: myImage width: 256 height: 256 }
ComputePass { computeShader: "generate.comp" property ShaderImage targetImage: myImage } \endqml
In the shader, the property is declared with the SHADER_IMAGE macro, using the same name as the QML property (targetImage in the example above), and is then used like a regular GLSL image variable:
\badcode SHADER_IMAGE(rgba8, targetImage, image2D, writeonly);
void main() { imageStore(targetImage, ivec2(gl_GlobalInvocationID.xy), vec4(1.0, 0.0, 0.0, 1.0)); }
The first argument to SHADER_IMAGE is the GLSL image format (such as rgba8 or r32ui), which must match the ShaderImage's \l format. The third argument is the GLSL image type, which must match the ShaderImage's \l shape, with an i or u prefix for an integer \l format (for example image2D, or uimage3D for a three-dimensional image in an unsigned integer format). A ShaderImage whose format or shape does not match the declaration is reported with a warning, and the shader cannot be used; this also applies when the format or the shape changes later. The image type can be followed by any combination of the memory qualifiers readonly, writeonly, coherent, volatile, and restrict, separated by spaces or commas, matching the GLSL memory qualifiers of the same names. Without qualifiers, the image has implicit read-write access. Any other word is rejected with a warning, and the shader cannot be used. The semicolon after the declaration is optional.
r32f, r32i, and r32ui formats. An image in any other format has to be declared either readonly or writeonly, otherwise the shader fails to compile on OpenGL ES. Not all formats are available on OpenGL ES either; see \l format.The declaration is recognized by scanning the shader source before any preprocessing takes place. The format, the name, the image type and the memory qualifiers must therefore be written out as plain identifiers; a {#define}'d format is not recognized. Each name can be declared only once in a shader, even in different preprocessor branches, and its format must match the \l format property. Declarations inside comments are ignored. A declaration that does not follow this form is reported with a warning, and the shader cannot be used.
{imageAtomicAdd()} and friends) are not supported with the Metal graphics API. Such shaders translate and compile, but the results are undefined, because the translation relies on a hidden helper buffer that is never bound. Atomics on a \l ShaderStorageBuffer are not affected and work on all backends.Definition at line 94 of file qquick3dshaderimage.cpp.
|
override |
Definition at line 100 of file qquick3dshaderimage.cpp.
| int QQuick3DShaderImage::arraySize | ( | ) | const |
\qmlproperty int ShaderImage::arraySize This property holds the number of images in the array.
It is only used by an Image2DArray \l shape. The default value is 1. Values smaller than 1 are ignored.
Definition at line 183 of file qquick3dshaderimage.cpp.
|
signal |
| int QQuick3DShaderImage::depth | ( | ) | const |
\qmlproperty int ShaderImage::depth This property holds the depth of the image, in texels.
It is only used by an Image3D \l shape. The default value is 1. Values smaller than 1 are ignored.
This is a size, not the number of bits per pixel that QImage::depth() returns.
Definition at line 172 of file qquick3dshaderimage.cpp.
|
signal |
| QQuick3DShaderImage::ImageFormat QQuick3DShaderImage::format | ( | ) | const |
\qmlproperty enumeration ShaderImage::format This property holds the pixel format of the image.
The default value is {ShaderImage.RGBA8}, an 8-bit-per-channel unsigned normalized RGBA image.
Each value corresponds to one GLSL image format qualifier, which is what the shader's SHADER_IMAGE declaration has to name as its format argument. The two must match: a mismatch is reported as a warning and leaves the image unusable by that shader.
\value ShaderImage.RGBA8 rgba8, the default. \value ShaderImage.R8 r8 \value ShaderImage.RG8 rg8 \value ShaderImage.R16 r16 \value ShaderImage.RG16 rg16 \value ShaderImage.RGBA16F rgba16f \value ShaderImage.RGBA32F rgba32f \value ShaderImage.R16F r16f \value ShaderImage.R32F r32f \value ShaderImage.RGB10A2 rgb10_a2, a packed format with 10 bits per color channel and 2 bits of alpha. \value ShaderImage.R8SI r8i, a signed integer format. \value ShaderImage.R32SI r32i \value ShaderImage.RG32SI rg32i \value ShaderImage.RGBA32SI rgba32i \value ShaderImage.R8UI r8ui, an unsigned integer format. \value ShaderImage.R32UI r32ui \value ShaderImage.RG32UI rg32ui \value ShaderImage.RGBA32UI rgba32ui
An integer format must be declared with a matching integer image type in the shader (iimage2D for the signed and uimage2D for the unsigned variants, rather than image2D), and is read and written with ivec4/ than uvec4 rathervec4.
RGBA8, RGBA16F, RGBA32F, R32F, R32SI, RGBA32SI, R32UI, and RGBA32UI. The other formats (R8, RG8, R16, RG16, R16F, RGB10A2, R8SI, R8UI, RG32SI, and RG32UI) are only available with desktop OpenGL, Vulkan, Metal, and Direct3D. On OpenGL ES, a shader that declares one of them fails to build. Of the supported formats, all except R32F, R32SI, and R32UI also need a readonly or writeonly qualifier in the SHADER_IMAGE declaration on OpenGL ES.Setting a value outside this enumeration is ignored, with a warning, and the previous format is retained.
Definition at line 237 of file qquick3dshaderimage.cpp.
|
signal |
| int QQuick3DShaderImage::height | ( | ) | const |
\qmlproperty int ShaderImage::height This property holds the height of the image, in texels.
It is not used by an Image1D \l shape. The default value is 1. Values smaller than 1 are ignored.
Definition at line 158 of file qquick3dshaderimage.cpp.
|
signal |
|
overrideprotectedvirtual |
Reimplemented from QQuick3DObject.
Definition at line 342 of file qquick3dshaderimage.cpp.
|
protected |
Definition at line 290 of file qquick3dshaderimage.cpp.
| QQuick3DShaderImage::Q_ENUM | ( | ImageFormat | ) |
|
slot |
Definition at line 281 of file qquick3dshaderimage.cpp.
|
slot |
Definition at line 272 of file qquick3dshaderimage.cpp.
|
slot |
Definition at line 328 of file qquick3dshaderimage.cpp.
|
slot |
Definition at line 263 of file qquick3dshaderimage.cpp.
|
slot |
Definition at line 242 of file qquick3dshaderimage.cpp.
|
slot |
Definition at line 254 of file qquick3dshaderimage.cpp.
| QQuick3DShaderImage::ImageShape QQuick3DShaderImage::shape | ( | ) | const |
\qmlproperty enumeration ShaderImage::shape This property holds the shape of the image: the kind of GPU texture that is created, and the GLSL image type that the shader's SHADER_IMAGE declaration has to use.
The default value is {ShaderImage.Image2D}.
\value ShaderImage.Image1D A one-dimensional image of \l width texels, image1D in the shader. \value ShaderImage.Image2D A two-dimensional image of \l width by \l height texels, image2D in the shader. \value ShaderImage.Image3D A three-dimensional image of \l width by \l height by \l depth texels, image3D in the shader. \value ShaderImage.Image2DArray An array of \l arraySize two-dimensional images of \l width by \l height texels, image2DArray in the shader. \value ShaderImage.ImageCube A cube map with six faces of \l width by \l height texels, imageCube in the shader. The width and the height must be equal.
The size properties that a shape does not use are ignored. With an integer \l format, the image type has an i or u prefix, such as iimage2D or uimage3D.
imageCube fails to build there. Arrays of one-dimensional images and arrays of cube maps are not supported.Setting a value outside this enumeration is ignored, with a warning, and the previous shape is retained.
Definition at line 137 of file qquick3dshaderimage.cpp.
|
signal |
|
overrideprotectedvirtual |
Reimplemented from QQuick3DObject.
Definition at line 361 of file qquick3dshaderimage.cpp.
| int QQuick3DShaderImage::width | ( | ) | const |
\qmlproperty int ShaderImage::width This property holds the width of the image, in texels.
The default value is 1. Values smaller than 1 are ignored.
Definition at line 147 of file qquick3dshaderimage.cpp.
|
signal |
|
readwrite |
Definition at line 32 of file qquick3dshaderimage_p.h.
|
readwrite |
Definition at line 31 of file qquick3dshaderimage_p.h.
|
readwrite |
Definition at line 33 of file qquick3dshaderimage_p.h.
|
readwrite |
Definition at line 30 of file qquick3dshaderimage_p.h.
|
readwrite |
Definition at line 28 of file qquick3dshaderimage_p.h.
|
readwrite |
Definition at line 29 of file qquick3dshaderimage_p.h.