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
glslengine_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_GLSLENGINE_H
7
#
define
QSSG_GLSLENGINE_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
/
glsl_p
.
h
>
21
#
include
<
QtQuick3DGlslParser
/
private
/
glslmemorypool_p
.
h
>
22
#
include
<
QtQuick3DGlslParser
/
private
/
glsltypes_p
.
h
>
23
#
include
<
qstring
.
h
>
24
25
#
include
<
functional
>
26
#
include
<
set
>
27
#
include
<
unordered_set
>
28
29
QT_BEGIN_NAMESPACE
30
31
namespace
GLSL
{
32
33
class
Q_QUICK3DGLSLPARSER_EXPORT
DiagnosticMessage
34
{
35
public
:
36
enum
Kind
{
37
Warning
,
38
Error
39
};
40
41
DiagnosticMessage
();
42
43
Kind
kind
()
const
;
44
void
setKind
(
Kind
kind
);
45
46
bool
isError
()
const
;
47
bool
isWarning
()
const
;
48
49
QString
fileName
()
const
;
50
void
setFileName
(
const
QString
&
fileName
);
51
52
int
line
()
const
;
53
void
setLine
(
int
line
);
54
55
QString
message
()
const
;
56
void
setMessage
(
const
QString
&
message
);
57
58
private
:
59
QString
_fileName
;
60
QString
_message
;
61
Kind
_kind
;
62
int
_line
;
63
};
64
65
template
<
typename
Type>
66
class
TypeTable
67
{
68
public
:
69
struct
Compare
{
70
bool
operator
()(
const
Type &value,
const
Type &other)
const
{
71
return
value.isLessThan(&other);
72
}
73
};
74
75
const
Type *
intern
(
const
Type &ty) {
return
&*_entries.insert(ty).first; }
76
77
private
:
78
std::set<Type, Compare> _entries;
79
};
80
81
class
Q_QUICK3DGLSLPARSER_EXPORT
Engine
82
{
83
public
:
84
Engine
();
85
~
Engine
();
86
87
const
QString
*
identifier
(
const
QString
&
s
);
88
const
QString
*
identifier
(
const
char
*
s
,
int
n
);
89
std
::
unordered_set
<
QString
>
identifiers
()
const
;
90
91
const
QString
*
number
(
const
QString
&
s
);
92
const
QString
*
number
(
const
char
*
s
,
int
n
);
93
std
::
unordered_set
<
QString
>
numbers
()
const
;
94
95
// types
96
const
UndefinedType
*
undefinedType
();
97
const
VoidType
*
voidType
();
98
const
BoolType
*
boolType
();
99
const
IntType
*
intType
();
100
const
UIntType
*
uintType
();
101
const
FloatType
*
floatType
();
102
const
DoubleType
*
doubleType
();
103
const
SamplerType
*
samplerType
(
int
kind
);
104
const
VectorType
*
vectorType
(
const
Type
*
elementType
,
int
dimension
);
105
const
MatrixType
*
matrixType
(
const
Type
*
elementType
,
int
columns
,
int
rows
);
106
const
ArrayType
*
arrayType
(
const
Type
*
elementType
);
107
108
// symbols
109
Namespace
*
newNamespace
();
110
Struct
*
newStruct
(
Scope
*
scope
=
nullptr
);
111
Block
*
newBlock
(
Scope
*
scope
=
nullptr
);
112
Function
*
newFunction
(
Scope
*
scope
=
nullptr
);
113
Argument
*
newArgument
(
Function
*
function
,
const
QString
&
name
,
const
Type
*
type
);
114
Variable
*
newVariable
(
Scope
*
scope
,
const
QString
&
name
,
const
Type
*
type
,
int
qualifiers
= 0);
115
116
MemoryPool
*
pool
();
117
118
bool
blockDiagnosticMessages
(
bool
block
);
119
QList
<
DiagnosticMessage
>
diagnosticMessages
()
const
;
120
void
clearDiagnosticMessages
();
121
void
addDiagnosticMessage
(
const
DiagnosticMessage
&
m
);
122
void
warning
(
int
line
,
const
QString
&
message
);
123
void
error
(
int
line
,
const
QString
&
message
);
124
125
private
:
126
std
::
unordered_set
<
QString
>
_identifiers
;
127
std
::
unordered_set
<
QString
>
_numbers
;
128
TypeTable
<
VectorType
>
_vectorTypes
;
129
TypeTable
<
MatrixType
>
_matrixTypes
;
130
TypeTable
<
ArrayType
>
_arrayTypes
;
131
TypeTable
<
SamplerType
>
_samplerTypes
;
132
MemoryPool
_pool
;
133
QList
<
DiagnosticMessage
>
_diagnosticMessages
;
134
QList
<
Symbol
*>
_symbols
;
135
bool
_blockDiagnosticMessages
;
136
};
137
138
}
// namespace GLSL
139
140
QT_END_NAMESPACE
141
142
#
endif
// QSSG_GLSLENGINE_H
GLSL::DiagnosticMessage
Definition
glslengine_p.h:34
GLSL::Engine
Definition
glslengine_p.h:82
GLSL::TypeTable
Definition
glslengine_p.h:67
GLSL::TypeTable::intern
const Type * intern(const Type &ty)
Definition
glslengine_p.h:75
GLSL
Definition
glslast_p.h:26
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
glslengine_p.h
Generated on
for Qt by
1.16.1