Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
glsltypes_p.h
Go to the documentation of this file.
1
// Copyright (C) 2021 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
// Qt-Security score:significant reason:default
4
5
6
#
ifndef
QSSG_GLSLTYPES_H
7
#
define
QSSG_GLSLTYPES_H
8
9
//
10
// W A R N I N G
11
// -------------
12
//
13
// This file is not part of the Qt API. It exists purely as an
14
// implementation detail. This header file may change from version to
15
// version without notice, or even be removed.
16
//
17
// We mean it.
18
//
19
20
#
include
<
QtQuick3DGlslParser
/
private
/
glsltype_p
.
h
>
21
#
include
<
QtQuick3DGlslParser
/
private
/
glslsymbol_p
.
h
>
22
#
include
<
QVector
>
23
#
include
<
QHash
>
24
#
include
<
QString
>
25
#
include
<
QStringList
>
26
27
QT_BEGIN_NAMESPACE
28
29
namespace
GLSL
{
30
31
class
Q_QUICK3DGLSLPARSER_EXPORT
ScalarType
:
public
Type
32
{
33
public
:
34
const
ScalarType
*
asScalarType
()
const
override
{
return
this
; }
35
};
36
37
class
Q_QUICK3DGLSLPARSER_EXPORT
UndefinedType
:
public
Type
38
{
39
public
:
40
QString
toString
()
const
override
{
return
QLatin1String
(
"undefined"
); }
41
const
UndefinedType
*
asUndefinedType
()
const
override
{
return
this
; }
42
bool
isEqualTo
(
const
Type
*
other
)
const
override
;
43
bool
isLessThan
(
const
Type
*
other
)
const
override
;
44
};
45
46
class
Q_QUICK3DGLSLPARSER_EXPORT
VoidType
:
public
Type
47
{
48
public
:
49
QString
toString
()
const
override
{
return
QLatin1String
(
"void"
); }
50
const
VoidType
*
asVoidType
()
const
override
{
return
this
; }
51
bool
isEqualTo
(
const
Type
*
other
)
const
override
;
52
bool
isLessThan
(
const
Type
*
other
)
const
override
;
53
};
54
55
class
Q_QUICK3DGLSLPARSER_EXPORT
BoolType
:
public
ScalarType
56
{
57
public
:
58
QString
toString
()
const
override
{
return
QLatin1String
(
"bool"
); }
59
const
BoolType
*
asBoolType
()
const
override
{
return
this
; }
60
bool
isEqualTo
(
const
Type
*
other
)
const
override
;
61
bool
isLessThan
(
const
Type
*
other
)
const
override
;
62
};
63
64
class
Q_QUICK3DGLSLPARSER_EXPORT
IntType
:
public
ScalarType
65
{
66
public
:
67
QString
toString
()
const
override
{
return
QLatin1String
(
"int"
); }
68
const
IntType
*
asIntType
()
const
override
{
return
this
; }
69
bool
isEqualTo
(
const
Type
*
other
)
const
override
;
70
bool
isLessThan
(
const
Type
*
other
)
const
override
;
71
};
72
73
class
Q_QUICK3DGLSLPARSER_EXPORT
UIntType
:
public
ScalarType
74
{
75
public
:
76
QString
toString
()
const
override
{
return
QLatin1String
(
"uint"
); }
77
const
UIntType
*
asUIntType
()
const
override
{
return
this
; }
78
bool
isEqualTo
(
const
Type
*
other
)
const
override
;
79
bool
isLessThan
(
const
Type
*
other
)
const
override
;
80
};
81
82
class
Q_QUICK3DGLSLPARSER_EXPORT
FloatType
:
public
ScalarType
83
{
84
public
:
85
QString
toString
()
const
override
{
return
QLatin1String
(
"float"
); }
86
const
FloatType
*
asFloatType
()
const
override
{
return
this
; }
87
bool
isEqualTo
(
const
Type
*
other
)
const
override
;
88
bool
isLessThan
(
const
Type
*
other
)
const
override
;
89
};
90
91
class
Q_QUICK3DGLSLPARSER_EXPORT
DoubleType
:
public
ScalarType
92
{
93
public
:
94
QString
toString
()
const
override
{
return
QLatin1String
(
"double"
); }
95
const
DoubleType
*
asDoubleType
()
const
override
{
return
this
; }
96
bool
isEqualTo
(
const
Type
*
other
)
const
override
;
97
bool
isLessThan
(
const
Type
*
other
)
const
override
;
98
};
99
100
// Type that can be indexed with the [] operator.
101
class
Q_QUICK3DGLSLPARSER_EXPORT
IndexType
:
public
Type
102
{
103
public
:
104
IndexType
(
const
Type
*
indexElementType
) :
_indexElementType
(
indexElementType
) {}
105
106
const
Type
*
indexElementType
()
const
{
return
_indexElementType
; }
107
108
const
IndexType
*
asIndexType
()
const
override
{
return
this
; }
109
110
private
:
111
const
Type
*
_indexElementType
;
112
};
113
114
class
Q_QUICK3DGLSLPARSER_EXPORT
VectorType
:
public
IndexType
,
public
Scope
115
{
116
public
:
117
VectorType
(
const
Type
*
elementType
,
int
dimension
)
118
:
IndexType
(
elementType
),
_dimension
(
dimension
) {}
119
120
QString
toString
()
const
override
;
121
const
Type
*
elementType
()
const
{
return
indexElementType
(); }
122
int
dimension
()
const
{
return
_dimension
; }
123
124
QList
<
Symbol
*>
members
()
const
override
{
return
_members
.
values
(); }
125
126
void
add
(
Symbol
*
symbol
)
override
;
127
Symbol
*
find
(
const
QString
&
name
)
const
override
;
128
const
Type
*
type
()
const
override
{
return
this
; }
129
130
const
VectorType
*
asVectorType
()
const
override
{
return
this
; }
131
bool
isEqualTo
(
const
Type
*
other
)
const
override
;
132
bool
isLessThan
(
const
Type
*
other
)
const
override
;
133
134
private
:
135
int
_dimension
;
136
QHash
<
QString
,
Symbol
*>
_members
;
137
138
friend
class
Engine
;
139
140
void
populateMembers
(
Engine
*
engine
);
141
void
populateMembers
(
Engine
*
engine
,
const
char
*
components
);
142
};
143
144
class
Q_QUICK3DGLSLPARSER_EXPORT
MatrixType
:
public
IndexType
145
{
146
public
:
147
MatrixType
(
const
Type
*
elementType
,
int
columns
,
int
rows
,
const
Type
*
columnType
)
148
:
IndexType
(
columnType
),
_elementType
(
elementType
),
_columns
(
columns
),
_rows
(
rows
) {}
149
150
const
Type
*
elementType
()
const
{
return
_elementType
; }
151
const
Type
*
columnType
()
const
{
return
indexElementType
(); }
152
int
columns
()
const
{
return
_columns
; }
153
int
rows
()
const
{
return
_rows
; }
154
155
QString
toString
()
const
override
;
156
const
MatrixType
*
asMatrixType
()
const
override
{
return
this
; }
157
bool
isEqualTo
(
const
Type
*
other
)
const
override
;
158
bool
isLessThan
(
const
Type
*
other
)
const
override
;
159
160
private
:
161
const
Type
*
_elementType
;
162
int
_columns
;
163
int
_rows
;
164
};
165
166
class
Q_QUICK3DGLSLPARSER_EXPORT
ArrayType
:
public
IndexType
167
{
168
public
:
169
explicit
ArrayType
(
const
Type
*
elementType
)
170
:
IndexType
(
elementType
) {}
171
172
const
Type
*
elementType
()
const
{
return
indexElementType
(); }
173
174
QString
toString
()
const
override
;
175
const
ArrayType
*
asArrayType
()
const
override
{
return
this
; }
176
bool
isEqualTo
(
const
Type
*
other
)
const
override
;
177
bool
isLessThan
(
const
Type
*
other
)
const
override
;
178
};
179
180
class
Q_QUICK3DGLSLPARSER_EXPORT
Struct
:
public
Type
,
public
Scope
181
{
182
public
:
183
Struct
(
Scope
*
scope
=
nullptr
)
184
:
Scope
(
scope
) {}
185
186
QList
<
Symbol
*>
members
()
const
override
;
187
void
add
(
Symbol
*
member
)
override
;
188
Symbol
*
find
(
const
QString
&
name
)
const
override
;
189
190
// as Type
191
QString
toString
()
const
override
{
return
name
(); }
192
const
Struct
*
asStructType
()
const
override
{
return
this
; }
193
bool
isEqualTo
(
const
Type
*
other
)
const
override
;
194
bool
isLessThan
(
const
Type
*
other
)
const
override
;
195
196
// as Symbol
197
Struct
*
asStruct
()
override
{
return
this
; }
// as Symbol
198
const
Type
*
type
()
const
override
{
return
this
; }
199
200
private
:
201
QVector
<
Symbol
*>
_members
;
202
};
203
204
class
Q_QUICK3DGLSLPARSER_EXPORT
Function
:
public
Type
,
public
Scope
205
{
206
public
:
207
Function
(
Scope
*
scope
=
nullptr
)
208
:
Scope
(
scope
) {}
209
210
const
Type
*
returnType
()
const
;
211
void
setReturnType
(
const
Type
*
returnType
);
212
213
QVector
<
Argument
*>
arguments
()
const
;
214
void
addArgument
(
Argument
*
arg
);
215
int
argumentCount
()
const
;
216
Argument
*
argumentAt
(
int
index
)
const
;
217
218
// as Type
219
QString
prettyPrint
()
const
;
220
QString
toString
()
const
override
;
221
const
Function
*
asFunctionType
()
const
override
{
return
this
; }
222
bool
isEqualTo
(
const
Type
*
other
)
const
override
;
223
bool
isLessThan
(
const
Type
*
other
)
const
override
;
224
225
// as Symbol
226
Function
*
asFunction
()
override
{
return
this
; }
227
const
Type
*
type
()
const
override
{
return
this
; }
228
229
Symbol
*
find
(
const
QString
&
name
)
const
override
;
230
231
QList
<
Symbol
*>
members
()
const
override
;
232
void
add
(
Symbol
*
symbol
)
override
{
233
if
(!
symbol
)
234
return
;
235
else
if
(
Argument
*
arg
=
symbol
->
asArgument
())
236
addArgument
(
arg
);
237
}
238
239
private
:
240
const
Type
*
_returnType
;
241
QVector
<
Argument
*>
_arguments
;
242
};
243
244
class
Q_QUICK3DGLSLPARSER_EXPORT
SamplerType
:
public
Type
245
{
246
public
:
247
explicit
SamplerType
(
int
kind
) :
_kind
(
kind
) {}
248
249
// Kind of sampler as a token code; e.g. T_SAMPLER2D.
250
int
kind
()
const
{
return
_kind
; }
251
252
QString
toString
()
const
override
;
253
const
SamplerType
*
asSamplerType
()
const
override
{
return
this
; }
254
bool
isEqualTo
(
const
Type
*
other
)
const
override
;
255
bool
isLessThan
(
const
Type
*
other
)
const
override
;
256
257
private
:
258
int
_kind
;
259
};
260
261
class
Q_QUICK3DGLSLPARSER_EXPORT
OverloadSet
:
public
Type
,
public
Scope
262
{
263
public
:
264
OverloadSet
(
Scope
*
enclosingScope
=
nullptr
);
265
266
QVector
<
Function
*>
functions
()
const
;
267
void
addFunction
(
Function
*
function
);
268
269
// as symbol
270
OverloadSet
*
asOverloadSet
()
override
{
return
this
; }
271
const
Type
*
type
()
const
override
;
272
Symbol
*
find
(
const
QString
&
name
)
const
override
;
273
void
add
(
Symbol
*
symbol
)
override
;
274
275
// as type
276
QString
toString
()
const
override
{
return
QLatin1String
(
"overload"
); }
277
const
OverloadSet
*
asOverloadSetType
()
const
override
{
return
this
; }
278
bool
isEqualTo
(
const
Type
*
other
)
const
override
;
279
bool
isLessThan
(
const
Type
*
other
)
const
override
;
280
281
private
:
282
QVector
<
Function
*>
_functions
;
283
};
284
285
}
// namespace GLSL
286
287
QT_END_NAMESPACE
288
289
#
endif
// QSSG_GLSLTYPES_H
GLSL::Argument
Definition
glslsymbols_p.h:31
GLSL::ArrayType
Definition
glsltypes_p.h:167
GLSL::Block
Definition
glslsymbols_p.h:63
GLSL::BoolType
Definition
glsltypes_p.h:56
GLSL::DiagnosticMessage
Definition
glslengine_p.h:34
GLSL::DoubleType
Definition
glsltypes_p.h:92
GLSL::Engine
Definition
glslengine_p.h:82
GLSL::FloatType
Definition
glsltypes_p.h:83
GLSL::Function
Definition
glsltypes_p.h:205
GLSL::IndexType
Definition
glsltypes_p.h:102
GLSL::IntType
Definition
glsltypes_p.h:65
GLSL::MatrixType
Definition
glsltypes_p.h:145
GLSL::Namespace
Definition
glslsymbols_p.h:80
GLSL::OverloadSet
Definition
glsltypes_p.h:262
GLSL::SamplerType
Definition
glsltypes_p.h:245
GLSL::ScalarType
Definition
glsltypes_p.h:32
GLSL::Struct
Definition
glsltypes_p.h:181
GLSL::TypeTable
Definition
glslengine_p.h:67
GLSL::TypeTable::intern
const Type * intern(const Type &ty)
Definition
glslengine_p.h:75
GLSL::UIntType
Definition
glsltypes_p.h:74
GLSL::UndefinedType
Definition
glsltypes_p.h:38
GLSL::Variable
Definition
glslsymbols_p.h:45
GLSL::VectorType
Definition
glsltypes_p.h:115
GLSL::VoidType
Definition
glsltypes_p.h:47
GLSL
Definition
glslast_p.h:26
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qrandomaccessasyncfile_darwin.mm:17
GLSL::TypeTable::Compare
Definition
glslengine_p.h:69
GLSL::TypeTable::Compare::operator()
bool operator()(const Type &value, const Type &other) const
Definition
glslengine_p.h:70
qtquick3d
src
glslparser
glsltypes_p.h
Generated on
for Qt by
1.16.1