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
qsgmaterialshader_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 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 QSGMATERIALSHADER_P_H
5#define QSGMATERIALSHADER_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#include "qsgmaterialshader.h"
20#include "qsgmaterial.h"
21#include <rhi/qrhi.h>
22#include <rhi/qshader.h>
23
25
26class QRhiSampler;
27
28class Q_QUICK_EXPORT QSGMaterialShaderPrivate
29{
30public:
31 Q_DECLARE_PUBLIC(QSGMaterialShader)
32
34 static QSGMaterialShaderPrivate *get(QSGMaterialShader *s) { return s->d_func(); }
35 static const QSGMaterialShaderPrivate *get(const QSGMaterialShader *s) { return s->d_func(); }
36
37 void clearCachedRendererData();
38 void prepare(QShader::Variant vertexShaderVariant);
39
40 QShader shader(QShader::Stage stage) const { return shaders[stage].shader; }
41
42 static QShader loadShader(const QString &filename);
43
45 QHash<QShader::Stage, QString> shaderFileNames;
46 QSGMaterialShader::Flags flags;
47
49 ShaderStageData() { } // so shader.isValid() == false
53 QVector<int> vertexInputLocations; // excluding rewriter-inserted ones
54 int qt_order_attrib_location = -1; // rewriter-inserted
55 };
56 QHash<QShader::Stage, ShaderStageData> shaders;
57
58 static const int MAX_SHADER_RESOURCE_BINDINGS = 32;
59
60 int ubufBinding = -1;
61 int ubufSize = 0;
62 QRhiShaderResourceBinding::StageFlags ubufStages;
63 QRhiShaderResourceBinding::StageFlags combinedImageSamplerBindings[MAX_SHADER_RESOURCE_BINDINGS];
64 int combinedImageSamplerCount[MAX_SHADER_RESOURCE_BINDINGS];
65
66 ShaderStageData *vertexShader = nullptr;
67 ShaderStageData *fragmentShader = nullptr;
68
70
71 QVarLengthArray<QSGTexture *, 4> textureBindingTable[MAX_SHADER_RESOURCE_BINDINGS];
72 QVarLengthArray<QRhiSampler *, 4> samplerBindingTable[MAX_SHADER_RESOURCE_BINDINGS];
73};
74
76
78
79#endif
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtGui
Definition qrhi.h:1030
QSGMaterialShader::Flags flags
static QSGMaterialShaderPrivate * get(QSGMaterialShader *s)
QRhiShaderResourceBinding::StageFlags ubufStages
static const QSGMaterialShaderPrivate * get(const QSGMaterialShader *s)
QShader shader(QShader::Stage stage) const
QHash< QShader::Stage, ShaderStageData > shaders
QHash< QShader::Stage, QString > shaderFileNames
The QSGMaterialShader class represents a graphics API independent shader program.
\inmodule QtGui
Definition qshader.h:81
QShaderCode shader(const QShaderKey &key) const
Definition qshader.cpp:395
Variant
Describes what kind of shader code an entry contains.
Definition qshader.h:103
@ StandardShader
Definition qshader.h:104
Stage
Describes the stage of the graphics pipeline the shader is suitable for.
Definition qshader.h:83
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
Combined button and popup list for selecting options.
GLdouble s
[6]
Definition qopenglext.h:235
GLuint shader
Definition qopenglext.h:665
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLsizei GLsizei GLuint * shaders
Definition qopenglext.h:677
@ Q_RELOCATABLE_TYPE
Definition qtypeinfo.h:158
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
Definition qtypeinfo.h:180