summaryrefslogtreecommitdiffstats
path: root/tools/qqem/syntaxhighlighterdata.cpp
blob: 52fea5b29c040882380cfefbdbcfdf2880c5a3eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include "syntaxhighlighterdata.h"

static constexpr QByteArrayView shader_arg_names[] {
    { "gl_Position" },
    { "qt_MultiTexCoord0" },
    { "qt_Vertex" },
    { "qt_Matrix" },
    { "qt_Opacity" },
    { "vertCoord" },
    { "fragCoord" },
    { "texCoord" },
    { "fragColor" },
    { "iMouse" },
    { "iResolution" },
    { "iTime" },
    { "iFrame" },
    { "iSource" },
    { "iSourceBlur1" },
    { "iSourceBlur2" },
    { "iSourceBlur3" },
    { "iSourceBlur4" },
    { "iSourceBlur5" },
    { "iSourceBlur6" }
};

static constexpr QByteArrayView shader_tag_names[] {
    { "@main" },
    { "@nodes" },
    { "@mesh" },
    { "@blursources" },
    { "@requires" }
};

// From https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.40.pdf
// Not including functions only available with compatibility profile
static constexpr QByteArrayView shader_function_names[] {
    { "radians()" },
    { "degrees()" },
    { "sin()" },
    { "cos()" },
    { "tan()" },
    { "asin()" },
    { "acos()" },
    { "atan()" },
    { "sinh()" },
    { "cosh()" },
    { "tanh()" },
    { "asinh()" },
    { "acosh()" },
    { "atanh()" },
    { "pow()" },
    { "exp()" },
    { "log()" },
    { "exp2()" },
    { "log2()" },
    { "sqrt()" },
    { "inversesqrt()" },
    { "abs()" },
    { "sign()" },
    { "floor()" },
    { "trunc()" },
    { "round()" },
    { "roundEven()" },
    { "ceil()" },
    { "fract()" },
    { "mod()" },
    { "modf()" },
    { "min()" },
    { "max()" },
    { "clamp()" },
    { "mix()" },
    { "step()" },
    { "smoothstep()" },
    { "isnan()" },
    { "isinf()" },
    { "floatBitsToInt()" },
    { "intBitsToFloat()" },
    { "fma()" },
    { "frexp()" },
    { "ldexp()" },
    { "packUnorm2x16()" },
    { "packSnorm2x16()" },
    { "packUnorm4x8()" },
    { "packSnorm4x8()" },
    { "unpackUnorm2x16()" },
    { "unpackSnorm2x16()" },
    { "unpackUnorm4x8()" },
    { "unpackSnorm4x8()" },
    //{ "packDouble2x32()" }, // Not supported in HLSL
    //{ "unpackDouble2x32()" },
    { "packHalf2x16()" },
    { "unpackHalf2x16()" },
    { "length()" },
    { "distance()" },
    { "dot()" },
    { "cross()" },
    { "normalize()" },
    { "faceforward()" },
    { "reflect()" },
    { "refract()" },
    { "matrixCompMult()" },
    { "outerProduct()" },
    { "transpose()" },
    { "determinant()" },
    { "inverse()" },
    { "lessThan()" },
    { "lessThanEqual()" },
    { "greaterThan()" },
    { "greaterThanEqual()" },
    { "equal()" },
    { "notEqual()" },
    { "any()" },
    { "all()" },
    { "not()" },
    //{ "uaddCarry()" }, // Extended arithmetic is only available from ESSL 310
    //{ "usubBorrow()" },
    //{ "umulExtended()" },
    //{ "imulExtended()" },
    { "bitfieldExtract()" },
    { "bitfieldInsert()" },
    { "bitfieldReverse()" },
    { "bitCount()" },
    { "findLSB()" },
    { "findMSB()" },
    { "textureSize()" },
    //{ "textureQueryLod()" }, // ImageQueryLod is only supported on MSL 2.2 and up.
    //{ "textureQueryLevels()" }, // textureQueryLevels not supported in ES profile.
    { "texture()" },
    { "textureProj()" },
    { "textureLod()" },
    { "textureOffset()" },
    { "texelFetch()" },
    { "texelFetchOffset()" },
    { "textureProjOffset()" },
    { "textureLodOffset()" },
    { "textureProjLod()" },
    { "textureProjLodOffset()" },
    { "textureGrad()" },
    { "textureGradOffset()" },
    { "textureProjGrad()" },
    { "textureProjGradOffset()" },
    //{ "textureGather()" }, // textureGather requires ESSL 310.
    //{ "textureGatherOffset()" },
    //{ "textureGatherOffsets()" },
    //{ "atomicCounterIncrement()" }, // 'atomic counter types' : not allowed when using GLSL for Vulkan
    //{ "atomicCounterDecrement()" },
    //{ "atomicCounter()" },
    //{ "atomicAdd()" }, // HLSL: interlocked targets must be groupshared or UAV elements
    //{ "atomicMin()" },
    //{ "atomicMax()" },
    //{ "atomicAnd()" },
    //{ "atomicOr()" },
    //{ "atomicXor()" },
    //{ "atomicExchange()" },
    //{ "atomicCompSwap()" },
    { "dFdx()" },
    { "dFdy()" },
    { "fwidth()" }
    //{ "interpolateAtCentroid()" }, // Pull-model interpolation requires MSL 2.3.
    //{ "interpolateAtSample()" },
    //{ "interpolateAtOffset()" }
};

SyntaxHighlighterData::SyntaxHighlighterData()
{
}


QList<QByteArrayView> SyntaxHighlighterData::reservedArgumentNames()
{
    return { std::begin(shader_arg_names), std::end(shader_arg_names) };
}

QList<QByteArrayView> SyntaxHighlighterData::reservedTagNames()
{
    return { std::begin(shader_tag_names), std::end(shader_tag_names) };
}

QList<QByteArrayView> SyntaxHighlighterData::reservedFunctionNames()
{
    return { std::begin(shader_function_names), std::end(shader_function_names) };
}