1 | // Copyright (C) 2022 The Qt Company Ltd. |
---|---|
2 | // Copyright (C) 2016 Jolla Ltd, author: <gunnar.sletta@jollamobile.com> |
3 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
4 | |
5 | #ifndef QGFXSHADERBUILDER_P_H |
6 | #define QGFXSHADERBUILDER_P_H |
7 | |
8 | #include <QtCore/QObject> |
9 | #include <QtCore/QVariantMap> |
10 | #include <QtCore/QUrl> |
11 | #include <rhi/qshaderbaker.h> |
12 | |
13 | #include <QtQml/QJSValue> |
14 | #include <QtQml/qqmlregistration.h> |
15 | |
16 | QT_BEGIN_NAMESPACE |
17 | |
18 | class QTemporaryFile; |
19 | class QGfxShaderBuilder : public QObject |
20 | { |
21 | Q_OBJECT |
22 | |
23 | QML_NAMED_ELEMENT(ShaderBuilder) |
24 | QML_SINGLETON |
25 | QML_ADDED_IN_VERSION(5, 0) |
26 | public: |
27 | QGfxShaderBuilder(); |
28 | ~QGfxShaderBuilder() override; |
29 | |
30 | Q_INVOKABLE QVariantMap gaussianBlur(const QJSValue ¶meters); |
31 | Q_INVOKABLE QUrl buildVertexShader(const QByteArray &code); |
32 | Q_INVOKABLE QUrl buildFragmentShader(const QByteArray &code); |
33 | |
34 | private: |
35 | QUrl buildShader(const QByteArray &code, QShader::Stage stage); |
36 | |
37 | int m_maxBlurSamples = 0; |
38 | QShaderBaker m_shaderBaker; |
39 | }; |
40 | |
41 | QT_END_NAMESPACE |
42 | |
43 | #endif // QGFXSHADERBUILDER_P_H |
44 |