Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickshadereffect_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKSHADEREFFECT_P_P_H
5#define QQUICKSHADEREFFECT_P_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <private/qtquickglobal_p.h>
19
20QT_REQUIRE_CONFIG(quick_shadereffect);
21
22#include <private/qquickshadereffect_p.h>
23#include <private/qquickitem_p.h>
24#include <private/qquickshadereffectmesh_p.h>
25
27
28namespace QtPrivate {
29class EffectSlotMapper;
30}
31
33{
34 Q_DECLARE_PUBLIC(QQuickShaderEffect)
35
36public:
39
40 void updatePolish() override;
41
42 QUrl fragmentShader() const { return m_fragShader; }
43 void setFragmentShader(const QUrl &fileUrl);
44
45 QUrl vertexShader() const { return m_vertShader; }
46 void setVertexShader(const QUrl &fileUrl);
47
48 bool blending() const { return m_blending; }
49 void setBlending(bool enable);
50
51 QVariant mesh() const;
52 void setMesh(const QVariant &mesh);
53
54 QQuickShaderEffect::CullMode cullMode() const { return m_cullMode; }
56
57 QString log() const;
59
60 bool supportsAtlasTextures() const { return m_supportsAtlasTextures; }
61 void setSupportsAtlasTextures(bool supports);
62
64
65 void handleEvent(QEvent *);
66 void handleGeometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
70 void maybeUpdateShaders();
73
74 void propertyChanged(int mappedId);
75 void sourceDestroyed(QObject *object);
80
81private:
82 QSGGuiThreadShaderEffectManager *shaderEffectManager() const;
83
84 enum Shader {
85 Vertex,
86 Fragment,
87
88 NShader
89 };
90 bool updateShader(Shader shaderType, const QUrl &fileUrl);
91 void updateShaderVars(Shader shaderType);
92 void disconnectSignals(Shader shaderType);
93 void clearMappers(Shader shaderType);
94 std::optional<int> findMappedShaderVariableId(const QByteArray &name) const;
95 std::optional<int> findMappedShaderVariableId(const QByteArray &name, Shader shaderType) const;
96 bool sourceIsUnique(QQuickItem *source, Shader typeToSkip, int indexToSkip) const;
97
98 bool inDestructor = false;
99 const QMetaObject *m_itemMetaObject = nullptr;
100 QSize m_meshResolution;
102 QMetaObject::Connection m_meshConnection;
103 QQuickGridMesh m_defaultMesh;
105 bool m_blending;
106 bool m_supportsAtlasTextures;
107 mutable QSGGuiThreadShaderEffectManager *m_mgr;
108 QUrl m_fragShader;
109 bool m_fragNeedsUpdate;
110 QUrl m_vertShader;
111 bool m_vertNeedsUpdate;
112
113 QSGShaderEffectNode::ShaderData m_shaders[NShader];
114 QSGShaderEffectNode::DirtyShaderFlags m_dirty;
115 QSet<int> m_dirtyConstants[NShader];
116 QSet<int> m_dirtyTextures[NShader];
117 QSGGuiThreadShaderEffectManager::ShaderInfo *m_inProgress[NShader];
118
119 QVector<QtPrivate::EffectSlotMapper *> m_mappers[NShader];
120
121 QHash<QQuickItem *, QMetaObject::Connection> m_destroyedConnections;
122};
123
125
126#endif // QQUICKSHADEREFFECT_P_P_H
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
Definition qcoreevent.h:45
\inmodule QtCore Represents a handle to a signal-slot (or signal-functor) connection.
\inmodule QtCore
Definition qobject.h:103
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:144
QQuickShaderEffect::CullMode cullMode() const
void setVertexShader(const QUrl &fileUrl)
void shaderCodePrepared(bool ok, QSGGuiThreadShaderEffectManager::ShaderInfo::Type typeHint, const QUrl &loadUrl, QSGGuiThreadShaderEffectManager::ShaderInfo *result)
QSGNode * handleUpdatePaintNode(QSGNode *, QQuickItem::UpdatePaintNodeData *)
void setMesh(const QVariant &mesh)
void setSupportsAtlasTextures(bool supports)
bool updateUniformValue(const QByteArray &name, const QVariant &value, QSGShaderEffectNode *node)
QQuickShaderEffect::Status status() const
void setFragmentShader(const QUrl &fileUrl)
void setCullMode(QQuickShaderEffect::CullMode face)
void handleGeometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
void sourceDestroyed(QObject *object)
void handleItemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
\inmodule QtCore\reentrant
Definition qrect.h:484
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
Definition qsgnode.h:37
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qurl.h:94
\inmodule QtCore
Definition qvariant.h:65
Combined button and popup list for selecting options.
\macro QT_NO_KEYWORDS >
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum face
GLboolean enable
GLuint name
GLsizei GLsizei GLchar * source
GLuint64EXT * result
[6]
#define QT_REQUIRE_CONFIG(feature)
\inmodule QtCore
\qmltype MapCircle \instantiates QDeclarativeCircleMapItem \inqmlmodule QtLocation
\inmodule QtQuick
Definition qquickitem.h:159