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
29QT_BEGIN_NAMESPACE
30
31namespace GLSL {
32
33class Q_QUICK3DGLSLPARSER_EXPORT DiagnosticMessage
34{
35public:
36 enum Kind {
39 };
40
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
58private:
61 Kind _kind;
62 int _line;
63};
64
65template <typename Type>
67{
68public:
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
77private:
78 std::set<Type, Compare> _entries;
79};
80
81class Q_QUICK3DGLSLPARSER_EXPORT Engine
82{
83public:
84 Engine();
85 ~Engine();
86
87 const QString *identifier(const QString &s);
88 const QString *identifier(const char *s, int n);
90
91 const QString *number(const QString &s);
92 const QString *number(const char *s, int n);
94
95 // types
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
110 Struct *newStruct(Scope *scope = nullptr);
111 Block *newBlock(Scope *scope = nullptr);
112 Function *newFunction(Scope *scope = nullptr);
114 Variable *newVariable(Scope *scope, const QString &name, const Type *type, int qualifiers = 0);
115
116 MemoryPool *pool();
117
122 void warning(int line, const QString &message);
123 void error(int line, const QString &message);
124
125private:
136};
137
138} // namespace GLSL
139
140QT_END_NAMESPACE
141
142#endif // QSSG_GLSLENGINE_H
const Type * intern(const Type &ty)
bool operator()(const Type &value, const Type &other) const