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
4#ifndef QSSG_GLSLENGINE_H
5#define QSSG_GLSLENGINE_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 <QtQuick3DGlslParser/private/glsl_p.h>
19#include <QtQuick3DGlslParser/private/glslmemorypool_p.h>
20#include <QtQuick3DGlslParser/private/glsltypes_p.h>
21#include <qstring.h>
22
23#include <functional>
24#include <set>
25#include <unordered_set>
26
27QT_BEGIN_NAMESPACE
28
29namespace GLSL {
30
31class Q_QUICK3DGLSLPARSER_EXPORT DiagnosticMessage
32{
33public:
34 enum Kind {
37 };
38
40
41 Kind kind() const;
42 void setKind(Kind kind);
43
44 bool isError() const;
45 bool isWarning() const;
46
47 QString fileName() const;
48 void setFileName(const QString &fileName);
49
50 int line() const;
51 void setLine(int line);
52
53 QString message() const;
54 void setMessage(const QString &message);
55
56private:
59 Kind _kind;
60 int _line;
61};
62
63template <typename Type>
65{
66public:
67 struct Compare {
68 bool operator()(const Type &value, const Type &other) const {
69 return value.isLessThan(&other);
70 }
71 };
72
73 const Type *intern(const Type &ty) { return &*_entries.insert(ty).first; }
74
75private:
76 std::set<Type, Compare> _entries;
77};
78
79class Q_QUICK3DGLSLPARSER_EXPORT Engine
80{
81public:
82 Engine();
83 ~Engine();
84
85 const QString *identifier(const QString &s);
86 const QString *identifier(const char *s, int n);
88
89 const QString *number(const QString &s);
90 const QString *number(const char *s, int n);
92
93 // types
95 const VoidType *voidType();
96 const BoolType *boolType();
97 const IntType *intType();
98 const UIntType *uintType();
99 const FloatType *floatType();
100 const DoubleType *doubleType();
101 const SamplerType *samplerType(int kind);
102 const VectorType *vectorType(const Type *elementType, int dimension);
103 const MatrixType *matrixType(const Type *elementType, int columns, int rows);
104 const ArrayType *arrayType(const Type *elementType);
105
106 // symbols
108 Struct *newStruct(Scope *scope = nullptr);
109 Block *newBlock(Scope *scope = nullptr);
110 Function *newFunction(Scope *scope = nullptr);
112 Variable *newVariable(Scope *scope, const QString &name, const Type *type, int qualifiers = 0);
113
114 MemoryPool *pool();
115
120 void warning(int line, const QString &message);
121 void error(int line, const QString &message);
122
123private:
134};
135
136} // namespace GLSL
137
138QT_END_NAMESPACE
139
140#endif // QSSG_GLSLENGINE_H
const Type * intern(const Type &ty)
bool operator()(const Type &value, const Type &other) const