Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/thirdparty/glslang/glslang/MachineIndependent/Initialize.cpp
10933 views
1
//
2
// Copyright (C) 2002-2005 3Dlabs Inc. Ltd.
3
// Copyright (C) 2012-2016 LunarG, Inc.
4
// Copyright (C) 2015-2020 Google, Inc.
5
// Copyright (C) 2017, 2022-2024 Arm Limited.
6
// Modifications Copyright (C) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
7
//
8
// All rights reserved.
9
//
10
// Redistribution and use in source and binary forms, with or without
11
// modification, are permitted provided that the following conditions
12
// are met:
13
//
14
// Redistributions of source code must retain the above copyright
15
// notice, this list of conditions and the following disclaimer.
16
//
17
// Redistributions in binary form must reproduce the above
18
// copyright notice, this list of conditions and the following
19
// disclaimer in the documentation and/or other materials provided
20
// with the distribution.
21
//
22
// Neither the name of 3Dlabs Inc. Ltd. nor the names of its
23
// contributors may be used to endorse or promote products derived
24
// from this software without specific prior written permission.
25
//
26
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
29
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
30
// COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
32
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
34
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
36
// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37
// POSSIBILITY OF SUCH DAMAGE.
38
//
39
40
//
41
// Create strings that declare built-in definitions, add built-ins programmatically
42
// that cannot be expressed in the strings, and establish mappings between
43
// built-in functions and operators.
44
//
45
// Where to put a built-in:
46
// TBuiltIns::initialize(version,profile) context-independent textual built-ins; add them to the right string
47
// TBuiltIns::initialize(resources,...) context-dependent textual built-ins; add them to the right string
48
// TBuiltIns::identifyBuiltIns(...,symbolTable) context-independent programmatic additions/mappings to the symbol table,
49
// including identifying what extensions are needed if a version does not allow a symbol
50
// TBuiltIns::identifyBuiltIns(...,symbolTable, resources) context-dependent programmatic additions/mappings to the symbol table,
51
// including identifying what extensions are needed if a version does not allow a symbol
52
//
53
54
#include <array>
55
#include "Initialize.h"
56
#include "span.h"
57
58
namespace glslang {
59
60
// TODO: ARB_Compatability: do full extension support
61
const bool ARBCompatibility = true;
62
63
const bool ForwardCompatibility = false;
64
65
namespace {
66
67
//
68
// A set of definitions for tabling of the built-in functions.
69
//
70
71
// Order matters here, as does correlation with the subsequent
72
// "const int ..." declarations and the ArgType enumerants.
73
const char* TypeString[] = {
74
"bool", "bvec2", "bvec3", "bvec4",
75
"float", "vec2", "vec3", "vec4",
76
"int", "ivec2", "ivec3", "ivec4",
77
"uint", "uvec2", "uvec3", "uvec4",
78
};
79
const int TypeStringCount = sizeof(TypeString) / sizeof(char*); // number of entries in 'TypeString'
80
const int TypeStringRowShift = 2; // shift amount to go downe one row in 'TypeString'
81
const int TypeStringColumnMask = (1 << TypeStringRowShift) - 1; // reduce type to its column number in 'TypeString'
82
const int TypeStringScalarMask = ~TypeStringColumnMask; // take type to its scalar column in 'TypeString'
83
84
enum ArgType {
85
// numbers hardcoded to correspond to 'TypeString'; order and value matter
86
TypeB = 1 << 0, // Boolean
87
TypeF = 1 << 1, // float 32
88
TypeI = 1 << 2, // int 32
89
TypeU = 1 << 3, // uint 32
90
TypeF16 = 1 << 4, // float 16
91
TypeF64 = 1 << 5, // float 64
92
TypeI8 = 1 << 6, // int 8
93
TypeI16 = 1 << 7, // int 16
94
TypeI64 = 1 << 8, // int 64
95
TypeU8 = 1 << 9, // uint 8
96
TypeU16 = 1 << 10, // uint 16
97
TypeU64 = 1 << 11, // uint 64
98
};
99
// Mixtures of the above, to help the function tables
100
const ArgType TypeFI = static_cast<ArgType>(TypeF | TypeI);
101
const ArgType TypeFIB = static_cast<ArgType>(TypeF | TypeI | TypeB);
102
const ArgType TypeIU = static_cast<ArgType>(TypeI | TypeU);
103
104
// The relationships between arguments and return type, whether anything is
105
// output, or other unusual situations.
106
enum ArgClass {
107
ClassRegular = 0, // nothing special, just all vector widths with matching return type; traditional arithmetic
108
ClassLS = 1 << 0, // the last argument is also held fixed as a (type-matched) scalar while the others cycle
109
ClassXLS = 1 << 1, // the last argument is exclusively a (type-matched) scalar while the others cycle
110
ClassLS2 = 1 << 2, // the last two arguments are held fixed as a (type-matched) scalar while the others cycle
111
ClassFS = 1 << 3, // the first argument is held fixed as a (type-matched) scalar while the others cycle
112
ClassFS2 = 1 << 4, // the first two arguments are held fixed as a (type-matched) scalar while the others cycle
113
ClassLO = 1 << 5, // the last argument is an output
114
ClassB = 1 << 6, // return type cycles through only bool/bvec, matching vector width of args
115
ClassLB = 1 << 7, // last argument cycles through only bool/bvec, matching vector width of args
116
ClassV1 = 1 << 8, // scalar only
117
ClassFIO = 1 << 9, // first argument is inout
118
ClassRS = 1 << 10, // the return is held scalar as the arguments cycle
119
ClassNS = 1 << 11, // no scalar prototype
120
ClassCV = 1 << 12, // first argument is 'coherent volatile'
121
ClassFO = 1 << 13, // first argument is output
122
ClassV3 = 1 << 14, // vec3 only
123
};
124
// Mixtures of the above, to help the function tables
125
const ArgClass ClassV1FIOCV = (ArgClass)(ClassV1 | ClassFIO | ClassCV);
126
const ArgClass ClassBNS = (ArgClass)(ClassB | ClassNS);
127
const ArgClass ClassRSNS = (ArgClass)(ClassRS | ClassNS);
128
129
// A descriptor, for a single profile, of when something is available.
130
// If the current profile does not match 'profile' mask below, the other fields
131
// do not apply (nor validate).
132
// profiles == EBadProfile is the end of an array of these
133
struct Versioning {
134
EProfile profiles; // the profile(s) (mask) that the following fields are valid for
135
int minExtendedVersion; // earliest version when extensions are enabled; ignored if numExtensions is 0
136
int minCoreVersion; // earliest version function is in core; 0 means never
137
int numExtensions; // how many extensions are in the 'extensions' list
138
const char** extensions; // list of extension names enabling the function
139
};
140
141
EProfile EDesktopProfile = static_cast<EProfile>(ENoProfile | ECoreProfile | ECompatibilityProfile);
142
143
// Declare pointers to put into the table for versioning.
144
const std::array Es300Desktop130Version = { Versioning{ EEsProfile, 0, 300, 0, nullptr },
145
Versioning{ EDesktopProfile, 0, 130, 0, nullptr },
146
};
147
148
const std::array Es310Desktop400Version = { Versioning{ EEsProfile, 0, 310, 0, nullptr },
149
Versioning{ EDesktopProfile, 0, 400, 0, nullptr },
150
};
151
152
const std::array Es310Desktop450Version = { Versioning{ EEsProfile, 0, 310, 0, nullptr },
153
Versioning{ EDesktopProfile, 0, 450, 0, nullptr },
154
};
155
156
// The main descriptor of what a set of function prototypes can look like, and
157
// a pointer to extra versioning information, when needed.
158
struct BuiltInFunction {
159
TOperator op; // operator to map the name to
160
const char* name; // function name
161
int numArguments; // number of arguments (overloads with varying arguments need different entries)
162
ArgType types; // ArgType mask
163
ArgClass classes; // the ways this particular function entry manifests
164
const span<const Versioning> versioning; // An empty span means always a valid version
165
};
166
167
// The tables can have the same built-in function name more than one time,
168
// but the exact same prototype must be indicated at most once.
169
// The prototypes that get declared are the union of all those indicated.
170
// This is important when different releases add new prototypes for the same name.
171
// It also also congnitively simpler tiling of the prototype space.
172
// In practice, most names can be fully represented with one entry.
173
//
174
// Table is terminated by an OpNull TOperator.
175
176
const std::array BaseFunctions = {
177
// TOperator, name, arg-count, ArgType, ArgClass, versioning
178
// --------- ---- --------- ------- -------- ----------
179
BuiltInFunction{ EOpRadians, "radians", 1, TypeF, ClassRegular, {} },
180
BuiltInFunction{ EOpDegrees, "degrees", 1, TypeF, ClassRegular, {} },
181
BuiltInFunction{ EOpSin, "sin", 1, TypeF, ClassRegular, {} },
182
BuiltInFunction{ EOpCos, "cos", 1, TypeF, ClassRegular, {} },
183
BuiltInFunction{ EOpTan, "tan", 1, TypeF, ClassRegular, {} },
184
BuiltInFunction{ EOpAsin, "asin", 1, TypeF, ClassRegular, {} },
185
BuiltInFunction{ EOpAcos, "acos", 1, TypeF, ClassRegular, {} },
186
BuiltInFunction{ EOpAtan, "atan", 2, TypeF, ClassRegular, {} },
187
BuiltInFunction{ EOpAtan, "atan", 1, TypeF, ClassRegular, {} },
188
BuiltInFunction{ EOpPow, "pow", 2, TypeF, ClassRegular, {} },
189
BuiltInFunction{ EOpExp, "exp", 1, TypeF, ClassRegular, {} },
190
BuiltInFunction{ EOpLog, "log", 1, TypeF, ClassRegular, {} },
191
BuiltInFunction{ EOpExp2, "exp2", 1, TypeF, ClassRegular, {} },
192
BuiltInFunction{ EOpLog2, "log2", 1, TypeF, ClassRegular, {} },
193
BuiltInFunction{ EOpSqrt, "sqrt", 1, TypeF, ClassRegular, {} },
194
BuiltInFunction{ EOpInverseSqrt, "inversesqrt", 1, TypeF, ClassRegular, {} },
195
BuiltInFunction{ EOpAbs, "abs", 1, TypeF, ClassRegular, {} },
196
BuiltInFunction{ EOpSign, "sign", 1, TypeF, ClassRegular, {} },
197
BuiltInFunction{ EOpFloor, "floor", 1, TypeF, ClassRegular, {} },
198
BuiltInFunction{ EOpCeil, "ceil", 1, TypeF, ClassRegular, {} },
199
BuiltInFunction{ EOpFract, "fract", 1, TypeF, ClassRegular, {} },
200
BuiltInFunction{ EOpMod, "mod", 2, TypeF, ClassLS, {} },
201
BuiltInFunction{ EOpMin, "min", 2, TypeF, ClassLS, {} },
202
BuiltInFunction{ EOpMax, "max", 2, TypeF, ClassLS, {} },
203
BuiltInFunction{ EOpClamp, "clamp", 3, TypeF, ClassLS2, {} },
204
BuiltInFunction{ EOpMix, "mix", 3, TypeF, ClassLS, {} },
205
BuiltInFunction{ EOpStep, "step", 2, TypeF, ClassFS, {} },
206
BuiltInFunction{ EOpSmoothStep, "smoothstep", 3, TypeF, ClassFS2, {} },
207
BuiltInFunction{ EOpNormalize, "normalize", 1, TypeF, ClassRegular, {} },
208
BuiltInFunction{ EOpFaceForward, "faceforward", 3, TypeF, ClassRegular, {} },
209
BuiltInFunction{ EOpReflect, "reflect", 2, TypeF, ClassRegular, {} },
210
BuiltInFunction{ EOpRefract, "refract", 3, TypeF, ClassXLS, {} },
211
BuiltInFunction{ EOpLength, "length", 1, TypeF, ClassRS, {} },
212
BuiltInFunction{ EOpDistance, "distance", 2, TypeF, ClassRS, {} },
213
BuiltInFunction{ EOpDot, "dot", 2, TypeF, ClassRS, {} },
214
BuiltInFunction{ EOpCross, "cross", 2, TypeF, ClassV3, {} },
215
BuiltInFunction{ EOpLessThan, "lessThan", 2, TypeFI, ClassBNS, {} },
216
BuiltInFunction{ EOpLessThanEqual, "lessThanEqual", 2, TypeFI, ClassBNS, {} },
217
BuiltInFunction{ EOpGreaterThan, "greaterThan", 2, TypeFI, ClassBNS, {} },
218
BuiltInFunction{ EOpGreaterThanEqual, "greaterThanEqual", 2, TypeFI, ClassBNS, {} },
219
BuiltInFunction{ EOpVectorEqual, "equal", 2, TypeFIB, ClassBNS, {} },
220
BuiltInFunction{ EOpVectorNotEqual, "notEqual", 2, TypeFIB, ClassBNS, {} },
221
BuiltInFunction{ EOpAny, "any", 1, TypeB, ClassRSNS, {} },
222
BuiltInFunction{ EOpAll, "all", 1, TypeB, ClassRSNS, {} },
223
BuiltInFunction{ EOpVectorLogicalNot, "not", 1, TypeB, ClassNS, {} },
224
BuiltInFunction{ EOpSinh, "sinh", 1, TypeF, ClassRegular, {Es300Desktop130Version} },
225
BuiltInFunction{ EOpCosh, "cosh", 1, TypeF, ClassRegular, {Es300Desktop130Version} },
226
BuiltInFunction{ EOpTanh, "tanh", 1, TypeF, ClassRegular, {Es300Desktop130Version} },
227
BuiltInFunction{ EOpAsinh, "asinh", 1, TypeF, ClassRegular, {Es300Desktop130Version} },
228
BuiltInFunction{ EOpAcosh, "acosh", 1, TypeF, ClassRegular, {Es300Desktop130Version} },
229
BuiltInFunction{ EOpAtanh, "atanh", 1, TypeF, ClassRegular, {Es300Desktop130Version} },
230
BuiltInFunction{ EOpAbs, "abs", 1, TypeI, ClassRegular, {Es300Desktop130Version} },
231
BuiltInFunction{ EOpSign, "sign", 1, TypeI, ClassRegular, {Es300Desktop130Version} },
232
BuiltInFunction{ EOpTrunc, "trunc", 1, TypeF, ClassRegular, {Es300Desktop130Version} },
233
BuiltInFunction{ EOpRound, "round", 1, TypeF, ClassRegular, {Es300Desktop130Version} },
234
BuiltInFunction{ EOpRoundEven, "roundEven", 1, TypeF, ClassRegular, {Es300Desktop130Version} },
235
BuiltInFunction{ EOpModf, "modf", 2, TypeF, ClassLO, {Es300Desktop130Version} },
236
BuiltInFunction{ EOpMin, "min", 2, TypeIU, ClassLS, {Es300Desktop130Version} },
237
BuiltInFunction{ EOpMax, "max", 2, TypeIU, ClassLS, {Es300Desktop130Version} },
238
BuiltInFunction{ EOpClamp, "clamp", 3, TypeIU, ClassLS2, {Es300Desktop130Version} },
239
BuiltInFunction{ EOpMix, "mix", 3, TypeF, ClassLB, {Es300Desktop130Version} },
240
BuiltInFunction{ EOpIsInf, "isinf", 1, TypeF, ClassB, {Es300Desktop130Version} },
241
BuiltInFunction{ EOpIsNan, "isnan", 1, TypeF, ClassB, {Es300Desktop130Version} },
242
BuiltInFunction{ EOpLessThan, "lessThan", 2, TypeU, ClassBNS, {Es300Desktop130Version} },
243
BuiltInFunction{ EOpLessThanEqual, "lessThanEqual", 2, TypeU, ClassBNS, {Es300Desktop130Version} },
244
BuiltInFunction{ EOpGreaterThan, "greaterThan", 2, TypeU, ClassBNS, {Es300Desktop130Version} },
245
BuiltInFunction{ EOpGreaterThanEqual, "greaterThanEqual", 2, TypeU, ClassBNS, {Es300Desktop130Version} },
246
BuiltInFunction{ EOpVectorEqual, "equal", 2, TypeU, ClassBNS, {Es300Desktop130Version} },
247
BuiltInFunction{ EOpVectorNotEqual, "notEqual", 2, TypeU, ClassBNS, {Es300Desktop130Version} },
248
BuiltInFunction{ EOpAtomicAdd, "atomicAdd", 2, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },
249
BuiltInFunction{ EOpAtomicMin, "atomicMin", 2, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },
250
BuiltInFunction{ EOpAtomicMax, "atomicMax", 2, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },
251
BuiltInFunction{ EOpAtomicAnd, "atomicAnd", 2, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },
252
BuiltInFunction{ EOpAtomicOr, "atomicOr", 2, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },
253
BuiltInFunction{ EOpAtomicXor, "atomicXor", 2, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },
254
BuiltInFunction{ EOpAtomicExchange, "atomicExchange", 2, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },
255
BuiltInFunction{ EOpAtomicCompSwap, "atomicCompSwap", 3, TypeIU, ClassV1FIOCV, {Es310Desktop400Version} },
256
BuiltInFunction{ EOpMix, "mix", 3, TypeB, ClassRegular, {Es310Desktop450Version} },
257
BuiltInFunction{ EOpMix, "mix", 3, TypeIU, ClassLB, {Es310Desktop450Version} },
258
};
259
260
const std::array DerivativeFunctions = {
261
BuiltInFunction{ EOpDPdx, "dFdx", 1, TypeF, ClassRegular, {} },
262
BuiltInFunction{ EOpDPdy, "dFdy", 1, TypeF, ClassRegular, {} },
263
BuiltInFunction{ EOpFwidth, "fwidth", 1, TypeF, ClassRegular, {} },
264
};
265
266
// For functions declared some other way, but still use the table to relate to operator.
267
struct CustomFunction {
268
TOperator op; // operator to map the name to
269
const char* name; // function name
270
const span<const Versioning> versioning; // An empty span means always a valid version
271
};
272
273
const CustomFunction CustomFunctions[] = {
274
{ EOpBarrier, "barrier", {} },
275
{ EOpMemoryBarrierShared, "memoryBarrierShared", {} },
276
{ EOpGroupMemoryBarrier, "groupMemoryBarrier", {} },
277
{ EOpMemoryBarrier, "memoryBarrier", {} },
278
{ EOpMemoryBarrierBuffer, "memoryBarrierBuffer", {} },
279
280
{ EOpPackSnorm2x16, "packSnorm2x16", {} },
281
{ EOpUnpackSnorm2x16, "unpackSnorm2x16", {} },
282
{ EOpPackUnorm2x16, "packUnorm2x16", {} },
283
{ EOpUnpackUnorm2x16, "unpackUnorm2x16", {} },
284
{ EOpPackHalf2x16, "packHalf2x16", {} },
285
{ EOpUnpackHalf2x16, "unpackHalf2x16", {} },
286
287
{ EOpMul, "matrixCompMult", {} },
288
{ EOpOuterProduct, "outerProduct", {} },
289
{ EOpTranspose, "transpose", {} },
290
{ EOpDeterminant, "determinant", {} },
291
{ EOpMatrixInverse, "inverse", {} },
292
{ EOpFloatBitsToInt, "floatBitsToInt", {} },
293
{ EOpFloatBitsToUint, "floatBitsToUint", {} },
294
{ EOpIntBitsToFloat, "intBitsToFloat", {} },
295
{ EOpUintBitsToFloat, "uintBitsToFloat", {} },
296
297
{ EOpTextureQuerySize, "textureSize", {} },
298
{ EOpTextureQueryLod, "textureQueryLod", {} },
299
{ EOpTextureQueryLod, "textureQueryLOD", {} }, // extension GL_ARB_texture_query_lod
300
{ EOpTextureQueryLevels, "textureQueryLevels", {} },
301
{ EOpTextureQuerySamples, "textureSamples", {} },
302
{ EOpTexture, "texture", {} },
303
{ EOpTextureProj, "textureProj", {} },
304
{ EOpTextureLod, "textureLod", {} },
305
{ EOpTextureOffset, "textureOffset", {} },
306
{ EOpTextureFetch, "texelFetch", {} },
307
{ EOpTextureFetchOffset, "texelFetchOffset", {} },
308
{ EOpTextureProjOffset, "textureProjOffset", {} },
309
{ EOpTextureLodOffset, "textureLodOffset", {} },
310
{ EOpTextureProjLod, "textureProjLod", {} },
311
{ EOpTextureProjLodOffset, "textureProjLodOffset", {} },
312
{ EOpTextureGrad, "textureGrad", {} },
313
{ EOpTextureGradOffset, "textureGradOffset", {} },
314
{ EOpTextureProjGrad, "textureProjGrad", {} },
315
{ EOpTextureProjGradOffset, "textureProjGradOffset", {} },
316
};
317
318
// For the given table of functions, add all the indicated prototypes for each
319
// one, to be returned in the passed in decls.
320
void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)
321
{
322
const auto isScalarType = [](int type) { return (type & TypeStringColumnMask) == 0; };
323
324
// loop across these two:
325
// 0: the varying arg set, and
326
// 1: the fixed scalar args
327
const ArgClass ClassFixed = (ArgClass)(ClassLS | ClassXLS | ClassLS2 | ClassFS | ClassFS2);
328
for (int fixed = 0; fixed < ((function.classes & ClassFixed) > 0 ? 2 : 1); ++fixed) {
329
330
if (fixed == 0 && (function.classes & ClassXLS))
331
continue;
332
333
// walk the type strings in TypeString[]
334
for (int type = 0; type < TypeStringCount; ++type) {
335
// skip types not selected: go from type to row number to type bit
336
if ((function.types & (1 << (type >> TypeStringRowShift))) == 0)
337
continue;
338
339
// if we aren't on a scalar, and should be, skip
340
if ((function.classes & ClassV1) && !isScalarType(type))
341
continue;
342
343
// if we aren't on a 3-vector, and should be, skip
344
if ((function.classes & ClassV3) && (type & TypeStringColumnMask) != 2)
345
continue;
346
347
// skip replication of all arg scalars between the varying arg set and the fixed args
348
if (fixed == 1 && type == (type & TypeStringScalarMask) && (function.classes & ClassXLS) == 0)
349
continue;
350
351
// skip scalars when we are told to
352
if ((function.classes & ClassNS) && isScalarType(type))
353
continue;
354
355
// return type
356
if (function.classes & ClassB)
357
decls.append(TypeString[type & TypeStringColumnMask]);
358
else if (function.classes & ClassRS)
359
decls.append(TypeString[type & TypeStringScalarMask]);
360
else
361
decls.append(TypeString[type]);
362
decls.append(" ");
363
decls.append(function.name);
364
decls.append("(");
365
366
// arguments
367
for (int arg = 0; arg < function.numArguments; ++arg) {
368
if (arg == function.numArguments - 1 && (function.classes & ClassLO))
369
decls.append("out ");
370
if (arg == 0) {
371
if (function.classes & ClassCV)
372
decls.append("coherent volatile ");
373
if (function.classes & ClassFIO)
374
decls.append("inout ");
375
if (function.classes & ClassFO)
376
decls.append("out ");
377
}
378
if ((function.classes & ClassLB) && arg == function.numArguments - 1)
379
decls.append(TypeString[type & TypeStringColumnMask]);
380
else if (fixed && ((arg == function.numArguments - 1 && (function.classes & (ClassLS | ClassXLS |
381
ClassLS2))) ||
382
(arg == function.numArguments - 2 && (function.classes & ClassLS2)) ||
383
(arg == 0 && (function.classes & (ClassFS | ClassFS2))) ||
384
(arg == 1 && (function.classes & ClassFS2))))
385
decls.append(TypeString[type & TypeStringScalarMask]);
386
else
387
decls.append(TypeString[type]);
388
if (arg < function.numArguments - 1)
389
decls.append(",");
390
}
391
decls.append(");\n");
392
}
393
}
394
}
395
396
// See if the tabled versioning information allows the current version.
397
bool ValidVersion(const BuiltInFunction& function, int version, EProfile profile, const SpvVersion& /* spVersion */)
398
{
399
// nullptr means always valid
400
if (function.versioning.empty())
401
return true;
402
403
// check for what is said about our current profile
404
for (const auto& v : function.versioning) {
405
if ((v.profiles & profile) != 0) {
406
if (v.minCoreVersion <= version || (v.numExtensions > 0 && v.minExtendedVersion <= version))
407
return true;
408
}
409
}
410
411
return false;
412
}
413
414
// Relate a single table of built-ins to their AST operator.
415
// This can get called redundantly (especially for the common built-ins, when
416
// called once per stage). This is a performance issue only, not a correctness
417
// concern. It is done for quality arising from simplicity, as there are subtleties
418
// to get correct if instead trying to do it surgically.
419
template<class FunctionContainer>
420
void RelateTabledBuiltins(const FunctionContainer& functions, TSymbolTable& symbolTable)
421
{
422
for (const auto& fn : functions) {
423
symbolTable.relateToOperator(fn.name, fn.op);
424
}
425
}
426
427
} // end anonymous namespace
428
429
// Add declarations for all tables of built-in functions.
430
void TBuiltIns::addTabledBuiltins(int version, EProfile profile, const SpvVersion& spvVersion)
431
{
432
const auto forEachFunction = [&](TString& decls, const span<const BuiltInFunction>& functions) {
433
for (const auto& fn : functions) {
434
if (ValidVersion(fn, version, profile, spvVersion))
435
AddTabledBuiltin(decls, fn);
436
}
437
};
438
439
forEachFunction(commonBuiltins, BaseFunctions);
440
forEachFunction(stageBuiltins[EShLangFragment], DerivativeFunctions);
441
442
if ((profile == EEsProfile && version >= 320) || (profile != EEsProfile && version >= 450))
443
forEachFunction(stageBuiltins[EShLangCompute], DerivativeFunctions);
444
}
445
446
// Relate all tables of built-ins to the AST operators.
447
void TBuiltIns::relateTabledBuiltins(int /* version */, EProfile /* profile */, const SpvVersion& /* spvVersion */, EShLanguage /* stage */, TSymbolTable& symbolTable)
448
{
449
RelateTabledBuiltins(BaseFunctions, symbolTable);
450
RelateTabledBuiltins(DerivativeFunctions, symbolTable);
451
RelateTabledBuiltins(CustomFunctions, symbolTable);
452
}
453
454
inline bool IncludeLegacy(int version, EProfile profile, const SpvVersion& spvVersion)
455
{
456
return profile != EEsProfile && (version <= 130 || (spvVersion.spv == 0 && version == 140 && ARBCompatibility) ||
457
profile == ECompatibilityProfile);
458
}
459
460
// Construct TBuiltInParseables base class. This can be used for language-common constructs.
461
TBuiltInParseables::TBuiltInParseables()
462
{
463
}
464
465
// Destroy TBuiltInParseables.
466
TBuiltInParseables::~TBuiltInParseables()
467
{
468
}
469
470
TBuiltIns::TBuiltIns()
471
{
472
// Set up textual representations for making all the permutations
473
// of texturing/imaging functions.
474
prefixes[EbtFloat] = "";
475
prefixes[EbtInt] = "i";
476
prefixes[EbtUint] = "u";
477
prefixes[EbtFloat16] = "f16";
478
prefixes[EbtInt8] = "i8";
479
prefixes[EbtUint8] = "u8";
480
prefixes[EbtInt16] = "i16";
481
prefixes[EbtUint16] = "u16";
482
prefixes[EbtInt64] = "i64";
483
prefixes[EbtUint64] = "u64";
484
485
postfixes[2] = "2";
486
postfixes[3] = "3";
487
postfixes[4] = "4";
488
489
// Map from symbolic class of texturing dimension to numeric dimensions.
490
dimMap[Esd2D] = 2;
491
dimMap[Esd3D] = 3;
492
dimMap[EsdCube] = 3;
493
dimMap[Esd1D] = 1;
494
dimMap[EsdRect] = 2;
495
dimMap[EsdBuffer] = 1;
496
dimMap[EsdSubpass] = 2; // potentially unused for now
497
dimMap[EsdAttachmentEXT] = 2; // potentially unused for now
498
}
499
500
TBuiltIns::~TBuiltIns()
501
{
502
}
503
504
505
//
506
// Add all context-independent built-in functions and variables that are present
507
// for the given version and profile. Share common ones across stages, otherwise
508
// make stage-specific entries.
509
//
510
// Most built-ins variables can be added as simple text strings. Some need to
511
// be added programmatically, which is done later in IdentifyBuiltIns() below.
512
//
513
void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvVersion)
514
{
515
addTabledBuiltins(version, profile, spvVersion);
516
517
//============================================================================
518
//
519
// Prototypes for built-in functions used repeatly by different shaders
520
//
521
//============================================================================
522
523
//
524
// Derivatives Functions.
525
//
526
TString derivativeControls (
527
"float dFdxFine(float p);"
528
"vec2 dFdxFine(vec2 p);"
529
"vec3 dFdxFine(vec3 p);"
530
"vec4 dFdxFine(vec4 p);"
531
532
"float dFdyFine(float p);"
533
"vec2 dFdyFine(vec2 p);"
534
"vec3 dFdyFine(vec3 p);"
535
"vec4 dFdyFine(vec4 p);"
536
537
"float fwidthFine(float p);"
538
"vec2 fwidthFine(vec2 p);"
539
"vec3 fwidthFine(vec3 p);"
540
"vec4 fwidthFine(vec4 p);"
541
542
"float dFdxCoarse(float p);"
543
"vec2 dFdxCoarse(vec2 p);"
544
"vec3 dFdxCoarse(vec3 p);"
545
"vec4 dFdxCoarse(vec4 p);"
546
547
"float dFdyCoarse(float p);"
548
"vec2 dFdyCoarse(vec2 p);"
549
"vec3 dFdyCoarse(vec3 p);"
550
"vec4 dFdyCoarse(vec4 p);"
551
552
"float fwidthCoarse(float p);"
553
"vec2 fwidthCoarse(vec2 p);"
554
"vec3 fwidthCoarse(vec3 p);"
555
"vec4 fwidthCoarse(vec4 p);"
556
);
557
558
TString derivativesAndControl16bits (
559
"float16_t dFdx(float16_t);"
560
"f16vec2 dFdx(f16vec2);"
561
"f16vec3 dFdx(f16vec3);"
562
"f16vec4 dFdx(f16vec4);"
563
564
"float16_t dFdy(float16_t);"
565
"f16vec2 dFdy(f16vec2);"
566
"f16vec3 dFdy(f16vec3);"
567
"f16vec4 dFdy(f16vec4);"
568
569
"float16_t dFdxFine(float16_t);"
570
"f16vec2 dFdxFine(f16vec2);"
571
"f16vec3 dFdxFine(f16vec3);"
572
"f16vec4 dFdxFine(f16vec4);"
573
574
"float16_t dFdyFine(float16_t);"
575
"f16vec2 dFdyFine(f16vec2);"
576
"f16vec3 dFdyFine(f16vec3);"
577
"f16vec4 dFdyFine(f16vec4);"
578
579
"float16_t dFdxCoarse(float16_t);"
580
"f16vec2 dFdxCoarse(f16vec2);"
581
"f16vec3 dFdxCoarse(f16vec3);"
582
"f16vec4 dFdxCoarse(f16vec4);"
583
584
"float16_t dFdyCoarse(float16_t);"
585
"f16vec2 dFdyCoarse(f16vec2);"
586
"f16vec3 dFdyCoarse(f16vec3);"
587
"f16vec4 dFdyCoarse(f16vec4);"
588
589
"float16_t fwidth(float16_t);"
590
"f16vec2 fwidth(f16vec2);"
591
"f16vec3 fwidth(f16vec3);"
592
"f16vec4 fwidth(f16vec4);"
593
594
"float16_t fwidthFine(float16_t);"
595
"f16vec2 fwidthFine(f16vec2);"
596
"f16vec3 fwidthFine(f16vec3);"
597
"f16vec4 fwidthFine(f16vec4);"
598
599
"float16_t fwidthCoarse(float16_t);"
600
"f16vec2 fwidthCoarse(f16vec2);"
601
"f16vec3 fwidthCoarse(f16vec3);"
602
"f16vec4 fwidthCoarse(f16vec4);"
603
);
604
605
TString derivativesAndControl64bits (
606
"float64_t dFdx(float64_t);"
607
"f64vec2 dFdx(f64vec2);"
608
"f64vec3 dFdx(f64vec3);"
609
"f64vec4 dFdx(f64vec4);"
610
611
"float64_t dFdy(float64_t);"
612
"f64vec2 dFdy(f64vec2);"
613
"f64vec3 dFdy(f64vec3);"
614
"f64vec4 dFdy(f64vec4);"
615
616
"float64_t dFdxFine(float64_t);"
617
"f64vec2 dFdxFine(f64vec2);"
618
"f64vec3 dFdxFine(f64vec3);"
619
"f64vec4 dFdxFine(f64vec4);"
620
621
"float64_t dFdyFine(float64_t);"
622
"f64vec2 dFdyFine(f64vec2);"
623
"f64vec3 dFdyFine(f64vec3);"
624
"f64vec4 dFdyFine(f64vec4);"
625
626
"float64_t dFdxCoarse(float64_t);"
627
"f64vec2 dFdxCoarse(f64vec2);"
628
"f64vec3 dFdxCoarse(f64vec3);"
629
"f64vec4 dFdxCoarse(f64vec4);"
630
631
"float64_t dFdyCoarse(float64_t);"
632
"f64vec2 dFdyCoarse(f64vec2);"
633
"f64vec3 dFdyCoarse(f64vec3);"
634
"f64vec4 dFdyCoarse(f64vec4);"
635
636
"float64_t fwidth(float64_t);"
637
"f64vec2 fwidth(f64vec2);"
638
"f64vec3 fwidth(f64vec3);"
639
"f64vec4 fwidth(f64vec4);"
640
641
"float64_t fwidthFine(float64_t);"
642
"f64vec2 fwidthFine(f64vec2);"
643
"f64vec3 fwidthFine(f64vec3);"
644
"f64vec4 fwidthFine(f64vec4);"
645
646
"float64_t fwidthCoarse(float64_t);"
647
"f64vec2 fwidthCoarse(f64vec2);"
648
"f64vec3 fwidthCoarse(f64vec3);"
649
"f64vec4 fwidthCoarse(f64vec4);"
650
);
651
652
//============================================================================
653
//
654
// Prototypes for built-in functions seen by both vertex and fragment shaders.
655
//
656
//============================================================================
657
658
//
659
// double functions added to desktop 4.00, but not fma, frexp, ldexp, or pack/unpack
660
//
661
if (profile != EEsProfile && version >= 150) { // ARB_gpu_shader_fp64
662
commonBuiltins.append(
663
664
"double sqrt(double);"
665
"dvec2 sqrt(dvec2);"
666
"dvec3 sqrt(dvec3);"
667
"dvec4 sqrt(dvec4);"
668
669
"double inversesqrt(double);"
670
"dvec2 inversesqrt(dvec2);"
671
"dvec3 inversesqrt(dvec3);"
672
"dvec4 inversesqrt(dvec4);"
673
674
"double abs(double);"
675
"dvec2 abs(dvec2);"
676
"dvec3 abs(dvec3);"
677
"dvec4 abs(dvec4);"
678
679
"double sign(double);"
680
"dvec2 sign(dvec2);"
681
"dvec3 sign(dvec3);"
682
"dvec4 sign(dvec4);"
683
684
"double floor(double);"
685
"dvec2 floor(dvec2);"
686
"dvec3 floor(dvec3);"
687
"dvec4 floor(dvec4);"
688
689
"double trunc(double);"
690
"dvec2 trunc(dvec2);"
691
"dvec3 trunc(dvec3);"
692
"dvec4 trunc(dvec4);"
693
694
"double round(double);"
695
"dvec2 round(dvec2);"
696
"dvec3 round(dvec3);"
697
"dvec4 round(dvec4);"
698
699
"double roundEven(double);"
700
"dvec2 roundEven(dvec2);"
701
"dvec3 roundEven(dvec3);"
702
"dvec4 roundEven(dvec4);"
703
704
"double ceil(double);"
705
"dvec2 ceil(dvec2);"
706
"dvec3 ceil(dvec3);"
707
"dvec4 ceil(dvec4);"
708
709
"double fract(double);"
710
"dvec2 fract(dvec2);"
711
"dvec3 fract(dvec3);"
712
"dvec4 fract(dvec4);"
713
714
"double mod(double, double);"
715
"dvec2 mod(dvec2 , double);"
716
"dvec3 mod(dvec3 , double);"
717
"dvec4 mod(dvec4 , double);"
718
"dvec2 mod(dvec2 , dvec2);"
719
"dvec3 mod(dvec3 , dvec3);"
720
"dvec4 mod(dvec4 , dvec4);"
721
722
"double modf(double, out double);"
723
"dvec2 modf(dvec2, out dvec2);"
724
"dvec3 modf(dvec3, out dvec3);"
725
"dvec4 modf(dvec4, out dvec4);"
726
727
"double min(double, double);"
728
"dvec2 min(dvec2, double);"
729
"dvec3 min(dvec3, double);"
730
"dvec4 min(dvec4, double);"
731
"dvec2 min(dvec2, dvec2);"
732
"dvec3 min(dvec3, dvec3);"
733
"dvec4 min(dvec4, dvec4);"
734
735
"double max(double, double);"
736
"dvec2 max(dvec2 , double);"
737
"dvec3 max(dvec3 , double);"
738
"dvec4 max(dvec4 , double);"
739
"dvec2 max(dvec2 , dvec2);"
740
"dvec3 max(dvec3 , dvec3);"
741
"dvec4 max(dvec4 , dvec4);"
742
743
"double clamp(double, double, double);"
744
"dvec2 clamp(dvec2 , double, double);"
745
"dvec3 clamp(dvec3 , double, double);"
746
"dvec4 clamp(dvec4 , double, double);"
747
"dvec2 clamp(dvec2 , dvec2 , dvec2);"
748
"dvec3 clamp(dvec3 , dvec3 , dvec3);"
749
"dvec4 clamp(dvec4 , dvec4 , dvec4);"
750
751
"double mix(double, double, double);"
752
"dvec2 mix(dvec2, dvec2, double);"
753
"dvec3 mix(dvec3, dvec3, double);"
754
"dvec4 mix(dvec4, dvec4, double);"
755
"dvec2 mix(dvec2, dvec2, dvec2);"
756
"dvec3 mix(dvec3, dvec3, dvec3);"
757
"dvec4 mix(dvec4, dvec4, dvec4);"
758
"double mix(double, double, bool);"
759
"dvec2 mix(dvec2, dvec2, bvec2);"
760
"dvec3 mix(dvec3, dvec3, bvec3);"
761
"dvec4 mix(dvec4, dvec4, bvec4);"
762
763
"double step(double, double);"
764
"dvec2 step(dvec2 , dvec2);"
765
"dvec3 step(dvec3 , dvec3);"
766
"dvec4 step(dvec4 , dvec4);"
767
"dvec2 step(double, dvec2);"
768
"dvec3 step(double, dvec3);"
769
"dvec4 step(double, dvec4);"
770
771
"double smoothstep(double, double, double);"
772
"dvec2 smoothstep(dvec2 , dvec2 , dvec2);"
773
"dvec3 smoothstep(dvec3 , dvec3 , dvec3);"
774
"dvec4 smoothstep(dvec4 , dvec4 , dvec4);"
775
"dvec2 smoothstep(double, double, dvec2);"
776
"dvec3 smoothstep(double, double, dvec3);"
777
"dvec4 smoothstep(double, double, dvec4);"
778
779
"bool isnan(double);"
780
"bvec2 isnan(dvec2);"
781
"bvec3 isnan(dvec3);"
782
"bvec4 isnan(dvec4);"
783
784
"bool isinf(double);"
785
"bvec2 isinf(dvec2);"
786
"bvec3 isinf(dvec3);"
787
"bvec4 isinf(dvec4);"
788
789
"double length(double);"
790
"double length(dvec2);"
791
"double length(dvec3);"
792
"double length(dvec4);"
793
794
"double distance(double, double);"
795
"double distance(dvec2 , dvec2);"
796
"double distance(dvec3 , dvec3);"
797
"double distance(dvec4 , dvec4);"
798
799
"double dot(double, double);"
800
"double dot(dvec2 , dvec2);"
801
"double dot(dvec3 , dvec3);"
802
"double dot(dvec4 , dvec4);"
803
804
"dvec3 cross(dvec3, dvec3);"
805
806
"double normalize(double);"
807
"dvec2 normalize(dvec2);"
808
"dvec3 normalize(dvec3);"
809
"dvec4 normalize(dvec4);"
810
811
"double faceforward(double, double, double);"
812
"dvec2 faceforward(dvec2, dvec2, dvec2);"
813
"dvec3 faceforward(dvec3, dvec3, dvec3);"
814
"dvec4 faceforward(dvec4, dvec4, dvec4);"
815
816
"double reflect(double, double);"
817
"dvec2 reflect(dvec2 , dvec2 );"
818
"dvec3 reflect(dvec3 , dvec3 );"
819
"dvec4 reflect(dvec4 , dvec4 );"
820
821
"double refract(double, double, double);"
822
"dvec2 refract(dvec2 , dvec2 , double);"
823
"dvec3 refract(dvec3 , dvec3 , double);"
824
"dvec4 refract(dvec4 , dvec4 , double);"
825
826
"dmat2 matrixCompMult(dmat2, dmat2);"
827
"dmat3 matrixCompMult(dmat3, dmat3);"
828
"dmat4 matrixCompMult(dmat4, dmat4);"
829
"dmat2x3 matrixCompMult(dmat2x3, dmat2x3);"
830
"dmat2x4 matrixCompMult(dmat2x4, dmat2x4);"
831
"dmat3x2 matrixCompMult(dmat3x2, dmat3x2);"
832
"dmat3x4 matrixCompMult(dmat3x4, dmat3x4);"
833
"dmat4x2 matrixCompMult(dmat4x2, dmat4x2);"
834
"dmat4x3 matrixCompMult(dmat4x3, dmat4x3);"
835
836
"dmat2 outerProduct(dvec2, dvec2);"
837
"dmat3 outerProduct(dvec3, dvec3);"
838
"dmat4 outerProduct(dvec4, dvec4);"
839
"dmat2x3 outerProduct(dvec3, dvec2);"
840
"dmat3x2 outerProduct(dvec2, dvec3);"
841
"dmat2x4 outerProduct(dvec4, dvec2);"
842
"dmat4x2 outerProduct(dvec2, dvec4);"
843
"dmat3x4 outerProduct(dvec4, dvec3);"
844
"dmat4x3 outerProduct(dvec3, dvec4);"
845
846
"dmat2 transpose(dmat2);"
847
"dmat3 transpose(dmat3);"
848
"dmat4 transpose(dmat4);"
849
"dmat2x3 transpose(dmat3x2);"
850
"dmat3x2 transpose(dmat2x3);"
851
"dmat2x4 transpose(dmat4x2);"
852
"dmat4x2 transpose(dmat2x4);"
853
"dmat3x4 transpose(dmat4x3);"
854
"dmat4x3 transpose(dmat3x4);"
855
856
"double determinant(dmat2);"
857
"double determinant(dmat3);"
858
"double determinant(dmat4);"
859
860
"dmat2 inverse(dmat2);"
861
"dmat3 inverse(dmat3);"
862
"dmat4 inverse(dmat4);"
863
864
"bvec2 lessThan(dvec2, dvec2);"
865
"bvec3 lessThan(dvec3, dvec3);"
866
"bvec4 lessThan(dvec4, dvec4);"
867
868
"bvec2 lessThanEqual(dvec2, dvec2);"
869
"bvec3 lessThanEqual(dvec3, dvec3);"
870
"bvec4 lessThanEqual(dvec4, dvec4);"
871
872
"bvec2 greaterThan(dvec2, dvec2);"
873
"bvec3 greaterThan(dvec3, dvec3);"
874
"bvec4 greaterThan(dvec4, dvec4);"
875
876
"bvec2 greaterThanEqual(dvec2, dvec2);"
877
"bvec3 greaterThanEqual(dvec3, dvec3);"
878
"bvec4 greaterThanEqual(dvec4, dvec4);"
879
880
"bvec2 equal(dvec2, dvec2);"
881
"bvec3 equal(dvec3, dvec3);"
882
"bvec4 equal(dvec4, dvec4);"
883
884
"bvec2 notEqual(dvec2, dvec2);"
885
"bvec3 notEqual(dvec3, dvec3);"
886
"bvec4 notEqual(dvec4, dvec4);"
887
888
"\n");
889
}
890
891
if (profile == EEsProfile && version >= 310) { // Explicit Types
892
commonBuiltins.append(
893
894
"float64_t sqrt(float64_t);"
895
"f64vec2 sqrt(f64vec2);"
896
"f64vec3 sqrt(f64vec3);"
897
"f64vec4 sqrt(f64vec4);"
898
899
"float64_t inversesqrt(float64_t);"
900
"f64vec2 inversesqrt(f64vec2);"
901
"f64vec3 inversesqrt(f64vec3);"
902
"f64vec4 inversesqrt(f64vec4);"
903
904
"float64_t abs(float64_t);"
905
"f64vec2 abs(f64vec2);"
906
"f64vec3 abs(f64vec3);"
907
"f64vec4 abs(f64vec4);"
908
909
"float64_t sign(float64_t);"
910
"f64vec2 sign(f64vec2);"
911
"f64vec3 sign(f64vec3);"
912
"f64vec4 sign(f64vec4);"
913
914
"float64_t floor(float64_t);"
915
"f64vec2 floor(f64vec2);"
916
"f64vec3 floor(f64vec3);"
917
"f64vec4 floor(f64vec4);"
918
919
"float64_t trunc(float64_t);"
920
"f64vec2 trunc(f64vec2);"
921
"f64vec3 trunc(f64vec3);"
922
"f64vec4 trunc(f64vec4);"
923
924
"float64_t round(float64_t);"
925
"f64vec2 round(f64vec2);"
926
"f64vec3 round(f64vec3);"
927
"f64vec4 round(f64vec4);"
928
929
"float64_t roundEven(float64_t);"
930
"f64vec2 roundEven(f64vec2);"
931
"f64vec3 roundEven(f64vec3);"
932
"f64vec4 roundEven(f64vec4);"
933
934
"float64_t ceil(float64_t);"
935
"f64vec2 ceil(f64vec2);"
936
"f64vec3 ceil(f64vec3);"
937
"f64vec4 ceil(f64vec4);"
938
939
"float64_t fract(float64_t);"
940
"f64vec2 fract(f64vec2);"
941
"f64vec3 fract(f64vec3);"
942
"f64vec4 fract(f64vec4);"
943
944
"float64_t mod(float64_t, float64_t);"
945
"f64vec2 mod(f64vec2 , float64_t);"
946
"f64vec3 mod(f64vec3 , float64_t);"
947
"f64vec4 mod(f64vec4 , float64_t);"
948
"f64vec2 mod(f64vec2 , f64vec2);"
949
"f64vec3 mod(f64vec3 , f64vec3);"
950
"f64vec4 mod(f64vec4 , f64vec4);"
951
952
"float64_t modf(float64_t, out float64_t);"
953
"f64vec2 modf(f64vec2, out f64vec2);"
954
"f64vec3 modf(f64vec3, out f64vec3);"
955
"f64vec4 modf(f64vec4, out f64vec4);"
956
957
"float64_t min(float64_t, float64_t);"
958
"f64vec2 min(f64vec2, float64_t);"
959
"f64vec3 min(f64vec3, float64_t);"
960
"f64vec4 min(f64vec4, float64_t);"
961
"f64vec2 min(f64vec2, f64vec2);"
962
"f64vec3 min(f64vec3, f64vec3);"
963
"f64vec4 min(f64vec4, f64vec4);"
964
965
"float64_t max(float64_t, float64_t);"
966
"f64vec2 max(f64vec2 , float64_t);"
967
"f64vec3 max(f64vec3 , float64_t);"
968
"f64vec4 max(f64vec4 , float64_t);"
969
"f64vec2 max(f64vec2 , f64vec2);"
970
"f64vec3 max(f64vec3 , f64vec3);"
971
"f64vec4 max(f64vec4 , f64vec4);"
972
973
"float64_t clamp(float64_t, float64_t, float64_t);"
974
"f64vec2 clamp(f64vec2 , float64_t, float64_t);"
975
"f64vec3 clamp(f64vec3 , float64_t, float64_t);"
976
"f64vec4 clamp(f64vec4 , float64_t, float64_t);"
977
"f64vec2 clamp(f64vec2 , f64vec2 , f64vec2);"
978
"f64vec3 clamp(f64vec3 , f64vec3 , f64vec3);"
979
"f64vec4 clamp(f64vec4 , f64vec4 , f64vec4);"
980
981
"float64_t mix(float64_t, float64_t, float64_t);"
982
"f64vec2 mix(f64vec2, f64vec2, float64_t);"
983
"f64vec3 mix(f64vec3, f64vec3, float64_t);"
984
"f64vec4 mix(f64vec4, f64vec4, float64_t);"
985
"f64vec2 mix(f64vec2, f64vec2, f64vec2);"
986
"f64vec3 mix(f64vec3, f64vec3, f64vec3);"
987
"f64vec4 mix(f64vec4, f64vec4, f64vec4);"
988
"float64_t mix(float64_t, float64_t, bool);"
989
"f64vec2 mix(f64vec2, f64vec2, bvec2);"
990
"f64vec3 mix(f64vec3, f64vec3, bvec3);"
991
"f64vec4 mix(f64vec4, f64vec4, bvec4);"
992
993
"float64_t step(float64_t, float64_t);"
994
"f64vec2 step(f64vec2 , f64vec2);"
995
"f64vec3 step(f64vec3 , f64vec3);"
996
"f64vec4 step(f64vec4 , f64vec4);"
997
"f64vec2 step(float64_t, f64vec2);"
998
"f64vec3 step(float64_t, f64vec3);"
999
"f64vec4 step(float64_t, f64vec4);"
1000
1001
"float64_t smoothstep(float64_t, float64_t, float64_t);"
1002
"f64vec2 smoothstep(f64vec2 , f64vec2 , f64vec2);"
1003
"f64vec3 smoothstep(f64vec3 , f64vec3 , f64vec3);"
1004
"f64vec4 smoothstep(f64vec4 , f64vec4 , f64vec4);"
1005
"f64vec2 smoothstep(float64_t, float64_t, f64vec2);"
1006
"f64vec3 smoothstep(float64_t, float64_t, f64vec3);"
1007
"f64vec4 smoothstep(float64_t, float64_t, f64vec4);"
1008
1009
"float64_t length(float64_t);"
1010
"float64_t length(f64vec2);"
1011
"float64_t length(f64vec3);"
1012
"float64_t length(f64vec4);"
1013
1014
"float64_t distance(float64_t, float64_t);"
1015
"float64_t distance(f64vec2 , f64vec2);"
1016
"float64_t distance(f64vec3 , f64vec3);"
1017
"float64_t distance(f64vec4 , f64vec4);"
1018
1019
"float64_t dot(float64_t, float64_t);"
1020
"float64_t dot(f64vec2 , f64vec2);"
1021
"float64_t dot(f64vec3 , f64vec3);"
1022
"float64_t dot(f64vec4 , f64vec4);"
1023
1024
"f64vec3 cross(f64vec3, f64vec3);"
1025
1026
"float64_t normalize(float64_t);"
1027
"f64vec2 normalize(f64vec2);"
1028
"f64vec3 normalize(f64vec3);"
1029
"f64vec4 normalize(f64vec4);"
1030
1031
"float64_t faceforward(float64_t, float64_t, float64_t);"
1032
"f64vec2 faceforward(f64vec2, f64vec2, f64vec2);"
1033
"f64vec3 faceforward(f64vec3, f64vec3, f64vec3);"
1034
"f64vec4 faceforward(f64vec4, f64vec4, f64vec4);"
1035
1036
"float64_t reflect(float64_t, float64_t);"
1037
"f64vec2 reflect(f64vec2 , f64vec2 );"
1038
"f64vec3 reflect(f64vec3 , f64vec3 );"
1039
"f64vec4 reflect(f64vec4 , f64vec4 );"
1040
1041
"float64_t refract(float64_t, float64_t, float64_t);"
1042
"f64vec2 refract(f64vec2 , f64vec2 , float64_t);"
1043
"f64vec3 refract(f64vec3 , f64vec3 , float64_t);"
1044
"f64vec4 refract(f64vec4 , f64vec4 , float64_t);"
1045
1046
"f64mat2 matrixCompMult(f64mat2, f64mat2);"
1047
"f64mat3 matrixCompMult(f64mat3, f64mat3);"
1048
"f64mat4 matrixCompMult(f64mat4, f64mat4);"
1049
"f64mat2x3 matrixCompMult(f64mat2x3, f64mat2x3);"
1050
"f64mat2x4 matrixCompMult(f64mat2x4, f64mat2x4);"
1051
"f64mat3x2 matrixCompMult(f64mat3x2, f64mat3x2);"
1052
"f64mat3x4 matrixCompMult(f64mat3x4, f64mat3x4);"
1053
"f64mat4x2 matrixCompMult(f64mat4x2, f64mat4x2);"
1054
"f64mat4x3 matrixCompMult(f64mat4x3, f64mat4x3);"
1055
1056
"f64mat2 outerProduct(f64vec2, f64vec2);"
1057
"f64mat3 outerProduct(f64vec3, f64vec3);"
1058
"f64mat4 outerProduct(f64vec4, f64vec4);"
1059
"f64mat2x3 outerProduct(f64vec3, f64vec2);"
1060
"f64mat3x2 outerProduct(f64vec2, f64vec3);"
1061
"f64mat2x4 outerProduct(f64vec4, f64vec2);"
1062
"f64mat4x2 outerProduct(f64vec2, f64vec4);"
1063
"f64mat3x4 outerProduct(f64vec4, f64vec3);"
1064
"f64mat4x3 outerProduct(f64vec3, f64vec4);"
1065
1066
"f64mat2 transpose(f64mat2);"
1067
"f64mat3 transpose(f64mat3);"
1068
"f64mat4 transpose(f64mat4);"
1069
"f64mat2x3 transpose(f64mat3x2);"
1070
"f64mat3x2 transpose(f64mat2x3);"
1071
"f64mat2x4 transpose(f64mat4x2);"
1072
"f64mat4x2 transpose(f64mat2x4);"
1073
"f64mat3x4 transpose(f64mat4x3);"
1074
"f64mat4x3 transpose(f64mat3x4);"
1075
1076
"float64_t determinant(f64mat2);"
1077
"float64_t determinant(f64mat3);"
1078
"float64_t determinant(f64mat4);"
1079
1080
"f64mat2 inverse(f64mat2);"
1081
"f64mat3 inverse(f64mat3);"
1082
"f64mat4 inverse(f64mat4);"
1083
1084
"\n");
1085
}
1086
1087
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) {
1088
commonBuiltins.append(
1089
1090
"int64_t abs(int64_t);"
1091
"i64vec2 abs(i64vec2);"
1092
"i64vec3 abs(i64vec3);"
1093
"i64vec4 abs(i64vec4);"
1094
1095
"int64_t sign(int64_t);"
1096
"i64vec2 sign(i64vec2);"
1097
"i64vec3 sign(i64vec3);"
1098
"i64vec4 sign(i64vec4);"
1099
1100
"int64_t min(int64_t, int64_t);"
1101
"i64vec2 min(i64vec2, int64_t);"
1102
"i64vec3 min(i64vec3, int64_t);"
1103
"i64vec4 min(i64vec4, int64_t);"
1104
"i64vec2 min(i64vec2, i64vec2);"
1105
"i64vec3 min(i64vec3, i64vec3);"
1106
"i64vec4 min(i64vec4, i64vec4);"
1107
"uint64_t min(uint64_t, uint64_t);"
1108
"u64vec2 min(u64vec2, uint64_t);"
1109
"u64vec3 min(u64vec3, uint64_t);"
1110
"u64vec4 min(u64vec4, uint64_t);"
1111
"u64vec2 min(u64vec2, u64vec2);"
1112
"u64vec3 min(u64vec3, u64vec3);"
1113
"u64vec4 min(u64vec4, u64vec4);"
1114
1115
"int64_t max(int64_t, int64_t);"
1116
"i64vec2 max(i64vec2, int64_t);"
1117
"i64vec3 max(i64vec3, int64_t);"
1118
"i64vec4 max(i64vec4, int64_t);"
1119
"i64vec2 max(i64vec2, i64vec2);"
1120
"i64vec3 max(i64vec3, i64vec3);"
1121
"i64vec4 max(i64vec4, i64vec4);"
1122
"uint64_t max(uint64_t, uint64_t);"
1123
"u64vec2 max(u64vec2, uint64_t);"
1124
"u64vec3 max(u64vec3, uint64_t);"
1125
"u64vec4 max(u64vec4, uint64_t);"
1126
"u64vec2 max(u64vec2, u64vec2);"
1127
"u64vec3 max(u64vec3, u64vec3);"
1128
"u64vec4 max(u64vec4, u64vec4);"
1129
1130
"int64_t clamp(int64_t, int64_t, int64_t);"
1131
"i64vec2 clamp(i64vec2, int64_t, int64_t);"
1132
"i64vec3 clamp(i64vec3, int64_t, int64_t);"
1133
"i64vec4 clamp(i64vec4, int64_t, int64_t);"
1134
"i64vec2 clamp(i64vec2, i64vec2, i64vec2);"
1135
"i64vec3 clamp(i64vec3, i64vec3, i64vec3);"
1136
"i64vec4 clamp(i64vec4, i64vec4, i64vec4);"
1137
"uint64_t clamp(uint64_t, uint64_t, uint64_t);"
1138
"u64vec2 clamp(u64vec2, uint64_t, uint64_t);"
1139
"u64vec3 clamp(u64vec3, uint64_t, uint64_t);"
1140
"u64vec4 clamp(u64vec4, uint64_t, uint64_t);"
1141
"u64vec2 clamp(u64vec2, u64vec2, u64vec2);"
1142
"u64vec3 clamp(u64vec3, u64vec3, u64vec3);"
1143
"u64vec4 clamp(u64vec4, u64vec4, u64vec4);"
1144
1145
"int64_t mix(int64_t, int64_t, bool);"
1146
"i64vec2 mix(i64vec2, i64vec2, bvec2);"
1147
"i64vec3 mix(i64vec3, i64vec3, bvec3);"
1148
"i64vec4 mix(i64vec4, i64vec4, bvec4);"
1149
"uint64_t mix(uint64_t, uint64_t, bool);"
1150
"u64vec2 mix(u64vec2, u64vec2, bvec2);"
1151
"u64vec3 mix(u64vec3, u64vec3, bvec3);"
1152
"u64vec4 mix(u64vec4, u64vec4, bvec4);"
1153
1154
"int64_t doubleBitsToInt64(float64_t);"
1155
"i64vec2 doubleBitsToInt64(f64vec2);"
1156
"i64vec3 doubleBitsToInt64(f64vec3);"
1157
"i64vec4 doubleBitsToInt64(f64vec4);"
1158
1159
"uint64_t doubleBitsToUint64(float64_t);"
1160
"u64vec2 doubleBitsToUint64(f64vec2);"
1161
"u64vec3 doubleBitsToUint64(f64vec3);"
1162
"u64vec4 doubleBitsToUint64(f64vec4);"
1163
1164
"float64_t int64BitsToDouble(int64_t);"
1165
"f64vec2 int64BitsToDouble(i64vec2);"
1166
"f64vec3 int64BitsToDouble(i64vec3);"
1167
"f64vec4 int64BitsToDouble(i64vec4);"
1168
1169
"float64_t uint64BitsToDouble(uint64_t);"
1170
"f64vec2 uint64BitsToDouble(u64vec2);"
1171
"f64vec3 uint64BitsToDouble(u64vec3);"
1172
"f64vec4 uint64BitsToDouble(u64vec4);"
1173
1174
"int64_t packInt2x32(ivec2);"
1175
"uint64_t packUint2x32(uvec2);"
1176
"ivec2 unpackInt2x32(int64_t);"
1177
"uvec2 unpackUint2x32(uint64_t);"
1178
1179
"bvec2 lessThan(i64vec2, i64vec2);"
1180
"bvec3 lessThan(i64vec3, i64vec3);"
1181
"bvec4 lessThan(i64vec4, i64vec4);"
1182
"bvec2 lessThan(u64vec2, u64vec2);"
1183
"bvec3 lessThan(u64vec3, u64vec3);"
1184
"bvec4 lessThan(u64vec4, u64vec4);"
1185
1186
"bvec2 lessThanEqual(i64vec2, i64vec2);"
1187
"bvec3 lessThanEqual(i64vec3, i64vec3);"
1188
"bvec4 lessThanEqual(i64vec4, i64vec4);"
1189
"bvec2 lessThanEqual(u64vec2, u64vec2);"
1190
"bvec3 lessThanEqual(u64vec3, u64vec3);"
1191
"bvec4 lessThanEqual(u64vec4, u64vec4);"
1192
1193
"bvec2 greaterThan(i64vec2, i64vec2);"
1194
"bvec3 greaterThan(i64vec3, i64vec3);"
1195
"bvec4 greaterThan(i64vec4, i64vec4);"
1196
"bvec2 greaterThan(u64vec2, u64vec2);"
1197
"bvec3 greaterThan(u64vec3, u64vec3);"
1198
"bvec4 greaterThan(u64vec4, u64vec4);"
1199
1200
"bvec2 greaterThanEqual(i64vec2, i64vec2);"
1201
"bvec3 greaterThanEqual(i64vec3, i64vec3);"
1202
"bvec4 greaterThanEqual(i64vec4, i64vec4);"
1203
"bvec2 greaterThanEqual(u64vec2, u64vec2);"
1204
"bvec3 greaterThanEqual(u64vec3, u64vec3);"
1205
"bvec4 greaterThanEqual(u64vec4, u64vec4);"
1206
1207
"bvec2 equal(i64vec2, i64vec2);"
1208
"bvec3 equal(i64vec3, i64vec3);"
1209
"bvec4 equal(i64vec4, i64vec4);"
1210
"bvec2 equal(u64vec2, u64vec2);"
1211
"bvec3 equal(u64vec3, u64vec3);"
1212
"bvec4 equal(u64vec4, u64vec4);"
1213
1214
"bvec2 notEqual(i64vec2, i64vec2);"
1215
"bvec3 notEqual(i64vec3, i64vec3);"
1216
"bvec4 notEqual(i64vec4, i64vec4);"
1217
"bvec2 notEqual(u64vec2, u64vec2);"
1218
"bvec3 notEqual(u64vec3, u64vec3);"
1219
"bvec4 notEqual(u64vec4, u64vec4);"
1220
1221
"int64_t bitCount(int64_t);"
1222
"i64vec2 bitCount(i64vec2);"
1223
"i64vec3 bitCount(i64vec3);"
1224
"i64vec4 bitCount(i64vec4);"
1225
1226
"int64_t bitCount(uint64_t);"
1227
"i64vec2 bitCount(u64vec2);"
1228
"i64vec3 bitCount(u64vec3);"
1229
"i64vec4 bitCount(u64vec4);"
1230
1231
"int64_t findLSB(int64_t);"
1232
"i64vec2 findLSB(i64vec2);"
1233
"i64vec3 findLSB(i64vec3);"
1234
"i64vec4 findLSB(i64vec4);"
1235
1236
"int64_t findLSB(uint64_t);"
1237
"i64vec2 findLSB(u64vec2);"
1238
"i64vec3 findLSB(u64vec3);"
1239
"i64vec4 findLSB(u64vec4);"
1240
1241
"int64_t findMSB(int64_t);"
1242
"i64vec2 findMSB(i64vec2);"
1243
"i64vec3 findMSB(i64vec3);"
1244
"i64vec4 findMSB(i64vec4);"
1245
1246
"int64_t findMSB(uint64_t);"
1247
"i64vec2 findMSB(u64vec2);"
1248
"i64vec3 findMSB(u64vec3);"
1249
"i64vec4 findMSB(u64vec4);"
1250
1251
"\n"
1252
);
1253
}
1254
1255
// GL_AMD_shader_trinary_minmax
1256
if (profile != EEsProfile && version >= 430) {
1257
commonBuiltins.append(
1258
"float min3(float, float, float);"
1259
"vec2 min3(vec2, vec2, vec2);"
1260
"vec3 min3(vec3, vec3, vec3);"
1261
"vec4 min3(vec4, vec4, vec4);"
1262
1263
"int min3(int, int, int);"
1264
"ivec2 min3(ivec2, ivec2, ivec2);"
1265
"ivec3 min3(ivec3, ivec3, ivec3);"
1266
"ivec4 min3(ivec4, ivec4, ivec4);"
1267
1268
"uint min3(uint, uint, uint);"
1269
"uvec2 min3(uvec2, uvec2, uvec2);"
1270
"uvec3 min3(uvec3, uvec3, uvec3);"
1271
"uvec4 min3(uvec4, uvec4, uvec4);"
1272
1273
"float max3(float, float, float);"
1274
"vec2 max3(vec2, vec2, vec2);"
1275
"vec3 max3(vec3, vec3, vec3);"
1276
"vec4 max3(vec4, vec4, vec4);"
1277
1278
"int max3(int, int, int);"
1279
"ivec2 max3(ivec2, ivec2, ivec2);"
1280
"ivec3 max3(ivec3, ivec3, ivec3);"
1281
"ivec4 max3(ivec4, ivec4, ivec4);"
1282
1283
"uint max3(uint, uint, uint);"
1284
"uvec2 max3(uvec2, uvec2, uvec2);"
1285
"uvec3 max3(uvec3, uvec3, uvec3);"
1286
"uvec4 max3(uvec4, uvec4, uvec4);"
1287
1288
"float mid3(float, float, float);"
1289
"vec2 mid3(vec2, vec2, vec2);"
1290
"vec3 mid3(vec3, vec3, vec3);"
1291
"vec4 mid3(vec4, vec4, vec4);"
1292
1293
"int mid3(int, int, int);"
1294
"ivec2 mid3(ivec2, ivec2, ivec2);"
1295
"ivec3 mid3(ivec3, ivec3, ivec3);"
1296
"ivec4 mid3(ivec4, ivec4, ivec4);"
1297
1298
"uint mid3(uint, uint, uint);"
1299
"uvec2 mid3(uvec2, uvec2, uvec2);"
1300
"uvec3 mid3(uvec3, uvec3, uvec3);"
1301
"uvec4 mid3(uvec4, uvec4, uvec4);"
1302
1303
"float16_t min3(float16_t, float16_t, float16_t);"
1304
"f16vec2 min3(f16vec2, f16vec2, f16vec2);"
1305
"f16vec3 min3(f16vec3, f16vec3, f16vec3);"
1306
"f16vec4 min3(f16vec4, f16vec4, f16vec4);"
1307
1308
"float16_t max3(float16_t, float16_t, float16_t);"
1309
"f16vec2 max3(f16vec2, f16vec2, f16vec2);"
1310
"f16vec3 max3(f16vec3, f16vec3, f16vec3);"
1311
"f16vec4 max3(f16vec4, f16vec4, f16vec4);"
1312
1313
"float16_t mid3(float16_t, float16_t, float16_t);"
1314
"f16vec2 mid3(f16vec2, f16vec2, f16vec2);"
1315
"f16vec3 mid3(f16vec3, f16vec3, f16vec3);"
1316
"f16vec4 mid3(f16vec4, f16vec4, f16vec4);"
1317
1318
"int16_t min3(int16_t, int16_t, int16_t);"
1319
"i16vec2 min3(i16vec2, i16vec2, i16vec2);"
1320
"i16vec3 min3(i16vec3, i16vec3, i16vec3);"
1321
"i16vec4 min3(i16vec4, i16vec4, i16vec4);"
1322
1323
"int16_t max3(int16_t, int16_t, int16_t);"
1324
"i16vec2 max3(i16vec2, i16vec2, i16vec2);"
1325
"i16vec3 max3(i16vec3, i16vec3, i16vec3);"
1326
"i16vec4 max3(i16vec4, i16vec4, i16vec4);"
1327
1328
"int16_t mid3(int16_t, int16_t, int16_t);"
1329
"i16vec2 mid3(i16vec2, i16vec2, i16vec2);"
1330
"i16vec3 mid3(i16vec3, i16vec3, i16vec3);"
1331
"i16vec4 mid3(i16vec4, i16vec4, i16vec4);"
1332
1333
"uint16_t min3(uint16_t, uint16_t, uint16_t);"
1334
"u16vec2 min3(u16vec2, u16vec2, u16vec2);"
1335
"u16vec3 min3(u16vec3, u16vec3, u16vec3);"
1336
"u16vec4 min3(u16vec4, u16vec4, u16vec4);"
1337
1338
"uint16_t max3(uint16_t, uint16_t, uint16_t);"
1339
"u16vec2 max3(u16vec2, u16vec2, u16vec2);"
1340
"u16vec3 max3(u16vec3, u16vec3, u16vec3);"
1341
"u16vec4 max3(u16vec4, u16vec4, u16vec4);"
1342
1343
"uint16_t mid3(uint16_t, uint16_t, uint16_t);"
1344
"u16vec2 mid3(u16vec2, u16vec2, u16vec2);"
1345
"u16vec3 mid3(u16vec3, u16vec3, u16vec3);"
1346
"u16vec4 mid3(u16vec4, u16vec4, u16vec4);"
1347
1348
"\n"
1349
);
1350
}
1351
1352
if ((profile == EEsProfile && version >= 310) ||
1353
(profile != EEsProfile && version >= 430)) {
1354
commonBuiltins.append(
1355
"uint atomicAdd(coherent volatile inout uint, uint, int, int, int);"
1356
" int atomicAdd(coherent volatile inout int, int, int, int, int);"
1357
1358
"uint atomicMin(coherent volatile inout uint, uint, int, int, int);"
1359
" int atomicMin(coherent volatile inout int, int, int, int, int);"
1360
1361
"uint atomicMax(coherent volatile inout uint, uint, int, int, int);"
1362
" int atomicMax(coherent volatile inout int, int, int, int, int);"
1363
1364
"uint atomicAnd(coherent volatile inout uint, uint, int, int, int);"
1365
" int atomicAnd(coherent volatile inout int, int, int, int, int);"
1366
1367
"uint atomicOr (coherent volatile inout uint, uint, int, int, int);"
1368
" int atomicOr (coherent volatile inout int, int, int, int, int);"
1369
1370
"uint atomicXor(coherent volatile inout uint, uint, int, int, int);"
1371
" int atomicXor(coherent volatile inout int, int, int, int, int);"
1372
1373
"uint atomicExchange(coherent volatile inout uint, uint, int, int, int);"
1374
" int atomicExchange(coherent volatile inout int, int, int, int, int);"
1375
1376
"uint atomicCompSwap(coherent volatile inout uint, uint, uint, int, int, int, int, int);"
1377
" int atomicCompSwap(coherent volatile inout int, int, int, int, int, int, int, int);"
1378
1379
"uint atomicLoad(coherent volatile in uint, int, int, int);"
1380
" int atomicLoad(coherent volatile in int, int, int, int);"
1381
1382
"void atomicStore(coherent volatile out uint, uint, int, int, int);"
1383
"void atomicStore(coherent volatile out int, int, int, int, int);"
1384
1385
"\n");
1386
}
1387
1388
if (profile != EEsProfile && version >= 440) {
1389
commonBuiltins.append(
1390
"uint64_t atomicMin(coherent volatile inout uint64_t, uint64_t);"
1391
" int64_t atomicMin(coherent volatile inout int64_t, int64_t);"
1392
"uint64_t atomicMin(coherent volatile inout uint64_t, uint64_t, int, int, int);"
1393
" int64_t atomicMin(coherent volatile inout int64_t, int64_t, int, int, int);"
1394
"float16_t atomicMin(coherent volatile inout float16_t, float16_t);"
1395
"float16_t atomicMin(coherent volatile inout float16_t, float16_t, int, int, int);"
1396
" float atomicMin(coherent volatile inout float, float);"
1397
" float atomicMin(coherent volatile inout float, float, int, int, int);"
1398
" double atomicMin(coherent volatile inout double, double);"
1399
" double atomicMin(coherent volatile inout double, double, int, int, int);"
1400
1401
"uint64_t atomicMax(coherent volatile inout uint64_t, uint64_t);"
1402
" int64_t atomicMax(coherent volatile inout int64_t, int64_t);"
1403
"uint64_t atomicMax(coherent volatile inout uint64_t, uint64_t, int, int, int);"
1404
" int64_t atomicMax(coherent volatile inout int64_t, int64_t, int, int, int);"
1405
"float16_t atomicMax(coherent volatile inout float16_t, float16_t);"
1406
"float16_t atomicMax(coherent volatile inout float16_t, float16_t, int, int, int);"
1407
" float atomicMax(coherent volatile inout float, float);"
1408
" float atomicMax(coherent volatile inout float, float, int, int, int);"
1409
" double atomicMax(coherent volatile inout double, double);"
1410
" double atomicMax(coherent volatile inout double, double, int, int, int);"
1411
1412
"uint64_t atomicAnd(coherent volatile inout uint64_t, uint64_t);"
1413
" int64_t atomicAnd(coherent volatile inout int64_t, int64_t);"
1414
"uint64_t atomicAnd(coherent volatile inout uint64_t, uint64_t, int, int, int);"
1415
" int64_t atomicAnd(coherent volatile inout int64_t, int64_t, int, int, int);"
1416
1417
"uint64_t atomicOr (coherent volatile inout uint64_t, uint64_t);"
1418
" int64_t atomicOr (coherent volatile inout int64_t, int64_t);"
1419
"uint64_t atomicOr (coherent volatile inout uint64_t, uint64_t, int, int, int);"
1420
" int64_t atomicOr (coherent volatile inout int64_t, int64_t, int, int, int);"
1421
1422
"uint64_t atomicXor(coherent volatile inout uint64_t, uint64_t);"
1423
" int64_t atomicXor(coherent volatile inout int64_t, int64_t);"
1424
"uint64_t atomicXor(coherent volatile inout uint64_t, uint64_t, int, int, int);"
1425
" int64_t atomicXor(coherent volatile inout int64_t, int64_t, int, int, int);"
1426
1427
"uint64_t atomicAdd(coherent volatile inout uint64_t, uint64_t);"
1428
" int64_t atomicAdd(coherent volatile inout int64_t, int64_t);"
1429
"uint64_t atomicAdd(coherent volatile inout uint64_t, uint64_t, int, int, int);"
1430
" int64_t atomicAdd(coherent volatile inout int64_t, int64_t, int, int, int);"
1431
"float16_t atomicAdd(coherent volatile inout float16_t, float16_t);"
1432
"float16_t atomicAdd(coherent volatile inout float16_t, float16_t, int, int, int);"
1433
" float atomicAdd(coherent volatile inout float, float);"
1434
" float atomicAdd(coherent volatile inout float, float, int, int, int);"
1435
" double atomicAdd(coherent volatile inout double, double);"
1436
" double atomicAdd(coherent volatile inout double, double, int, int, int);"
1437
1438
"uint64_t atomicExchange(coherent volatile inout uint64_t, uint64_t);"
1439
" int64_t atomicExchange(coherent volatile inout int64_t, int64_t);"
1440
"uint64_t atomicExchange(coherent volatile inout uint64_t, uint64_t, int, int, int);"
1441
" int64_t atomicExchange(coherent volatile inout int64_t, int64_t, int, int, int);"
1442
"float16_t atomicExchange(coherent volatile inout float16_t, float16_t);"
1443
"float16_t atomicExchange(coherent volatile inout float16_t, float16_t, int, int, int);"
1444
" float atomicExchange(coherent volatile inout float, float);"
1445
" float atomicExchange(coherent volatile inout float, float, int, int, int);"
1446
" double atomicExchange(coherent volatile inout double, double);"
1447
" double atomicExchange(coherent volatile inout double, double, int, int, int);"
1448
1449
"uint64_t atomicCompSwap(coherent volatile inout uint64_t, uint64_t, uint64_t);"
1450
" int64_t atomicCompSwap(coherent volatile inout int64_t, int64_t, int64_t);"
1451
"uint64_t atomicCompSwap(coherent volatile inout uint64_t, uint64_t, uint64_t, int, int, int, int, int);"
1452
" int64_t atomicCompSwap(coherent volatile inout int64_t, int64_t, int64_t, int, int, int, int, int);"
1453
1454
"uint64_t atomicLoad(coherent volatile in uint64_t, int, int, int);"
1455
" int64_t atomicLoad(coherent volatile in int64_t, int, int, int);"
1456
"float16_t atomicLoad(coherent volatile in float16_t, int, int, int);"
1457
" float atomicLoad(coherent volatile in float, int, int, int);"
1458
" double atomicLoad(coherent volatile in double, int, int, int);"
1459
1460
"void atomicStore(coherent volatile out uint64_t, uint64_t, int, int, int);"
1461
"void atomicStore(coherent volatile out int64_t, int64_t, int, int, int);"
1462
"void atomicStore(coherent volatile out float16_t, float16_t, int, int, int);"
1463
"void atomicStore(coherent volatile out float, float, int, int, int);"
1464
"void atomicStore(coherent volatile out double, double, int, int, int);"
1465
"\n");
1466
}
1467
1468
// NV_shader_atomic_fp16_vector
1469
if (profile != EEsProfile && version >= 430) {
1470
commonBuiltins.append(
1471
"f16vec2 atomicAdd(coherent volatile inout f16vec2, f16vec2);"
1472
"f16vec4 atomicAdd(coherent volatile inout f16vec4, f16vec4);"
1473
"f16vec2 atomicMin(coherent volatile inout f16vec2, f16vec2);"
1474
"f16vec4 atomicMin(coherent volatile inout f16vec4, f16vec4);"
1475
"f16vec2 atomicMax(coherent volatile inout f16vec2, f16vec2);"
1476
"f16vec4 atomicMax(coherent volatile inout f16vec4, f16vec4);"
1477
"f16vec2 atomicExchange(coherent volatile inout f16vec2, f16vec2);"
1478
"f16vec4 atomicExchange(coherent volatile inout f16vec4, f16vec4);"
1479
"\n");
1480
}
1481
1482
if ((profile == EEsProfile && version >= 300) ||
1483
(profile != EEsProfile && version >= 150)) { // GL_ARB_shader_bit_encoding
1484
commonBuiltins.append(
1485
"int floatBitsToInt(highp float value);"
1486
"ivec2 floatBitsToInt(highp vec2 value);"
1487
"ivec3 floatBitsToInt(highp vec3 value);"
1488
"ivec4 floatBitsToInt(highp vec4 value);"
1489
1490
"uint floatBitsToUint(highp float value);"
1491
"uvec2 floatBitsToUint(highp vec2 value);"
1492
"uvec3 floatBitsToUint(highp vec3 value);"
1493
"uvec4 floatBitsToUint(highp vec4 value);"
1494
1495
"float intBitsToFloat(highp int value);"
1496
"vec2 intBitsToFloat(highp ivec2 value);"
1497
"vec3 intBitsToFloat(highp ivec3 value);"
1498
"vec4 intBitsToFloat(highp ivec4 value);"
1499
1500
"float uintBitsToFloat(highp uint value);"
1501
"vec2 uintBitsToFloat(highp uvec2 value);"
1502
"vec3 uintBitsToFloat(highp uvec3 value);"
1503
"vec4 uintBitsToFloat(highp uvec4 value);"
1504
1505
"\n");
1506
}
1507
1508
if ((profile != EEsProfile && version >= 400) ||
1509
(profile == EEsProfile && version >= 310)) { // GL_OES_gpu_shader5
1510
1511
commonBuiltins.append(
1512
"float fma(float, float, float );"
1513
"vec2 fma(vec2, vec2, vec2 );"
1514
"vec3 fma(vec3, vec3, vec3 );"
1515
"vec4 fma(vec4, vec4, vec4 );"
1516
"\n");
1517
}
1518
1519
if (profile != EEsProfile && version >= 150) { // ARB_gpu_shader_fp64
1520
commonBuiltins.append(
1521
"double fma(double, double, double);"
1522
"dvec2 fma(dvec2, dvec2, dvec2 );"
1523
"dvec3 fma(dvec3, dvec3, dvec3 );"
1524
"dvec4 fma(dvec4, dvec4, dvec4 );"
1525
"\n");
1526
}
1527
1528
if (profile == EEsProfile && version >= 310) { // ARB_gpu_shader_fp64
1529
commonBuiltins.append(
1530
"float64_t fma(float64_t, float64_t, float64_t);"
1531
"f64vec2 fma(f64vec2, f64vec2, f64vec2 );"
1532
"f64vec3 fma(f64vec3, f64vec3, f64vec3 );"
1533
"f64vec4 fma(f64vec4, f64vec4, f64vec4 );"
1534
"\n");
1535
}
1536
1537
if ((profile == EEsProfile && version >= 310) ||
1538
(profile != EEsProfile && version >= 400)) {
1539
commonBuiltins.append(
1540
"float frexp(highp float, out highp int);"
1541
"vec2 frexp(highp vec2, out highp ivec2);"
1542
"vec3 frexp(highp vec3, out highp ivec3);"
1543
"vec4 frexp(highp vec4, out highp ivec4);"
1544
1545
"float ldexp(highp float, highp int);"
1546
"vec2 ldexp(highp vec2, highp ivec2);"
1547
"vec3 ldexp(highp vec3, highp ivec3);"
1548
"vec4 ldexp(highp vec4, highp ivec4);"
1549
1550
"\n");
1551
}
1552
1553
if (profile != EEsProfile && version >= 150) { // ARB_gpu_shader_fp64
1554
commonBuiltins.append(
1555
"double frexp(double, out int);"
1556
"dvec2 frexp( dvec2, out ivec2);"
1557
"dvec3 frexp( dvec3, out ivec3);"
1558
"dvec4 frexp( dvec4, out ivec4);"
1559
1560
"double ldexp(double, int);"
1561
"dvec2 ldexp( dvec2, ivec2);"
1562
"dvec3 ldexp( dvec3, ivec3);"
1563
"dvec4 ldexp( dvec4, ivec4);"
1564
1565
"double packDouble2x32(uvec2);"
1566
"uvec2 unpackDouble2x32(double);"
1567
1568
"\n");
1569
}
1570
1571
if (profile == EEsProfile && version >= 310) { // ARB_gpu_shader_fp64
1572
commonBuiltins.append(
1573
"float64_t frexp(float64_t, out int);"
1574
"f64vec2 frexp( f64vec2, out ivec2);"
1575
"f64vec3 frexp( f64vec3, out ivec3);"
1576
"f64vec4 frexp( f64vec4, out ivec4);"
1577
1578
"float64_t ldexp(float64_t, int);"
1579
"f64vec2 ldexp( f64vec2, ivec2);"
1580
"f64vec3 ldexp( f64vec3, ivec3);"
1581
"f64vec4 ldexp( f64vec4, ivec4);"
1582
1583
"\n");
1584
}
1585
1586
if ((profile == EEsProfile && version >= 300) ||
1587
(profile != EEsProfile && version >= 150)) {
1588
commonBuiltins.append(
1589
"highp uint packUnorm2x16(vec2);"
1590
"vec2 unpackUnorm2x16(highp uint);"
1591
"\n");
1592
}
1593
1594
if ((profile == EEsProfile && version >= 300) ||
1595
(profile != EEsProfile && version >= 150)) {
1596
commonBuiltins.append(
1597
"highp uint packSnorm2x16(vec2);"
1598
" vec2 unpackSnorm2x16(highp uint);"
1599
"highp uint packHalf2x16(vec2);"
1600
"\n");
1601
}
1602
1603
if (profile == EEsProfile && version >= 300) {
1604
commonBuiltins.append(
1605
"mediump vec2 unpackHalf2x16(highp uint);"
1606
"\n");
1607
} else if (profile != EEsProfile && version >= 150) {
1608
commonBuiltins.append(
1609
" vec2 unpackHalf2x16(highp uint);"
1610
"\n");
1611
}
1612
1613
if ((profile == EEsProfile && version >= 310) ||
1614
(profile != EEsProfile && version >= 150)) {
1615
commonBuiltins.append(
1616
"highp uint packSnorm4x8(vec4);"
1617
"highp uint packUnorm4x8(vec4);"
1618
"\n");
1619
}
1620
1621
if (profile == EEsProfile && version >= 310) {
1622
commonBuiltins.append(
1623
"mediump vec4 unpackSnorm4x8(highp uint);"
1624
"mediump vec4 unpackUnorm4x8(highp uint);"
1625
"\n");
1626
} else if (profile != EEsProfile && version >= 150) {
1627
commonBuiltins.append(
1628
"vec4 unpackSnorm4x8(highp uint);"
1629
"vec4 unpackUnorm4x8(highp uint);"
1630
"\n");
1631
}
1632
1633
//
1634
// Matrix Functions.
1635
//
1636
commonBuiltins.append(
1637
"mat2 matrixCompMult(mat2 x, mat2 y);"
1638
"mat3 matrixCompMult(mat3 x, mat3 y);"
1639
"mat4 matrixCompMult(mat4 x, mat4 y);"
1640
1641
"\n");
1642
1643
// 120 is correct for both ES and desktop
1644
if (version >= 120) {
1645
commonBuiltins.append(
1646
"mat2 outerProduct(vec2 c, vec2 r);"
1647
"mat3 outerProduct(vec3 c, vec3 r);"
1648
"mat4 outerProduct(vec4 c, vec4 r);"
1649
"mat2x3 outerProduct(vec3 c, vec2 r);"
1650
"mat3x2 outerProduct(vec2 c, vec3 r);"
1651
"mat2x4 outerProduct(vec4 c, vec2 r);"
1652
"mat4x2 outerProduct(vec2 c, vec4 r);"
1653
"mat3x4 outerProduct(vec4 c, vec3 r);"
1654
"mat4x3 outerProduct(vec3 c, vec4 r);"
1655
1656
"mat2 transpose(mat2 m);"
1657
"mat3 transpose(mat3 m);"
1658
"mat4 transpose(mat4 m);"
1659
"mat2x3 transpose(mat3x2 m);"
1660
"mat3x2 transpose(mat2x3 m);"
1661
"mat2x4 transpose(mat4x2 m);"
1662
"mat4x2 transpose(mat2x4 m);"
1663
"mat3x4 transpose(mat4x3 m);"
1664
"mat4x3 transpose(mat3x4 m);"
1665
1666
"mat2x3 matrixCompMult(mat2x3, mat2x3);"
1667
"mat2x4 matrixCompMult(mat2x4, mat2x4);"
1668
"mat3x2 matrixCompMult(mat3x2, mat3x2);"
1669
"mat3x4 matrixCompMult(mat3x4, mat3x4);"
1670
"mat4x2 matrixCompMult(mat4x2, mat4x2);"
1671
"mat4x3 matrixCompMult(mat4x3, mat4x3);"
1672
1673
"\n");
1674
1675
// 150 is correct for both ES and desktop
1676
if (version >= 150) {
1677
commonBuiltins.append(
1678
"float determinant(mat2 m);"
1679
"float determinant(mat3 m);"
1680
"float determinant(mat4 m);"
1681
1682
"mat2 inverse(mat2 m);"
1683
"mat3 inverse(mat3 m);"
1684
"mat4 inverse(mat4 m);"
1685
1686
"\n");
1687
}
1688
}
1689
1690
//
1691
// Original-style texture functions existing in all stages.
1692
// (Per-stage functions below.)
1693
//
1694
if ((profile == EEsProfile && version == 100) ||
1695
profile == ECompatibilityProfile ||
1696
(profile == ECoreProfile && version < 420) ||
1697
profile == ENoProfile) {
1698
if (spvVersion.spv == 0) {
1699
commonBuiltins.append(
1700
"vec4 texture2D(sampler2D, vec2);"
1701
1702
"vec4 texture2DProj(sampler2D, vec3);"
1703
"vec4 texture2DProj(sampler2D, vec4);"
1704
1705
"vec4 texture3D(sampler3D, vec3);" // OES_texture_3D, but caught by keyword check
1706
"vec4 texture3DProj(sampler3D, vec4);" // OES_texture_3D, but caught by keyword check
1707
1708
"vec4 textureCube(samplerCube, vec3);"
1709
1710
"\n");
1711
}
1712
}
1713
1714
if ( profile == ECompatibilityProfile ||
1715
(profile == ECoreProfile && version < 420) ||
1716
profile == ENoProfile) {
1717
if (spvVersion.spv == 0) {
1718
commonBuiltins.append(
1719
"vec4 texture1D(sampler1D, float);"
1720
1721
"vec4 texture1DProj(sampler1D, vec2);"
1722
"vec4 texture1DProj(sampler1D, vec4);"
1723
1724
"vec4 shadow1D(sampler1DShadow, vec3);"
1725
"vec4 shadow2D(sampler2DShadow, vec3);"
1726
"vec4 shadow1DProj(sampler1DShadow, vec4);"
1727
"vec4 shadow2DProj(sampler2DShadow, vec4);"
1728
1729
"vec4 texture2DRect(sampler2DRect, vec2);" // GL_ARB_texture_rectangle, caught by keyword check
1730
"vec4 texture2DRectProj(sampler2DRect, vec3);" // GL_ARB_texture_rectangle, caught by keyword check
1731
"vec4 texture2DRectProj(sampler2DRect, vec4);" // GL_ARB_texture_rectangle, caught by keyword check
1732
"vec4 shadow2DRect(sampler2DRectShadow, vec3);" // GL_ARB_texture_rectangle, caught by keyword check
1733
"vec4 shadow2DRectProj(sampler2DRectShadow, vec4);" // GL_ARB_texture_rectangle, caught by keyword check
1734
1735
"vec4 texture1DArray(sampler1DArray, vec2);" // GL_EXT_texture_array
1736
"vec4 texture2DArray(sampler2DArray, vec3);" // GL_EXT_texture_array
1737
"vec4 shadow1DArray(sampler1DArrayShadow, vec3);" // GL_EXT_texture_array
1738
"vec4 shadow2DArray(sampler2DArrayShadow, vec4);" // GL_EXT_texture_array
1739
"vec4 texture1DArray(sampler1DArray, vec2, float);" // GL_EXT_texture_array
1740
"vec4 texture2DArray(sampler2DArray, vec3, float);" // GL_EXT_texture_array
1741
"vec4 shadow1DArray(sampler1DArrayShadow, vec3, float);" // GL_EXT_texture_array
1742
"vec4 texture1DArrayLod(sampler1DArray, vec2, float);" // GL_EXT_texture_array
1743
"vec4 texture2DArrayLod(sampler2DArray, vec3, float);" // GL_EXT_texture_array
1744
"vec4 shadow1DArrayLod(sampler1DArrayShadow, vec3, float);" // GL_EXT_texture_array
1745
"\n");
1746
}
1747
}
1748
1749
if (profile == EEsProfile) {
1750
if (spvVersion.spv == 0) {
1751
if (version < 300) {
1752
commonBuiltins.append(
1753
"vec4 texture2D(samplerExternalOES, vec2 coord);" // GL_OES_EGL_image_external
1754
"vec4 texture2DProj(samplerExternalOES, vec3);" // GL_OES_EGL_image_external
1755
"vec4 texture2DProj(samplerExternalOES, vec4);" // GL_OES_EGL_image_external
1756
"\n");
1757
} else {
1758
commonBuiltins.append(
1759
"highp ivec2 textureSize(samplerExternalOES, int lod);" // GL_OES_EGL_image_external_essl3
1760
"vec4 texture(samplerExternalOES, vec2);" // GL_OES_EGL_image_external_essl3
1761
"vec4 texture(samplerExternalOES, vec2, float bias);" // GL_OES_EGL_image_external_essl3
1762
"vec4 textureProj(samplerExternalOES, vec3);" // GL_OES_EGL_image_external_essl3
1763
"vec4 textureProj(samplerExternalOES, vec3, float bias);" // GL_OES_EGL_image_external_essl3
1764
"vec4 textureProj(samplerExternalOES, vec4);" // GL_OES_EGL_image_external_essl3
1765
"vec4 textureProj(samplerExternalOES, vec4, float bias);" // GL_OES_EGL_image_external_essl3
1766
"vec4 texelFetch(samplerExternalOES, ivec2, int lod);" // GL_OES_EGL_image_external_essl3
1767
"\n");
1768
}
1769
commonBuiltins.append(
1770
"highp ivec2 textureSize(__samplerExternal2DY2YEXT, int lod);" // GL_EXT_YUV_target
1771
"vec4 texture(__samplerExternal2DY2YEXT, vec2);" // GL_EXT_YUV_target
1772
"vec4 texture(__samplerExternal2DY2YEXT, vec2, float bias);" // GL_EXT_YUV_target
1773
"vec4 textureProj(__samplerExternal2DY2YEXT, vec3);" // GL_EXT_YUV_target
1774
"vec4 textureProj(__samplerExternal2DY2YEXT, vec3, float bias);" // GL_EXT_YUV_target
1775
"vec4 textureProj(__samplerExternal2DY2YEXT, vec4);" // GL_EXT_YUV_target
1776
"vec4 textureProj(__samplerExternal2DY2YEXT, vec4, float bias);" // GL_EXT_YUV_target
1777
"vec4 texelFetch(__samplerExternal2DY2YEXT sampler, ivec2, int lod);" // GL_EXT_YUV_target
1778
"\n");
1779
commonBuiltins.append(
1780
"vec4 texture2DGradEXT(sampler2D, vec2, vec2, vec2);" // GL_EXT_shader_texture_lod
1781
"vec4 texture2DProjGradEXT(sampler2D, vec3, vec2, vec2);" // GL_EXT_shader_texture_lod
1782
"vec4 texture2DProjGradEXT(sampler2D, vec4, vec2, vec2);" // GL_EXT_shader_texture_lod
1783
"vec4 textureCubeGradEXT(samplerCube, vec3, vec3, vec3);" // GL_EXT_shader_texture_lod
1784
1785
"float shadow2DEXT(sampler2DShadow, vec3);" // GL_EXT_shadow_samplers
1786
"float shadow2DProjEXT(sampler2DShadow, vec4);" // GL_EXT_shadow_samplers
1787
1788
"\n");
1789
}
1790
}
1791
1792
//
1793
// Noise functions.
1794
//
1795
if (spvVersion.spv == 0 && profile != EEsProfile) {
1796
commonBuiltins.append(
1797
"float noise1(float x);"
1798
"float noise1(vec2 x);"
1799
"float noise1(vec3 x);"
1800
"float noise1(vec4 x);"
1801
1802
"vec2 noise2(float x);"
1803
"vec2 noise2(vec2 x);"
1804
"vec2 noise2(vec3 x);"
1805
"vec2 noise2(vec4 x);"
1806
1807
"vec3 noise3(float x);"
1808
"vec3 noise3(vec2 x);"
1809
"vec3 noise3(vec3 x);"
1810
"vec3 noise3(vec4 x);"
1811
1812
"vec4 noise4(float x);"
1813
"vec4 noise4(vec2 x);"
1814
"vec4 noise4(vec3 x);"
1815
"vec4 noise4(vec4 x);"
1816
1817
"\n");
1818
}
1819
1820
if (spvVersion.vulkan == 0) {
1821
//
1822
// Atomic counter functions.
1823
//
1824
if ((profile != EEsProfile && version >= 300) ||
1825
(profile == EEsProfile && version >= 310)) {
1826
commonBuiltins.append(
1827
"uint atomicCounterIncrement(atomic_uint);"
1828
"uint atomicCounterDecrement(atomic_uint);"
1829
"uint atomicCounter(atomic_uint);"
1830
1831
"\n");
1832
}
1833
if (profile != EEsProfile && version == 450) {
1834
commonBuiltins.append(
1835
"uint atomicCounterAddARB(atomic_uint, uint);"
1836
"uint atomicCounterSubtractARB(atomic_uint, uint);"
1837
"uint atomicCounterMinARB(atomic_uint, uint);"
1838
"uint atomicCounterMaxARB(atomic_uint, uint);"
1839
"uint atomicCounterAndARB(atomic_uint, uint);"
1840
"uint atomicCounterOrARB(atomic_uint, uint);"
1841
"uint atomicCounterXorARB(atomic_uint, uint);"
1842
"uint atomicCounterExchangeARB(atomic_uint, uint);"
1843
"uint atomicCounterCompSwapARB(atomic_uint, uint, uint);"
1844
1845
"\n");
1846
}
1847
1848
1849
if (profile != EEsProfile && version >= 460) {
1850
commonBuiltins.append(
1851
"uint atomicCounterAdd(atomic_uint, uint);"
1852
"uint atomicCounterSubtract(atomic_uint, uint);"
1853
"uint atomicCounterMin(atomic_uint, uint);"
1854
"uint atomicCounterMax(atomic_uint, uint);"
1855
"uint atomicCounterAnd(atomic_uint, uint);"
1856
"uint atomicCounterOr(atomic_uint, uint);"
1857
"uint atomicCounterXor(atomic_uint, uint);"
1858
"uint atomicCounterExchange(atomic_uint, uint);"
1859
"uint atomicCounterCompSwap(atomic_uint, uint, uint);"
1860
1861
"\n");
1862
}
1863
}
1864
else if (spvVersion.vulkanRelaxed) {
1865
//
1866
// Atomic counter functions act as aliases to normal atomic functions.
1867
// replace definitions to take 'volatile coherent uint' instead of 'atomic_uint'
1868
// and map to equivalent non-counter atomic op
1869
//
1870
if ((profile != EEsProfile && version >= 300) ||
1871
(profile == EEsProfile && version >= 310)) {
1872
commonBuiltins.append(
1873
"uint atomicCounterIncrement(volatile coherent uint);"
1874
"uint atomicCounterDecrement(volatile coherent uint);"
1875
"uint atomicCounter(volatile coherent uint);"
1876
1877
"\n");
1878
}
1879
if (profile != EEsProfile && version >= 460) {
1880
commonBuiltins.append(
1881
"uint atomicCounterAdd(volatile coherent uint, uint);"
1882
"uint atomicCounterSubtract(volatile coherent uint, uint);"
1883
"uint atomicCounterMin(volatile coherent uint, uint);"
1884
"uint atomicCounterMax(volatile coherent uint, uint);"
1885
"uint atomicCounterAnd(volatile coherent uint, uint);"
1886
"uint atomicCounterOr(volatile coherent uint, uint);"
1887
"uint atomicCounterXor(volatile coherent uint, uint);"
1888
"uint atomicCounterExchange(volatile coherent uint, uint);"
1889
"uint atomicCounterCompSwap(volatile coherent uint, uint, uint);"
1890
1891
"\n");
1892
}
1893
}
1894
1895
// Bitfield
1896
if ((profile == EEsProfile && version >= 310) ||
1897
(profile != EEsProfile && version >= 400)) {
1898
commonBuiltins.append(
1899
" int bitfieldExtract( int, int, int);"
1900
"ivec2 bitfieldExtract(ivec2, int, int);"
1901
"ivec3 bitfieldExtract(ivec3, int, int);"
1902
"ivec4 bitfieldExtract(ivec4, int, int);"
1903
1904
" uint bitfieldExtract( uint, int, int);"
1905
"uvec2 bitfieldExtract(uvec2, int, int);"
1906
"uvec3 bitfieldExtract(uvec3, int, int);"
1907
"uvec4 bitfieldExtract(uvec4, int, int);"
1908
1909
" int bitfieldInsert( int base, int, int, int);"
1910
"ivec2 bitfieldInsert(ivec2 base, ivec2, int, int);"
1911
"ivec3 bitfieldInsert(ivec3 base, ivec3, int, int);"
1912
"ivec4 bitfieldInsert(ivec4 base, ivec4, int, int);"
1913
1914
" uint bitfieldInsert( uint base, uint, int, int);"
1915
"uvec2 bitfieldInsert(uvec2 base, uvec2, int, int);"
1916
"uvec3 bitfieldInsert(uvec3 base, uvec3, int, int);"
1917
"uvec4 bitfieldInsert(uvec4 base, uvec4, int, int);"
1918
1919
"\n");
1920
}
1921
1922
if (profile != EEsProfile && version >= 400) {
1923
commonBuiltins.append(
1924
" int findLSB( int);"
1925
"ivec2 findLSB(ivec2);"
1926
"ivec3 findLSB(ivec3);"
1927
"ivec4 findLSB(ivec4);"
1928
1929
" int findLSB( uint);"
1930
"ivec2 findLSB(uvec2);"
1931
"ivec3 findLSB(uvec3);"
1932
"ivec4 findLSB(uvec4);"
1933
1934
"\n");
1935
} else if (profile == EEsProfile && version >= 310) {
1936
commonBuiltins.append(
1937
"lowp int findLSB( int);"
1938
"lowp ivec2 findLSB(ivec2);"
1939
"lowp ivec3 findLSB(ivec3);"
1940
"lowp ivec4 findLSB(ivec4);"
1941
1942
"lowp int findLSB( uint);"
1943
"lowp ivec2 findLSB(uvec2);"
1944
"lowp ivec3 findLSB(uvec3);"
1945
"lowp ivec4 findLSB(uvec4);"
1946
1947
"\n");
1948
}
1949
1950
if (profile != EEsProfile && version >= 400) {
1951
commonBuiltins.append(
1952
" int bitCount( int);"
1953
"ivec2 bitCount(ivec2);"
1954
"ivec3 bitCount(ivec3);"
1955
"ivec4 bitCount(ivec4);"
1956
1957
" int bitCount( uint);"
1958
"ivec2 bitCount(uvec2);"
1959
"ivec3 bitCount(uvec3);"
1960
"ivec4 bitCount(uvec4);"
1961
1962
" int findMSB(highp int);"
1963
"ivec2 findMSB(highp ivec2);"
1964
"ivec3 findMSB(highp ivec3);"
1965
"ivec4 findMSB(highp ivec4);"
1966
1967
" int findMSB(highp uint);"
1968
"ivec2 findMSB(highp uvec2);"
1969
"ivec3 findMSB(highp uvec3);"
1970
"ivec4 findMSB(highp uvec4);"
1971
1972
"\n");
1973
}
1974
1975
if ((profile == EEsProfile && version >= 310) ||
1976
(profile != EEsProfile && version >= 400)) {
1977
commonBuiltins.append(
1978
" uint uaddCarry(highp uint, highp uint, out lowp uint carry);"
1979
"uvec2 uaddCarry(highp uvec2, highp uvec2, out lowp uvec2 carry);"
1980
"uvec3 uaddCarry(highp uvec3, highp uvec3, out lowp uvec3 carry);"
1981
"uvec4 uaddCarry(highp uvec4, highp uvec4, out lowp uvec4 carry);"
1982
1983
" uint usubBorrow(highp uint, highp uint, out lowp uint borrow);"
1984
"uvec2 usubBorrow(highp uvec2, highp uvec2, out lowp uvec2 borrow);"
1985
"uvec3 usubBorrow(highp uvec3, highp uvec3, out lowp uvec3 borrow);"
1986
"uvec4 usubBorrow(highp uvec4, highp uvec4, out lowp uvec4 borrow);"
1987
1988
"void umulExtended(highp uint, highp uint, out highp uint, out highp uint lsb);"
1989
"void umulExtended(highp uvec2, highp uvec2, out highp uvec2, out highp uvec2 lsb);"
1990
"void umulExtended(highp uvec3, highp uvec3, out highp uvec3, out highp uvec3 lsb);"
1991
"void umulExtended(highp uvec4, highp uvec4, out highp uvec4, out highp uvec4 lsb);"
1992
1993
"void imulExtended(highp int, highp int, out highp int, out highp int lsb);"
1994
"void imulExtended(highp ivec2, highp ivec2, out highp ivec2, out highp ivec2 lsb);"
1995
"void imulExtended(highp ivec3, highp ivec3, out highp ivec3, out highp ivec3 lsb);"
1996
"void imulExtended(highp ivec4, highp ivec4, out highp ivec4, out highp ivec4 lsb);"
1997
1998
" int bitfieldReverse(highp int);"
1999
"ivec2 bitfieldReverse(highp ivec2);"
2000
"ivec3 bitfieldReverse(highp ivec3);"
2001
"ivec4 bitfieldReverse(highp ivec4);"
2002
2003
" uint bitfieldReverse(highp uint);"
2004
"uvec2 bitfieldReverse(highp uvec2);"
2005
"uvec3 bitfieldReverse(highp uvec3);"
2006
"uvec4 bitfieldReverse(highp uvec4);"
2007
2008
"\n");
2009
}
2010
2011
if (profile == EEsProfile && version >= 310) {
2012
commonBuiltins.append(
2013
"lowp int bitCount( int);"
2014
"lowp ivec2 bitCount(ivec2);"
2015
"lowp ivec3 bitCount(ivec3);"
2016
"lowp ivec4 bitCount(ivec4);"
2017
2018
"lowp int bitCount( uint);"
2019
"lowp ivec2 bitCount(uvec2);"
2020
"lowp ivec3 bitCount(uvec3);"
2021
"lowp ivec4 bitCount(uvec4);"
2022
2023
"lowp int findMSB(highp int);"
2024
"lowp ivec2 findMSB(highp ivec2);"
2025
"lowp ivec3 findMSB(highp ivec3);"
2026
"lowp ivec4 findMSB(highp ivec4);"
2027
2028
"lowp int findMSB(highp uint);"
2029
"lowp ivec2 findMSB(highp uvec2);"
2030
"lowp ivec3 findMSB(highp uvec3);"
2031
"lowp ivec4 findMSB(highp uvec4);"
2032
2033
"\n");
2034
}
2035
2036
// GL_ARB_shader_ballot
2037
if (profile != EEsProfile && version >= 450) {
2038
commonBuiltins.append(
2039
"uint64_t ballotARB(bool);"
2040
2041
"float readInvocationARB(float, uint);"
2042
"vec2 readInvocationARB(vec2, uint);"
2043
"vec3 readInvocationARB(vec3, uint);"
2044
"vec4 readInvocationARB(vec4, uint);"
2045
2046
"int readInvocationARB(int, uint);"
2047
"ivec2 readInvocationARB(ivec2, uint);"
2048
"ivec3 readInvocationARB(ivec3, uint);"
2049
"ivec4 readInvocationARB(ivec4, uint);"
2050
2051
"uint readInvocationARB(uint, uint);"
2052
"uvec2 readInvocationARB(uvec2, uint);"
2053
"uvec3 readInvocationARB(uvec3, uint);"
2054
"uvec4 readInvocationARB(uvec4, uint);"
2055
2056
"float readFirstInvocationARB(float);"
2057
"vec2 readFirstInvocationARB(vec2);"
2058
"vec3 readFirstInvocationARB(vec3);"
2059
"vec4 readFirstInvocationARB(vec4);"
2060
2061
"int readFirstInvocationARB(int);"
2062
"ivec2 readFirstInvocationARB(ivec2);"
2063
"ivec3 readFirstInvocationARB(ivec3);"
2064
"ivec4 readFirstInvocationARB(ivec4);"
2065
2066
"uint readFirstInvocationARB(uint);"
2067
"uvec2 readFirstInvocationARB(uvec2);"
2068
"uvec3 readFirstInvocationARB(uvec3);"
2069
"uvec4 readFirstInvocationARB(uvec4);"
2070
2071
"\n");
2072
}
2073
2074
// GL_ARB_shader_group_vote
2075
if (profile != EEsProfile && version >= 430) {
2076
commonBuiltins.append(
2077
"bool anyInvocationARB(bool);"
2078
"bool allInvocationsARB(bool);"
2079
"bool allInvocationsEqualARB(bool);"
2080
2081
"\n");
2082
}
2083
2084
// GL_KHR_shader_subgroup
2085
if ((profile == EEsProfile && version >= 310) ||
2086
(profile != EEsProfile && version >= 140)) {
2087
commonBuiltins.append(
2088
"void subgroupBarrier();"
2089
"void subgroupMemoryBarrier();"
2090
"void subgroupMemoryBarrierBuffer();"
2091
"void subgroupMemoryBarrierImage();"
2092
"bool subgroupElect();"
2093
2094
"bool subgroupAll(bool);\n"
2095
"bool subgroupAny(bool);\n"
2096
"uvec4 subgroupBallot(bool);\n"
2097
"bool subgroupInverseBallot(uvec4);\n"
2098
"bool subgroupBallotBitExtract(uvec4, uint);\n"
2099
"uint subgroupBallotBitCount(uvec4);\n"
2100
"uint subgroupBallotInclusiveBitCount(uvec4);\n"
2101
"uint subgroupBallotExclusiveBitCount(uvec4);\n"
2102
"uint subgroupBallotFindLSB(uvec4);\n"
2103
"uint subgroupBallotFindMSB(uvec4);\n"
2104
);
2105
2106
// Generate all flavors of subgroup ops.
2107
static const char *subgroupOps[] =
2108
{
2109
"bool subgroupAllEqual(%s);\n",
2110
"%s subgroupBroadcast(%s, uint);\n",
2111
"%s subgroupBroadcastFirst(%s);\n",
2112
"%s subgroupShuffle(%s, uint);\n",
2113
"%s subgroupShuffleXor(%s, uint);\n",
2114
"%s subgroupShuffleUp(%s, uint delta);\n",
2115
"%s subgroupShuffleDown(%s, uint delta);\n",
2116
"%s subgroupRotate(%s, uint);\n",
2117
"%s subgroupClusteredRotate(%s, uint, uint);\n",
2118
"%s subgroupAdd(%s);\n",
2119
"%s subgroupMul(%s);\n",
2120
"%s subgroupMin(%s);\n",
2121
"%s subgroupMax(%s);\n",
2122
"%s subgroupAnd(%s);\n",
2123
"%s subgroupOr(%s);\n",
2124
"%s subgroupXor(%s);\n",
2125
"%s subgroupInclusiveAdd(%s);\n",
2126
"%s subgroupInclusiveMul(%s);\n",
2127
"%s subgroupInclusiveMin(%s);\n",
2128
"%s subgroupInclusiveMax(%s);\n",
2129
"%s subgroupInclusiveAnd(%s);\n",
2130
"%s subgroupInclusiveOr(%s);\n",
2131
"%s subgroupInclusiveXor(%s);\n",
2132
"%s subgroupExclusiveAdd(%s);\n",
2133
"%s subgroupExclusiveMul(%s);\n",
2134
"%s subgroupExclusiveMin(%s);\n",
2135
"%s subgroupExclusiveMax(%s);\n",
2136
"%s subgroupExclusiveAnd(%s);\n",
2137
"%s subgroupExclusiveOr(%s);\n",
2138
"%s subgroupExclusiveXor(%s);\n",
2139
"%s subgroupClusteredAdd(%s, uint);\n",
2140
"%s subgroupClusteredMul(%s, uint);\n",
2141
"%s subgroupClusteredMin(%s, uint);\n",
2142
"%s subgroupClusteredMax(%s, uint);\n",
2143
"%s subgroupClusteredAnd(%s, uint);\n",
2144
"%s subgroupClusteredOr(%s, uint);\n",
2145
"%s subgroupClusteredXor(%s, uint);\n",
2146
"%s subgroupQuadBroadcast(%s, uint);\n",
2147
"%s subgroupQuadSwapHorizontal(%s);\n",
2148
"%s subgroupQuadSwapVertical(%s);\n",
2149
"%s subgroupQuadSwapDiagonal(%s);\n",
2150
"uvec4 subgroupPartitionNV(%s);\n",
2151
"%s subgroupPartitionedAddNV(%s, uvec4 ballot);\n",
2152
"%s subgroupPartitionedMulNV(%s, uvec4 ballot);\n",
2153
"%s subgroupPartitionedMinNV(%s, uvec4 ballot);\n",
2154
"%s subgroupPartitionedMaxNV(%s, uvec4 ballot);\n",
2155
"%s subgroupPartitionedAndNV(%s, uvec4 ballot);\n",
2156
"%s subgroupPartitionedOrNV(%s, uvec4 ballot);\n",
2157
"%s subgroupPartitionedXorNV(%s, uvec4 ballot);\n",
2158
"%s subgroupPartitionedInclusiveAddNV(%s, uvec4 ballot);\n",
2159
"%s subgroupPartitionedInclusiveMulNV(%s, uvec4 ballot);\n",
2160
"%s subgroupPartitionedInclusiveMinNV(%s, uvec4 ballot);\n",
2161
"%s subgroupPartitionedInclusiveMaxNV(%s, uvec4 ballot);\n",
2162
"%s subgroupPartitionedInclusiveAndNV(%s, uvec4 ballot);\n",
2163
"%s subgroupPartitionedInclusiveOrNV(%s, uvec4 ballot);\n",
2164
"%s subgroupPartitionedInclusiveXorNV(%s, uvec4 ballot);\n",
2165
"%s subgroupPartitionedExclusiveAddNV(%s, uvec4 ballot);\n",
2166
"%s subgroupPartitionedExclusiveMulNV(%s, uvec4 ballot);\n",
2167
"%s subgroupPartitionedExclusiveMinNV(%s, uvec4 ballot);\n",
2168
"%s subgroupPartitionedExclusiveMaxNV(%s, uvec4 ballot);\n",
2169
"%s subgroupPartitionedExclusiveAndNV(%s, uvec4 ballot);\n",
2170
"%s subgroupPartitionedExclusiveOrNV(%s, uvec4 ballot);\n",
2171
"%s subgroupPartitionedExclusiveXorNV(%s, uvec4 ballot);\n",
2172
};
2173
2174
static const char *floatTypes[] = {
2175
"float", "vec2", "vec3", "vec4",
2176
"float16_t", "f16vec2", "f16vec3", "f16vec4",
2177
};
2178
static const char *doubleTypes[] = {
2179
"double", "dvec2", "dvec3", "dvec4",
2180
};
2181
static const char *intTypes[] = {
2182
"int8_t", "i8vec2", "i8vec3", "i8vec4",
2183
"int16_t", "i16vec2", "i16vec3", "i16vec4",
2184
"int", "ivec2", "ivec3", "ivec4",
2185
"int64_t", "i64vec2", "i64vec3", "i64vec4",
2186
"uint8_t", "u8vec2", "u8vec3", "u8vec4",
2187
"uint16_t", "u16vec2", "u16vec3", "u16vec4",
2188
"uint", "uvec2", "uvec3", "uvec4",
2189
"uint64_t", "u64vec2", "u64vec3", "u64vec4",
2190
};
2191
static const char *boolTypes[] = {
2192
"bool", "bvec2", "bvec3", "bvec4",
2193
};
2194
2195
for (size_t i = 0; i < sizeof(subgroupOps)/sizeof(subgroupOps[0]); ++i) {
2196
const char *op = subgroupOps[i];
2197
2198
// Logical operations don't support float
2199
bool logicalOp = strstr(op, "Or") || strstr(op, "And") ||
2200
(strstr(op, "Xor") && !strstr(op, "ShuffleXor"));
2201
// Math operations don't support bool
2202
bool mathOp = strstr(op, "Add") || strstr(op, "Mul") || strstr(op, "Min") || strstr(op, "Max");
2203
2204
const int bufSize = 256;
2205
char buf[bufSize];
2206
2207
if (!logicalOp) {
2208
for (size_t j = 0; j < sizeof(floatTypes)/sizeof(floatTypes[0]); ++j) {
2209
snprintf(buf, bufSize, op, floatTypes[j], floatTypes[j]);
2210
commonBuiltins.append(buf);
2211
}
2212
if (profile != EEsProfile && version >= 400) {
2213
for (size_t j = 0; j < sizeof(doubleTypes)/sizeof(doubleTypes[0]); ++j) {
2214
snprintf(buf, bufSize, op, doubleTypes[j], doubleTypes[j]);
2215
commonBuiltins.append(buf);
2216
}
2217
}
2218
}
2219
if (!mathOp) {
2220
for (size_t j = 0; j < sizeof(boolTypes)/sizeof(boolTypes[0]); ++j) {
2221
snprintf(buf, bufSize, op, boolTypes[j], boolTypes[j]);
2222
commonBuiltins.append(buf);
2223
}
2224
}
2225
for (size_t j = 0; j < sizeof(intTypes)/sizeof(intTypes[0]); ++j) {
2226
snprintf(buf, bufSize, op, intTypes[j], intTypes[j]);
2227
commonBuiltins.append(buf);
2228
}
2229
}
2230
2231
stageBuiltins[EShLangCompute].append(
2232
"void subgroupMemoryBarrierShared();"
2233
2234
"\n"
2235
);
2236
stageBuiltins[EShLangMesh].append(
2237
"void subgroupMemoryBarrierShared();"
2238
"\n"
2239
);
2240
stageBuiltins[EShLangTask].append(
2241
"void subgroupMemoryBarrierShared();"
2242
"\n"
2243
);
2244
}
2245
2246
// GL_EXT_shader_quad_control
2247
if ((profile == EEsProfile && version >= 310) ||
2248
(profile != EEsProfile && version >= 140)) {
2249
commonBuiltins.append(
2250
"bool subgroupQuadAll(bool);\n"
2251
"bool subgroupQuadAny(bool);\n"
2252
);
2253
}
2254
2255
if (profile != EEsProfile && version >= 460) {
2256
commonBuiltins.append(
2257
"bool anyInvocation(bool);"
2258
"bool allInvocations(bool);"
2259
"bool allInvocationsEqual(bool);"
2260
2261
"\n");
2262
}
2263
2264
// GL_AMD_shader_ballot
2265
if (profile != EEsProfile && version >= 450) {
2266
commonBuiltins.append(
2267
"float minInvocationsAMD(float);"
2268
"vec2 minInvocationsAMD(vec2);"
2269
"vec3 minInvocationsAMD(vec3);"
2270
"vec4 minInvocationsAMD(vec4);"
2271
2272
"int minInvocationsAMD(int);"
2273
"ivec2 minInvocationsAMD(ivec2);"
2274
"ivec3 minInvocationsAMD(ivec3);"
2275
"ivec4 minInvocationsAMD(ivec4);"
2276
2277
"uint minInvocationsAMD(uint);"
2278
"uvec2 minInvocationsAMD(uvec2);"
2279
"uvec3 minInvocationsAMD(uvec3);"
2280
"uvec4 minInvocationsAMD(uvec4);"
2281
2282
"double minInvocationsAMD(double);"
2283
"dvec2 minInvocationsAMD(dvec2);"
2284
"dvec3 minInvocationsAMD(dvec3);"
2285
"dvec4 minInvocationsAMD(dvec4);"
2286
2287
"int64_t minInvocationsAMD(int64_t);"
2288
"i64vec2 minInvocationsAMD(i64vec2);"
2289
"i64vec3 minInvocationsAMD(i64vec3);"
2290
"i64vec4 minInvocationsAMD(i64vec4);"
2291
2292
"uint64_t minInvocationsAMD(uint64_t);"
2293
"u64vec2 minInvocationsAMD(u64vec2);"
2294
"u64vec3 minInvocationsAMD(u64vec3);"
2295
"u64vec4 minInvocationsAMD(u64vec4);"
2296
2297
"float16_t minInvocationsAMD(float16_t);"
2298
"f16vec2 minInvocationsAMD(f16vec2);"
2299
"f16vec3 minInvocationsAMD(f16vec3);"
2300
"f16vec4 minInvocationsAMD(f16vec4);"
2301
2302
"int16_t minInvocationsAMD(int16_t);"
2303
"i16vec2 minInvocationsAMD(i16vec2);"
2304
"i16vec3 minInvocationsAMD(i16vec3);"
2305
"i16vec4 minInvocationsAMD(i16vec4);"
2306
2307
"uint16_t minInvocationsAMD(uint16_t);"
2308
"u16vec2 minInvocationsAMD(u16vec2);"
2309
"u16vec3 minInvocationsAMD(u16vec3);"
2310
"u16vec4 minInvocationsAMD(u16vec4);"
2311
2312
"float minInvocationsInclusiveScanAMD(float);"
2313
"vec2 minInvocationsInclusiveScanAMD(vec2);"
2314
"vec3 minInvocationsInclusiveScanAMD(vec3);"
2315
"vec4 minInvocationsInclusiveScanAMD(vec4);"
2316
2317
"int minInvocationsInclusiveScanAMD(int);"
2318
"ivec2 minInvocationsInclusiveScanAMD(ivec2);"
2319
"ivec3 minInvocationsInclusiveScanAMD(ivec3);"
2320
"ivec4 minInvocationsInclusiveScanAMD(ivec4);"
2321
2322
"uint minInvocationsInclusiveScanAMD(uint);"
2323
"uvec2 minInvocationsInclusiveScanAMD(uvec2);"
2324
"uvec3 minInvocationsInclusiveScanAMD(uvec3);"
2325
"uvec4 minInvocationsInclusiveScanAMD(uvec4);"
2326
2327
"double minInvocationsInclusiveScanAMD(double);"
2328
"dvec2 minInvocationsInclusiveScanAMD(dvec2);"
2329
"dvec3 minInvocationsInclusiveScanAMD(dvec3);"
2330
"dvec4 minInvocationsInclusiveScanAMD(dvec4);"
2331
2332
"int64_t minInvocationsInclusiveScanAMD(int64_t);"
2333
"i64vec2 minInvocationsInclusiveScanAMD(i64vec2);"
2334
"i64vec3 minInvocationsInclusiveScanAMD(i64vec3);"
2335
"i64vec4 minInvocationsInclusiveScanAMD(i64vec4);"
2336
2337
"uint64_t minInvocationsInclusiveScanAMD(uint64_t);"
2338
"u64vec2 minInvocationsInclusiveScanAMD(u64vec2);"
2339
"u64vec3 minInvocationsInclusiveScanAMD(u64vec3);"
2340
"u64vec4 minInvocationsInclusiveScanAMD(u64vec4);"
2341
2342
"float16_t minInvocationsInclusiveScanAMD(float16_t);"
2343
"f16vec2 minInvocationsInclusiveScanAMD(f16vec2);"
2344
"f16vec3 minInvocationsInclusiveScanAMD(f16vec3);"
2345
"f16vec4 minInvocationsInclusiveScanAMD(f16vec4);"
2346
2347
"int16_t minInvocationsInclusiveScanAMD(int16_t);"
2348
"i16vec2 minInvocationsInclusiveScanAMD(i16vec2);"
2349
"i16vec3 minInvocationsInclusiveScanAMD(i16vec3);"
2350
"i16vec4 minInvocationsInclusiveScanAMD(i16vec4);"
2351
2352
"uint16_t minInvocationsInclusiveScanAMD(uint16_t);"
2353
"u16vec2 minInvocationsInclusiveScanAMD(u16vec2);"
2354
"u16vec3 minInvocationsInclusiveScanAMD(u16vec3);"
2355
"u16vec4 minInvocationsInclusiveScanAMD(u16vec4);"
2356
2357
"float minInvocationsExclusiveScanAMD(float);"
2358
"vec2 minInvocationsExclusiveScanAMD(vec2);"
2359
"vec3 minInvocationsExclusiveScanAMD(vec3);"
2360
"vec4 minInvocationsExclusiveScanAMD(vec4);"
2361
2362
"int minInvocationsExclusiveScanAMD(int);"
2363
"ivec2 minInvocationsExclusiveScanAMD(ivec2);"
2364
"ivec3 minInvocationsExclusiveScanAMD(ivec3);"
2365
"ivec4 minInvocationsExclusiveScanAMD(ivec4);"
2366
2367
"uint minInvocationsExclusiveScanAMD(uint);"
2368
"uvec2 minInvocationsExclusiveScanAMD(uvec2);"
2369
"uvec3 minInvocationsExclusiveScanAMD(uvec3);"
2370
"uvec4 minInvocationsExclusiveScanAMD(uvec4);"
2371
2372
"double minInvocationsExclusiveScanAMD(double);"
2373
"dvec2 minInvocationsExclusiveScanAMD(dvec2);"
2374
"dvec3 minInvocationsExclusiveScanAMD(dvec3);"
2375
"dvec4 minInvocationsExclusiveScanAMD(dvec4);"
2376
2377
"int64_t minInvocationsExclusiveScanAMD(int64_t);"
2378
"i64vec2 minInvocationsExclusiveScanAMD(i64vec2);"
2379
"i64vec3 minInvocationsExclusiveScanAMD(i64vec3);"
2380
"i64vec4 minInvocationsExclusiveScanAMD(i64vec4);"
2381
2382
"uint64_t minInvocationsExclusiveScanAMD(uint64_t);"
2383
"u64vec2 minInvocationsExclusiveScanAMD(u64vec2);"
2384
"u64vec3 minInvocationsExclusiveScanAMD(u64vec3);"
2385
"u64vec4 minInvocationsExclusiveScanAMD(u64vec4);"
2386
2387
"float16_t minInvocationsExclusiveScanAMD(float16_t);"
2388
"f16vec2 minInvocationsExclusiveScanAMD(f16vec2);"
2389
"f16vec3 minInvocationsExclusiveScanAMD(f16vec3);"
2390
"f16vec4 minInvocationsExclusiveScanAMD(f16vec4);"
2391
2392
"int16_t minInvocationsExclusiveScanAMD(int16_t);"
2393
"i16vec2 minInvocationsExclusiveScanAMD(i16vec2);"
2394
"i16vec3 minInvocationsExclusiveScanAMD(i16vec3);"
2395
"i16vec4 minInvocationsExclusiveScanAMD(i16vec4);"
2396
2397
"uint16_t minInvocationsExclusiveScanAMD(uint16_t);"
2398
"u16vec2 minInvocationsExclusiveScanAMD(u16vec2);"
2399
"u16vec3 minInvocationsExclusiveScanAMD(u16vec3);"
2400
"u16vec4 minInvocationsExclusiveScanAMD(u16vec4);"
2401
2402
"float maxInvocationsAMD(float);"
2403
"vec2 maxInvocationsAMD(vec2);"
2404
"vec3 maxInvocationsAMD(vec3);"
2405
"vec4 maxInvocationsAMD(vec4);"
2406
2407
"int maxInvocationsAMD(int);"
2408
"ivec2 maxInvocationsAMD(ivec2);"
2409
"ivec3 maxInvocationsAMD(ivec3);"
2410
"ivec4 maxInvocationsAMD(ivec4);"
2411
2412
"uint maxInvocationsAMD(uint);"
2413
"uvec2 maxInvocationsAMD(uvec2);"
2414
"uvec3 maxInvocationsAMD(uvec3);"
2415
"uvec4 maxInvocationsAMD(uvec4);"
2416
2417
"double maxInvocationsAMD(double);"
2418
"dvec2 maxInvocationsAMD(dvec2);"
2419
"dvec3 maxInvocationsAMD(dvec3);"
2420
"dvec4 maxInvocationsAMD(dvec4);"
2421
2422
"int64_t maxInvocationsAMD(int64_t);"
2423
"i64vec2 maxInvocationsAMD(i64vec2);"
2424
"i64vec3 maxInvocationsAMD(i64vec3);"
2425
"i64vec4 maxInvocationsAMD(i64vec4);"
2426
2427
"uint64_t maxInvocationsAMD(uint64_t);"
2428
"u64vec2 maxInvocationsAMD(u64vec2);"
2429
"u64vec3 maxInvocationsAMD(u64vec3);"
2430
"u64vec4 maxInvocationsAMD(u64vec4);"
2431
2432
"float16_t maxInvocationsAMD(float16_t);"
2433
"f16vec2 maxInvocationsAMD(f16vec2);"
2434
"f16vec3 maxInvocationsAMD(f16vec3);"
2435
"f16vec4 maxInvocationsAMD(f16vec4);"
2436
2437
"int16_t maxInvocationsAMD(int16_t);"
2438
"i16vec2 maxInvocationsAMD(i16vec2);"
2439
"i16vec3 maxInvocationsAMD(i16vec3);"
2440
"i16vec4 maxInvocationsAMD(i16vec4);"
2441
2442
"uint16_t maxInvocationsAMD(uint16_t);"
2443
"u16vec2 maxInvocationsAMD(u16vec2);"
2444
"u16vec3 maxInvocationsAMD(u16vec3);"
2445
"u16vec4 maxInvocationsAMD(u16vec4);"
2446
2447
"float maxInvocationsInclusiveScanAMD(float);"
2448
"vec2 maxInvocationsInclusiveScanAMD(vec2);"
2449
"vec3 maxInvocationsInclusiveScanAMD(vec3);"
2450
"vec4 maxInvocationsInclusiveScanAMD(vec4);"
2451
2452
"int maxInvocationsInclusiveScanAMD(int);"
2453
"ivec2 maxInvocationsInclusiveScanAMD(ivec2);"
2454
"ivec3 maxInvocationsInclusiveScanAMD(ivec3);"
2455
"ivec4 maxInvocationsInclusiveScanAMD(ivec4);"
2456
2457
"uint maxInvocationsInclusiveScanAMD(uint);"
2458
"uvec2 maxInvocationsInclusiveScanAMD(uvec2);"
2459
"uvec3 maxInvocationsInclusiveScanAMD(uvec3);"
2460
"uvec4 maxInvocationsInclusiveScanAMD(uvec4);"
2461
2462
"double maxInvocationsInclusiveScanAMD(double);"
2463
"dvec2 maxInvocationsInclusiveScanAMD(dvec2);"
2464
"dvec3 maxInvocationsInclusiveScanAMD(dvec3);"
2465
"dvec4 maxInvocationsInclusiveScanAMD(dvec4);"
2466
2467
"int64_t maxInvocationsInclusiveScanAMD(int64_t);"
2468
"i64vec2 maxInvocationsInclusiveScanAMD(i64vec2);"
2469
"i64vec3 maxInvocationsInclusiveScanAMD(i64vec3);"
2470
"i64vec4 maxInvocationsInclusiveScanAMD(i64vec4);"
2471
2472
"uint64_t maxInvocationsInclusiveScanAMD(uint64_t);"
2473
"u64vec2 maxInvocationsInclusiveScanAMD(u64vec2);"
2474
"u64vec3 maxInvocationsInclusiveScanAMD(u64vec3);"
2475
"u64vec4 maxInvocationsInclusiveScanAMD(u64vec4);"
2476
2477
"float16_t maxInvocationsInclusiveScanAMD(float16_t);"
2478
"f16vec2 maxInvocationsInclusiveScanAMD(f16vec2);"
2479
"f16vec3 maxInvocationsInclusiveScanAMD(f16vec3);"
2480
"f16vec4 maxInvocationsInclusiveScanAMD(f16vec4);"
2481
2482
"int16_t maxInvocationsInclusiveScanAMD(int16_t);"
2483
"i16vec2 maxInvocationsInclusiveScanAMD(i16vec2);"
2484
"i16vec3 maxInvocationsInclusiveScanAMD(i16vec3);"
2485
"i16vec4 maxInvocationsInclusiveScanAMD(i16vec4);"
2486
2487
"uint16_t maxInvocationsInclusiveScanAMD(uint16_t);"
2488
"u16vec2 maxInvocationsInclusiveScanAMD(u16vec2);"
2489
"u16vec3 maxInvocationsInclusiveScanAMD(u16vec3);"
2490
"u16vec4 maxInvocationsInclusiveScanAMD(u16vec4);"
2491
2492
"float maxInvocationsExclusiveScanAMD(float);"
2493
"vec2 maxInvocationsExclusiveScanAMD(vec2);"
2494
"vec3 maxInvocationsExclusiveScanAMD(vec3);"
2495
"vec4 maxInvocationsExclusiveScanAMD(vec4);"
2496
2497
"int maxInvocationsExclusiveScanAMD(int);"
2498
"ivec2 maxInvocationsExclusiveScanAMD(ivec2);"
2499
"ivec3 maxInvocationsExclusiveScanAMD(ivec3);"
2500
"ivec4 maxInvocationsExclusiveScanAMD(ivec4);"
2501
2502
"uint maxInvocationsExclusiveScanAMD(uint);"
2503
"uvec2 maxInvocationsExclusiveScanAMD(uvec2);"
2504
"uvec3 maxInvocationsExclusiveScanAMD(uvec3);"
2505
"uvec4 maxInvocationsExclusiveScanAMD(uvec4);"
2506
2507
"double maxInvocationsExclusiveScanAMD(double);"
2508
"dvec2 maxInvocationsExclusiveScanAMD(dvec2);"
2509
"dvec3 maxInvocationsExclusiveScanAMD(dvec3);"
2510
"dvec4 maxInvocationsExclusiveScanAMD(dvec4);"
2511
2512
"int64_t maxInvocationsExclusiveScanAMD(int64_t);"
2513
"i64vec2 maxInvocationsExclusiveScanAMD(i64vec2);"
2514
"i64vec3 maxInvocationsExclusiveScanAMD(i64vec3);"
2515
"i64vec4 maxInvocationsExclusiveScanAMD(i64vec4);"
2516
2517
"uint64_t maxInvocationsExclusiveScanAMD(uint64_t);"
2518
"u64vec2 maxInvocationsExclusiveScanAMD(u64vec2);"
2519
"u64vec3 maxInvocationsExclusiveScanAMD(u64vec3);"
2520
"u64vec4 maxInvocationsExclusiveScanAMD(u64vec4);"
2521
2522
"float16_t maxInvocationsExclusiveScanAMD(float16_t);"
2523
"f16vec2 maxInvocationsExclusiveScanAMD(f16vec2);"
2524
"f16vec3 maxInvocationsExclusiveScanAMD(f16vec3);"
2525
"f16vec4 maxInvocationsExclusiveScanAMD(f16vec4);"
2526
2527
"int16_t maxInvocationsExclusiveScanAMD(int16_t);"
2528
"i16vec2 maxInvocationsExclusiveScanAMD(i16vec2);"
2529
"i16vec3 maxInvocationsExclusiveScanAMD(i16vec3);"
2530
"i16vec4 maxInvocationsExclusiveScanAMD(i16vec4);"
2531
2532
"uint16_t maxInvocationsExclusiveScanAMD(uint16_t);"
2533
"u16vec2 maxInvocationsExclusiveScanAMD(u16vec2);"
2534
"u16vec3 maxInvocationsExclusiveScanAMD(u16vec3);"
2535
"u16vec4 maxInvocationsExclusiveScanAMD(u16vec4);"
2536
2537
"float addInvocationsAMD(float);"
2538
"vec2 addInvocationsAMD(vec2);"
2539
"vec3 addInvocationsAMD(vec3);"
2540
"vec4 addInvocationsAMD(vec4);"
2541
2542
"int addInvocationsAMD(int);"
2543
"ivec2 addInvocationsAMD(ivec2);"
2544
"ivec3 addInvocationsAMD(ivec3);"
2545
"ivec4 addInvocationsAMD(ivec4);"
2546
2547
"uint addInvocationsAMD(uint);"
2548
"uvec2 addInvocationsAMD(uvec2);"
2549
"uvec3 addInvocationsAMD(uvec3);"
2550
"uvec4 addInvocationsAMD(uvec4);"
2551
2552
"double addInvocationsAMD(double);"
2553
"dvec2 addInvocationsAMD(dvec2);"
2554
"dvec3 addInvocationsAMD(dvec3);"
2555
"dvec4 addInvocationsAMD(dvec4);"
2556
2557
"int64_t addInvocationsAMD(int64_t);"
2558
"i64vec2 addInvocationsAMD(i64vec2);"
2559
"i64vec3 addInvocationsAMD(i64vec3);"
2560
"i64vec4 addInvocationsAMD(i64vec4);"
2561
2562
"uint64_t addInvocationsAMD(uint64_t);"
2563
"u64vec2 addInvocationsAMD(u64vec2);"
2564
"u64vec3 addInvocationsAMD(u64vec3);"
2565
"u64vec4 addInvocationsAMD(u64vec4);"
2566
2567
"float16_t addInvocationsAMD(float16_t);"
2568
"f16vec2 addInvocationsAMD(f16vec2);"
2569
"f16vec3 addInvocationsAMD(f16vec3);"
2570
"f16vec4 addInvocationsAMD(f16vec4);"
2571
2572
"int16_t addInvocationsAMD(int16_t);"
2573
"i16vec2 addInvocationsAMD(i16vec2);"
2574
"i16vec3 addInvocationsAMD(i16vec3);"
2575
"i16vec4 addInvocationsAMD(i16vec4);"
2576
2577
"uint16_t addInvocationsAMD(uint16_t);"
2578
"u16vec2 addInvocationsAMD(u16vec2);"
2579
"u16vec3 addInvocationsAMD(u16vec3);"
2580
"u16vec4 addInvocationsAMD(u16vec4);"
2581
2582
"float addInvocationsInclusiveScanAMD(float);"
2583
"vec2 addInvocationsInclusiveScanAMD(vec2);"
2584
"vec3 addInvocationsInclusiveScanAMD(vec3);"
2585
"vec4 addInvocationsInclusiveScanAMD(vec4);"
2586
2587
"int addInvocationsInclusiveScanAMD(int);"
2588
"ivec2 addInvocationsInclusiveScanAMD(ivec2);"
2589
"ivec3 addInvocationsInclusiveScanAMD(ivec3);"
2590
"ivec4 addInvocationsInclusiveScanAMD(ivec4);"
2591
2592
"uint addInvocationsInclusiveScanAMD(uint);"
2593
"uvec2 addInvocationsInclusiveScanAMD(uvec2);"
2594
"uvec3 addInvocationsInclusiveScanAMD(uvec3);"
2595
"uvec4 addInvocationsInclusiveScanAMD(uvec4);"
2596
2597
"double addInvocationsInclusiveScanAMD(double);"
2598
"dvec2 addInvocationsInclusiveScanAMD(dvec2);"
2599
"dvec3 addInvocationsInclusiveScanAMD(dvec3);"
2600
"dvec4 addInvocationsInclusiveScanAMD(dvec4);"
2601
2602
"int64_t addInvocationsInclusiveScanAMD(int64_t);"
2603
"i64vec2 addInvocationsInclusiveScanAMD(i64vec2);"
2604
"i64vec3 addInvocationsInclusiveScanAMD(i64vec3);"
2605
"i64vec4 addInvocationsInclusiveScanAMD(i64vec4);"
2606
2607
"uint64_t addInvocationsInclusiveScanAMD(uint64_t);"
2608
"u64vec2 addInvocationsInclusiveScanAMD(u64vec2);"
2609
"u64vec3 addInvocationsInclusiveScanAMD(u64vec3);"
2610
"u64vec4 addInvocationsInclusiveScanAMD(u64vec4);"
2611
2612
"float16_t addInvocationsInclusiveScanAMD(float16_t);"
2613
"f16vec2 addInvocationsInclusiveScanAMD(f16vec2);"
2614
"f16vec3 addInvocationsInclusiveScanAMD(f16vec3);"
2615
"f16vec4 addInvocationsInclusiveScanAMD(f16vec4);"
2616
2617
"int16_t addInvocationsInclusiveScanAMD(int16_t);"
2618
"i16vec2 addInvocationsInclusiveScanAMD(i16vec2);"
2619
"i16vec3 addInvocationsInclusiveScanAMD(i16vec3);"
2620
"i16vec4 addInvocationsInclusiveScanAMD(i16vec4);"
2621
2622
"uint16_t addInvocationsInclusiveScanAMD(uint16_t);"
2623
"u16vec2 addInvocationsInclusiveScanAMD(u16vec2);"
2624
"u16vec3 addInvocationsInclusiveScanAMD(u16vec3);"
2625
"u16vec4 addInvocationsInclusiveScanAMD(u16vec4);"
2626
2627
"float addInvocationsExclusiveScanAMD(float);"
2628
"vec2 addInvocationsExclusiveScanAMD(vec2);"
2629
"vec3 addInvocationsExclusiveScanAMD(vec3);"
2630
"vec4 addInvocationsExclusiveScanAMD(vec4);"
2631
2632
"int addInvocationsExclusiveScanAMD(int);"
2633
"ivec2 addInvocationsExclusiveScanAMD(ivec2);"
2634
"ivec3 addInvocationsExclusiveScanAMD(ivec3);"
2635
"ivec4 addInvocationsExclusiveScanAMD(ivec4);"
2636
2637
"uint addInvocationsExclusiveScanAMD(uint);"
2638
"uvec2 addInvocationsExclusiveScanAMD(uvec2);"
2639
"uvec3 addInvocationsExclusiveScanAMD(uvec3);"
2640
"uvec4 addInvocationsExclusiveScanAMD(uvec4);"
2641
2642
"double addInvocationsExclusiveScanAMD(double);"
2643
"dvec2 addInvocationsExclusiveScanAMD(dvec2);"
2644
"dvec3 addInvocationsExclusiveScanAMD(dvec3);"
2645
"dvec4 addInvocationsExclusiveScanAMD(dvec4);"
2646
2647
"int64_t addInvocationsExclusiveScanAMD(int64_t);"
2648
"i64vec2 addInvocationsExclusiveScanAMD(i64vec2);"
2649
"i64vec3 addInvocationsExclusiveScanAMD(i64vec3);"
2650
"i64vec4 addInvocationsExclusiveScanAMD(i64vec4);"
2651
2652
"uint64_t addInvocationsExclusiveScanAMD(uint64_t);"
2653
"u64vec2 addInvocationsExclusiveScanAMD(u64vec2);"
2654
"u64vec3 addInvocationsExclusiveScanAMD(u64vec3);"
2655
"u64vec4 addInvocationsExclusiveScanAMD(u64vec4);"
2656
2657
"float16_t addInvocationsExclusiveScanAMD(float16_t);"
2658
"f16vec2 addInvocationsExclusiveScanAMD(f16vec2);"
2659
"f16vec3 addInvocationsExclusiveScanAMD(f16vec3);"
2660
"f16vec4 addInvocationsExclusiveScanAMD(f16vec4);"
2661
2662
"int16_t addInvocationsExclusiveScanAMD(int16_t);"
2663
"i16vec2 addInvocationsExclusiveScanAMD(i16vec2);"
2664
"i16vec3 addInvocationsExclusiveScanAMD(i16vec3);"
2665
"i16vec4 addInvocationsExclusiveScanAMD(i16vec4);"
2666
2667
"uint16_t addInvocationsExclusiveScanAMD(uint16_t);"
2668
"u16vec2 addInvocationsExclusiveScanAMD(u16vec2);"
2669
"u16vec3 addInvocationsExclusiveScanAMD(u16vec3);"
2670
"u16vec4 addInvocationsExclusiveScanAMD(u16vec4);"
2671
2672
"float minInvocationsNonUniformAMD(float);"
2673
"vec2 minInvocationsNonUniformAMD(vec2);"
2674
"vec3 minInvocationsNonUniformAMD(vec3);"
2675
"vec4 minInvocationsNonUniformAMD(vec4);"
2676
2677
"int minInvocationsNonUniformAMD(int);"
2678
"ivec2 minInvocationsNonUniformAMD(ivec2);"
2679
"ivec3 minInvocationsNonUniformAMD(ivec3);"
2680
"ivec4 minInvocationsNonUniformAMD(ivec4);"
2681
2682
"uint minInvocationsNonUniformAMD(uint);"
2683
"uvec2 minInvocationsNonUniformAMD(uvec2);"
2684
"uvec3 minInvocationsNonUniformAMD(uvec3);"
2685
"uvec4 minInvocationsNonUniformAMD(uvec4);"
2686
2687
"double minInvocationsNonUniformAMD(double);"
2688
"dvec2 minInvocationsNonUniformAMD(dvec2);"
2689
"dvec3 minInvocationsNonUniformAMD(dvec3);"
2690
"dvec4 minInvocationsNonUniformAMD(dvec4);"
2691
2692
"int64_t minInvocationsNonUniformAMD(int64_t);"
2693
"i64vec2 minInvocationsNonUniformAMD(i64vec2);"
2694
"i64vec3 minInvocationsNonUniformAMD(i64vec3);"
2695
"i64vec4 minInvocationsNonUniformAMD(i64vec4);"
2696
2697
"uint64_t minInvocationsNonUniformAMD(uint64_t);"
2698
"u64vec2 minInvocationsNonUniformAMD(u64vec2);"
2699
"u64vec3 minInvocationsNonUniformAMD(u64vec3);"
2700
"u64vec4 minInvocationsNonUniformAMD(u64vec4);"
2701
2702
"float16_t minInvocationsNonUniformAMD(float16_t);"
2703
"f16vec2 minInvocationsNonUniformAMD(f16vec2);"
2704
"f16vec3 minInvocationsNonUniformAMD(f16vec3);"
2705
"f16vec4 minInvocationsNonUniformAMD(f16vec4);"
2706
2707
"int16_t minInvocationsNonUniformAMD(int16_t);"
2708
"i16vec2 minInvocationsNonUniformAMD(i16vec2);"
2709
"i16vec3 minInvocationsNonUniformAMD(i16vec3);"
2710
"i16vec4 minInvocationsNonUniformAMD(i16vec4);"
2711
2712
"uint16_t minInvocationsNonUniformAMD(uint16_t);"
2713
"u16vec2 minInvocationsNonUniformAMD(u16vec2);"
2714
"u16vec3 minInvocationsNonUniformAMD(u16vec3);"
2715
"u16vec4 minInvocationsNonUniformAMD(u16vec4);"
2716
2717
"float minInvocationsInclusiveScanNonUniformAMD(float);"
2718
"vec2 minInvocationsInclusiveScanNonUniformAMD(vec2);"
2719
"vec3 minInvocationsInclusiveScanNonUniformAMD(vec3);"
2720
"vec4 minInvocationsInclusiveScanNonUniformAMD(vec4);"
2721
2722
"int minInvocationsInclusiveScanNonUniformAMD(int);"
2723
"ivec2 minInvocationsInclusiveScanNonUniformAMD(ivec2);"
2724
"ivec3 minInvocationsInclusiveScanNonUniformAMD(ivec3);"
2725
"ivec4 minInvocationsInclusiveScanNonUniformAMD(ivec4);"
2726
2727
"uint minInvocationsInclusiveScanNonUniformAMD(uint);"
2728
"uvec2 minInvocationsInclusiveScanNonUniformAMD(uvec2);"
2729
"uvec3 minInvocationsInclusiveScanNonUniformAMD(uvec3);"
2730
"uvec4 minInvocationsInclusiveScanNonUniformAMD(uvec4);"
2731
2732
"double minInvocationsInclusiveScanNonUniformAMD(double);"
2733
"dvec2 minInvocationsInclusiveScanNonUniformAMD(dvec2);"
2734
"dvec3 minInvocationsInclusiveScanNonUniformAMD(dvec3);"
2735
"dvec4 minInvocationsInclusiveScanNonUniformAMD(dvec4);"
2736
2737
"int64_t minInvocationsInclusiveScanNonUniformAMD(int64_t);"
2738
"i64vec2 minInvocationsInclusiveScanNonUniformAMD(i64vec2);"
2739
"i64vec3 minInvocationsInclusiveScanNonUniformAMD(i64vec3);"
2740
"i64vec4 minInvocationsInclusiveScanNonUniformAMD(i64vec4);"
2741
2742
"uint64_t minInvocationsInclusiveScanNonUniformAMD(uint64_t);"
2743
"u64vec2 minInvocationsInclusiveScanNonUniformAMD(u64vec2);"
2744
"u64vec3 minInvocationsInclusiveScanNonUniformAMD(u64vec3);"
2745
"u64vec4 minInvocationsInclusiveScanNonUniformAMD(u64vec4);"
2746
2747
"float16_t minInvocationsInclusiveScanNonUniformAMD(float16_t);"
2748
"f16vec2 minInvocationsInclusiveScanNonUniformAMD(f16vec2);"
2749
"f16vec3 minInvocationsInclusiveScanNonUniformAMD(f16vec3);"
2750
"f16vec4 minInvocationsInclusiveScanNonUniformAMD(f16vec4);"
2751
2752
"int16_t minInvocationsInclusiveScanNonUniformAMD(int16_t);"
2753
"i16vec2 minInvocationsInclusiveScanNonUniformAMD(i16vec2);"
2754
"i16vec3 minInvocationsInclusiveScanNonUniformAMD(i16vec3);"
2755
"i16vec4 minInvocationsInclusiveScanNonUniformAMD(i16vec4);"
2756
2757
"uint16_t minInvocationsInclusiveScanNonUniformAMD(uint16_t);"
2758
"u16vec2 minInvocationsInclusiveScanNonUniformAMD(u16vec2);"
2759
"u16vec3 minInvocationsInclusiveScanNonUniformAMD(u16vec3);"
2760
"u16vec4 minInvocationsInclusiveScanNonUniformAMD(u16vec4);"
2761
2762
"float minInvocationsExclusiveScanNonUniformAMD(float);"
2763
"vec2 minInvocationsExclusiveScanNonUniformAMD(vec2);"
2764
"vec3 minInvocationsExclusiveScanNonUniformAMD(vec3);"
2765
"vec4 minInvocationsExclusiveScanNonUniformAMD(vec4);"
2766
2767
"int minInvocationsExclusiveScanNonUniformAMD(int);"
2768
"ivec2 minInvocationsExclusiveScanNonUniformAMD(ivec2);"
2769
"ivec3 minInvocationsExclusiveScanNonUniformAMD(ivec3);"
2770
"ivec4 minInvocationsExclusiveScanNonUniformAMD(ivec4);"
2771
2772
"uint minInvocationsExclusiveScanNonUniformAMD(uint);"
2773
"uvec2 minInvocationsExclusiveScanNonUniformAMD(uvec2);"
2774
"uvec3 minInvocationsExclusiveScanNonUniformAMD(uvec3);"
2775
"uvec4 minInvocationsExclusiveScanNonUniformAMD(uvec4);"
2776
2777
"double minInvocationsExclusiveScanNonUniformAMD(double);"
2778
"dvec2 minInvocationsExclusiveScanNonUniformAMD(dvec2);"
2779
"dvec3 minInvocationsExclusiveScanNonUniformAMD(dvec3);"
2780
"dvec4 minInvocationsExclusiveScanNonUniformAMD(dvec4);"
2781
2782
"int64_t minInvocationsExclusiveScanNonUniformAMD(int64_t);"
2783
"i64vec2 minInvocationsExclusiveScanNonUniformAMD(i64vec2);"
2784
"i64vec3 minInvocationsExclusiveScanNonUniformAMD(i64vec3);"
2785
"i64vec4 minInvocationsExclusiveScanNonUniformAMD(i64vec4);"
2786
2787
"uint64_t minInvocationsExclusiveScanNonUniformAMD(uint64_t);"
2788
"u64vec2 minInvocationsExclusiveScanNonUniformAMD(u64vec2);"
2789
"u64vec3 minInvocationsExclusiveScanNonUniformAMD(u64vec3);"
2790
"u64vec4 minInvocationsExclusiveScanNonUniformAMD(u64vec4);"
2791
2792
"float16_t minInvocationsExclusiveScanNonUniformAMD(float16_t);"
2793
"f16vec2 minInvocationsExclusiveScanNonUniformAMD(f16vec2);"
2794
"f16vec3 minInvocationsExclusiveScanNonUniformAMD(f16vec3);"
2795
"f16vec4 minInvocationsExclusiveScanNonUniformAMD(f16vec4);"
2796
2797
"int16_t minInvocationsExclusiveScanNonUniformAMD(int16_t);"
2798
"i16vec2 minInvocationsExclusiveScanNonUniformAMD(i16vec2);"
2799
"i16vec3 minInvocationsExclusiveScanNonUniformAMD(i16vec3);"
2800
"i16vec4 minInvocationsExclusiveScanNonUniformAMD(i16vec4);"
2801
2802
"uint16_t minInvocationsExclusiveScanNonUniformAMD(uint16_t);"
2803
"u16vec2 minInvocationsExclusiveScanNonUniformAMD(u16vec2);"
2804
"u16vec3 minInvocationsExclusiveScanNonUniformAMD(u16vec3);"
2805
"u16vec4 minInvocationsExclusiveScanNonUniformAMD(u16vec4);"
2806
2807
"float maxInvocationsNonUniformAMD(float);"
2808
"vec2 maxInvocationsNonUniformAMD(vec2);"
2809
"vec3 maxInvocationsNonUniformAMD(vec3);"
2810
"vec4 maxInvocationsNonUniformAMD(vec4);"
2811
2812
"int maxInvocationsNonUniformAMD(int);"
2813
"ivec2 maxInvocationsNonUniformAMD(ivec2);"
2814
"ivec3 maxInvocationsNonUniformAMD(ivec3);"
2815
"ivec4 maxInvocationsNonUniformAMD(ivec4);"
2816
2817
"uint maxInvocationsNonUniformAMD(uint);"
2818
"uvec2 maxInvocationsNonUniformAMD(uvec2);"
2819
"uvec3 maxInvocationsNonUniformAMD(uvec3);"
2820
"uvec4 maxInvocationsNonUniformAMD(uvec4);"
2821
2822
"double maxInvocationsNonUniformAMD(double);"
2823
"dvec2 maxInvocationsNonUniformAMD(dvec2);"
2824
"dvec3 maxInvocationsNonUniformAMD(dvec3);"
2825
"dvec4 maxInvocationsNonUniformAMD(dvec4);"
2826
2827
"int64_t maxInvocationsNonUniformAMD(int64_t);"
2828
"i64vec2 maxInvocationsNonUniformAMD(i64vec2);"
2829
"i64vec3 maxInvocationsNonUniformAMD(i64vec3);"
2830
"i64vec4 maxInvocationsNonUniformAMD(i64vec4);"
2831
2832
"uint64_t maxInvocationsNonUniformAMD(uint64_t);"
2833
"u64vec2 maxInvocationsNonUniformAMD(u64vec2);"
2834
"u64vec3 maxInvocationsNonUniformAMD(u64vec3);"
2835
"u64vec4 maxInvocationsNonUniformAMD(u64vec4);"
2836
2837
"float16_t maxInvocationsNonUniformAMD(float16_t);"
2838
"f16vec2 maxInvocationsNonUniformAMD(f16vec2);"
2839
"f16vec3 maxInvocationsNonUniformAMD(f16vec3);"
2840
"f16vec4 maxInvocationsNonUniformAMD(f16vec4);"
2841
2842
"int16_t maxInvocationsNonUniformAMD(int16_t);"
2843
"i16vec2 maxInvocationsNonUniformAMD(i16vec2);"
2844
"i16vec3 maxInvocationsNonUniformAMD(i16vec3);"
2845
"i16vec4 maxInvocationsNonUniformAMD(i16vec4);"
2846
2847
"uint16_t maxInvocationsNonUniformAMD(uint16_t);"
2848
"u16vec2 maxInvocationsNonUniformAMD(u16vec2);"
2849
"u16vec3 maxInvocationsNonUniformAMD(u16vec3);"
2850
"u16vec4 maxInvocationsNonUniformAMD(u16vec4);"
2851
2852
"float maxInvocationsInclusiveScanNonUniformAMD(float);"
2853
"vec2 maxInvocationsInclusiveScanNonUniformAMD(vec2);"
2854
"vec3 maxInvocationsInclusiveScanNonUniformAMD(vec3);"
2855
"vec4 maxInvocationsInclusiveScanNonUniformAMD(vec4);"
2856
2857
"int maxInvocationsInclusiveScanNonUniformAMD(int);"
2858
"ivec2 maxInvocationsInclusiveScanNonUniformAMD(ivec2);"
2859
"ivec3 maxInvocationsInclusiveScanNonUniformAMD(ivec3);"
2860
"ivec4 maxInvocationsInclusiveScanNonUniformAMD(ivec4);"
2861
2862
"uint maxInvocationsInclusiveScanNonUniformAMD(uint);"
2863
"uvec2 maxInvocationsInclusiveScanNonUniformAMD(uvec2);"
2864
"uvec3 maxInvocationsInclusiveScanNonUniformAMD(uvec3);"
2865
"uvec4 maxInvocationsInclusiveScanNonUniformAMD(uvec4);"
2866
2867
"double maxInvocationsInclusiveScanNonUniformAMD(double);"
2868
"dvec2 maxInvocationsInclusiveScanNonUniformAMD(dvec2);"
2869
"dvec3 maxInvocationsInclusiveScanNonUniformAMD(dvec3);"
2870
"dvec4 maxInvocationsInclusiveScanNonUniformAMD(dvec4);"
2871
2872
"int64_t maxInvocationsInclusiveScanNonUniformAMD(int64_t);"
2873
"i64vec2 maxInvocationsInclusiveScanNonUniformAMD(i64vec2);"
2874
"i64vec3 maxInvocationsInclusiveScanNonUniformAMD(i64vec3);"
2875
"i64vec4 maxInvocationsInclusiveScanNonUniformAMD(i64vec4);"
2876
2877
"uint64_t maxInvocationsInclusiveScanNonUniformAMD(uint64_t);"
2878
"u64vec2 maxInvocationsInclusiveScanNonUniformAMD(u64vec2);"
2879
"u64vec3 maxInvocationsInclusiveScanNonUniformAMD(u64vec3);"
2880
"u64vec4 maxInvocationsInclusiveScanNonUniformAMD(u64vec4);"
2881
2882
"float16_t maxInvocationsInclusiveScanNonUniformAMD(float16_t);"
2883
"f16vec2 maxInvocationsInclusiveScanNonUniformAMD(f16vec2);"
2884
"f16vec3 maxInvocationsInclusiveScanNonUniformAMD(f16vec3);"
2885
"f16vec4 maxInvocationsInclusiveScanNonUniformAMD(f16vec4);"
2886
2887
"int16_t maxInvocationsInclusiveScanNonUniformAMD(int16_t);"
2888
"i16vec2 maxInvocationsInclusiveScanNonUniformAMD(i16vec2);"
2889
"i16vec3 maxInvocationsInclusiveScanNonUniformAMD(i16vec3);"
2890
"i16vec4 maxInvocationsInclusiveScanNonUniformAMD(i16vec4);"
2891
2892
"uint16_t maxInvocationsInclusiveScanNonUniformAMD(uint16_t);"
2893
"u16vec2 maxInvocationsInclusiveScanNonUniformAMD(u16vec2);"
2894
"u16vec3 maxInvocationsInclusiveScanNonUniformAMD(u16vec3);"
2895
"u16vec4 maxInvocationsInclusiveScanNonUniformAMD(u16vec4);"
2896
2897
"float maxInvocationsExclusiveScanNonUniformAMD(float);"
2898
"vec2 maxInvocationsExclusiveScanNonUniformAMD(vec2);"
2899
"vec3 maxInvocationsExclusiveScanNonUniformAMD(vec3);"
2900
"vec4 maxInvocationsExclusiveScanNonUniformAMD(vec4);"
2901
2902
"int maxInvocationsExclusiveScanNonUniformAMD(int);"
2903
"ivec2 maxInvocationsExclusiveScanNonUniformAMD(ivec2);"
2904
"ivec3 maxInvocationsExclusiveScanNonUniformAMD(ivec3);"
2905
"ivec4 maxInvocationsExclusiveScanNonUniformAMD(ivec4);"
2906
2907
"uint maxInvocationsExclusiveScanNonUniformAMD(uint);"
2908
"uvec2 maxInvocationsExclusiveScanNonUniformAMD(uvec2);"
2909
"uvec3 maxInvocationsExclusiveScanNonUniformAMD(uvec3);"
2910
"uvec4 maxInvocationsExclusiveScanNonUniformAMD(uvec4);"
2911
2912
"double maxInvocationsExclusiveScanNonUniformAMD(double);"
2913
"dvec2 maxInvocationsExclusiveScanNonUniformAMD(dvec2);"
2914
"dvec3 maxInvocationsExclusiveScanNonUniformAMD(dvec3);"
2915
"dvec4 maxInvocationsExclusiveScanNonUniformAMD(dvec4);"
2916
2917
"int64_t maxInvocationsExclusiveScanNonUniformAMD(int64_t);"
2918
"i64vec2 maxInvocationsExclusiveScanNonUniformAMD(i64vec2);"
2919
"i64vec3 maxInvocationsExclusiveScanNonUniformAMD(i64vec3);"
2920
"i64vec4 maxInvocationsExclusiveScanNonUniformAMD(i64vec4);"
2921
2922
"uint64_t maxInvocationsExclusiveScanNonUniformAMD(uint64_t);"
2923
"u64vec2 maxInvocationsExclusiveScanNonUniformAMD(u64vec2);"
2924
"u64vec3 maxInvocationsExclusiveScanNonUniformAMD(u64vec3);"
2925
"u64vec4 maxInvocationsExclusiveScanNonUniformAMD(u64vec4);"
2926
2927
"float16_t maxInvocationsExclusiveScanNonUniformAMD(float16_t);"
2928
"f16vec2 maxInvocationsExclusiveScanNonUniformAMD(f16vec2);"
2929
"f16vec3 maxInvocationsExclusiveScanNonUniformAMD(f16vec3);"
2930
"f16vec4 maxInvocationsExclusiveScanNonUniformAMD(f16vec4);"
2931
2932
"int16_t maxInvocationsExclusiveScanNonUniformAMD(int16_t);"
2933
"i16vec2 maxInvocationsExclusiveScanNonUniformAMD(i16vec2);"
2934
"i16vec3 maxInvocationsExclusiveScanNonUniformAMD(i16vec3);"
2935
"i16vec4 maxInvocationsExclusiveScanNonUniformAMD(i16vec4);"
2936
2937
"uint16_t maxInvocationsExclusiveScanNonUniformAMD(uint16_t);"
2938
"u16vec2 maxInvocationsExclusiveScanNonUniformAMD(u16vec2);"
2939
"u16vec3 maxInvocationsExclusiveScanNonUniformAMD(u16vec3);"
2940
"u16vec4 maxInvocationsExclusiveScanNonUniformAMD(u16vec4);"
2941
2942
"float addInvocationsNonUniformAMD(float);"
2943
"vec2 addInvocationsNonUniformAMD(vec2);"
2944
"vec3 addInvocationsNonUniformAMD(vec3);"
2945
"vec4 addInvocationsNonUniformAMD(vec4);"
2946
2947
"int addInvocationsNonUniformAMD(int);"
2948
"ivec2 addInvocationsNonUniformAMD(ivec2);"
2949
"ivec3 addInvocationsNonUniformAMD(ivec3);"
2950
"ivec4 addInvocationsNonUniformAMD(ivec4);"
2951
2952
"uint addInvocationsNonUniformAMD(uint);"
2953
"uvec2 addInvocationsNonUniformAMD(uvec2);"
2954
"uvec3 addInvocationsNonUniformAMD(uvec3);"
2955
"uvec4 addInvocationsNonUniformAMD(uvec4);"
2956
2957
"double addInvocationsNonUniformAMD(double);"
2958
"dvec2 addInvocationsNonUniformAMD(dvec2);"
2959
"dvec3 addInvocationsNonUniformAMD(dvec3);"
2960
"dvec4 addInvocationsNonUniformAMD(dvec4);"
2961
2962
"int64_t addInvocationsNonUniformAMD(int64_t);"
2963
"i64vec2 addInvocationsNonUniformAMD(i64vec2);"
2964
"i64vec3 addInvocationsNonUniformAMD(i64vec3);"
2965
"i64vec4 addInvocationsNonUniformAMD(i64vec4);"
2966
2967
"uint64_t addInvocationsNonUniformAMD(uint64_t);"
2968
"u64vec2 addInvocationsNonUniformAMD(u64vec2);"
2969
"u64vec3 addInvocationsNonUniformAMD(u64vec3);"
2970
"u64vec4 addInvocationsNonUniformAMD(u64vec4);"
2971
2972
"float16_t addInvocationsNonUniformAMD(float16_t);"
2973
"f16vec2 addInvocationsNonUniformAMD(f16vec2);"
2974
"f16vec3 addInvocationsNonUniformAMD(f16vec3);"
2975
"f16vec4 addInvocationsNonUniformAMD(f16vec4);"
2976
2977
"int16_t addInvocationsNonUniformAMD(int16_t);"
2978
"i16vec2 addInvocationsNonUniformAMD(i16vec2);"
2979
"i16vec3 addInvocationsNonUniformAMD(i16vec3);"
2980
"i16vec4 addInvocationsNonUniformAMD(i16vec4);"
2981
2982
"uint16_t addInvocationsNonUniformAMD(uint16_t);"
2983
"u16vec2 addInvocationsNonUniformAMD(u16vec2);"
2984
"u16vec3 addInvocationsNonUniformAMD(u16vec3);"
2985
"u16vec4 addInvocationsNonUniformAMD(u16vec4);"
2986
2987
"float addInvocationsInclusiveScanNonUniformAMD(float);"
2988
"vec2 addInvocationsInclusiveScanNonUniformAMD(vec2);"
2989
"vec3 addInvocationsInclusiveScanNonUniformAMD(vec3);"
2990
"vec4 addInvocationsInclusiveScanNonUniformAMD(vec4);"
2991
2992
"int addInvocationsInclusiveScanNonUniformAMD(int);"
2993
"ivec2 addInvocationsInclusiveScanNonUniformAMD(ivec2);"
2994
"ivec3 addInvocationsInclusiveScanNonUniformAMD(ivec3);"
2995
"ivec4 addInvocationsInclusiveScanNonUniformAMD(ivec4);"
2996
2997
"uint addInvocationsInclusiveScanNonUniformAMD(uint);"
2998
"uvec2 addInvocationsInclusiveScanNonUniformAMD(uvec2);"
2999
"uvec3 addInvocationsInclusiveScanNonUniformAMD(uvec3);"
3000
"uvec4 addInvocationsInclusiveScanNonUniformAMD(uvec4);"
3001
3002
"double addInvocationsInclusiveScanNonUniformAMD(double);"
3003
"dvec2 addInvocationsInclusiveScanNonUniformAMD(dvec2);"
3004
"dvec3 addInvocationsInclusiveScanNonUniformAMD(dvec3);"
3005
"dvec4 addInvocationsInclusiveScanNonUniformAMD(dvec4);"
3006
3007
"int64_t addInvocationsInclusiveScanNonUniformAMD(int64_t);"
3008
"i64vec2 addInvocationsInclusiveScanNonUniformAMD(i64vec2);"
3009
"i64vec3 addInvocationsInclusiveScanNonUniformAMD(i64vec3);"
3010
"i64vec4 addInvocationsInclusiveScanNonUniformAMD(i64vec4);"
3011
3012
"uint64_t addInvocationsInclusiveScanNonUniformAMD(uint64_t);"
3013
"u64vec2 addInvocationsInclusiveScanNonUniformAMD(u64vec2);"
3014
"u64vec3 addInvocationsInclusiveScanNonUniformAMD(u64vec3);"
3015
"u64vec4 addInvocationsInclusiveScanNonUniformAMD(u64vec4);"
3016
3017
"float16_t addInvocationsInclusiveScanNonUniformAMD(float16_t);"
3018
"f16vec2 addInvocationsInclusiveScanNonUniformAMD(f16vec2);"
3019
"f16vec3 addInvocationsInclusiveScanNonUniformAMD(f16vec3);"
3020
"f16vec4 addInvocationsInclusiveScanNonUniformAMD(f16vec4);"
3021
3022
"int16_t addInvocationsInclusiveScanNonUniformAMD(int16_t);"
3023
"i16vec2 addInvocationsInclusiveScanNonUniformAMD(i16vec2);"
3024
"i16vec3 addInvocationsInclusiveScanNonUniformAMD(i16vec3);"
3025
"i16vec4 addInvocationsInclusiveScanNonUniformAMD(i16vec4);"
3026
3027
"uint16_t addInvocationsInclusiveScanNonUniformAMD(uint16_t);"
3028
"u16vec2 addInvocationsInclusiveScanNonUniformAMD(u16vec2);"
3029
"u16vec3 addInvocationsInclusiveScanNonUniformAMD(u16vec3);"
3030
"u16vec4 addInvocationsInclusiveScanNonUniformAMD(u16vec4);"
3031
3032
"float addInvocationsExclusiveScanNonUniformAMD(float);"
3033
"vec2 addInvocationsExclusiveScanNonUniformAMD(vec2);"
3034
"vec3 addInvocationsExclusiveScanNonUniformAMD(vec3);"
3035
"vec4 addInvocationsExclusiveScanNonUniformAMD(vec4);"
3036
3037
"int addInvocationsExclusiveScanNonUniformAMD(int);"
3038
"ivec2 addInvocationsExclusiveScanNonUniformAMD(ivec2);"
3039
"ivec3 addInvocationsExclusiveScanNonUniformAMD(ivec3);"
3040
"ivec4 addInvocationsExclusiveScanNonUniformAMD(ivec4);"
3041
3042
"uint addInvocationsExclusiveScanNonUniformAMD(uint);"
3043
"uvec2 addInvocationsExclusiveScanNonUniformAMD(uvec2);"
3044
"uvec3 addInvocationsExclusiveScanNonUniformAMD(uvec3);"
3045
"uvec4 addInvocationsExclusiveScanNonUniformAMD(uvec4);"
3046
3047
"double addInvocationsExclusiveScanNonUniformAMD(double);"
3048
"dvec2 addInvocationsExclusiveScanNonUniformAMD(dvec2);"
3049
"dvec3 addInvocationsExclusiveScanNonUniformAMD(dvec3);"
3050
"dvec4 addInvocationsExclusiveScanNonUniformAMD(dvec4);"
3051
3052
"int64_t addInvocationsExclusiveScanNonUniformAMD(int64_t);"
3053
"i64vec2 addInvocationsExclusiveScanNonUniformAMD(i64vec2);"
3054
"i64vec3 addInvocationsExclusiveScanNonUniformAMD(i64vec3);"
3055
"i64vec4 addInvocationsExclusiveScanNonUniformAMD(i64vec4);"
3056
3057
"uint64_t addInvocationsExclusiveScanNonUniformAMD(uint64_t);"
3058
"u64vec2 addInvocationsExclusiveScanNonUniformAMD(u64vec2);"
3059
"u64vec3 addInvocationsExclusiveScanNonUniformAMD(u64vec3);"
3060
"u64vec4 addInvocationsExclusiveScanNonUniformAMD(u64vec4);"
3061
3062
"float16_t addInvocationsExclusiveScanNonUniformAMD(float16_t);"
3063
"f16vec2 addInvocationsExclusiveScanNonUniformAMD(f16vec2);"
3064
"f16vec3 addInvocationsExclusiveScanNonUniformAMD(f16vec3);"
3065
"f16vec4 addInvocationsExclusiveScanNonUniformAMD(f16vec4);"
3066
3067
"int16_t addInvocationsExclusiveScanNonUniformAMD(int16_t);"
3068
"i16vec2 addInvocationsExclusiveScanNonUniformAMD(i16vec2);"
3069
"i16vec3 addInvocationsExclusiveScanNonUniformAMD(i16vec3);"
3070
"i16vec4 addInvocationsExclusiveScanNonUniformAMD(i16vec4);"
3071
3072
"uint16_t addInvocationsExclusiveScanNonUniformAMD(uint16_t);"
3073
"u16vec2 addInvocationsExclusiveScanNonUniformAMD(u16vec2);"
3074
"u16vec3 addInvocationsExclusiveScanNonUniformAMD(u16vec3);"
3075
"u16vec4 addInvocationsExclusiveScanNonUniformAMD(u16vec4);"
3076
3077
"float swizzleInvocationsAMD(float, uvec4);"
3078
"vec2 swizzleInvocationsAMD(vec2, uvec4);"
3079
"vec3 swizzleInvocationsAMD(vec3, uvec4);"
3080
"vec4 swizzleInvocationsAMD(vec4, uvec4);"
3081
3082
"int swizzleInvocationsAMD(int, uvec4);"
3083
"ivec2 swizzleInvocationsAMD(ivec2, uvec4);"
3084
"ivec3 swizzleInvocationsAMD(ivec3, uvec4);"
3085
"ivec4 swizzleInvocationsAMD(ivec4, uvec4);"
3086
3087
"uint swizzleInvocationsAMD(uint, uvec4);"
3088
"uvec2 swizzleInvocationsAMD(uvec2, uvec4);"
3089
"uvec3 swizzleInvocationsAMD(uvec3, uvec4);"
3090
"uvec4 swizzleInvocationsAMD(uvec4, uvec4);"
3091
3092
"float swizzleInvocationsMaskedAMD(float, uvec3);"
3093
"vec2 swizzleInvocationsMaskedAMD(vec2, uvec3);"
3094
"vec3 swizzleInvocationsMaskedAMD(vec3, uvec3);"
3095
"vec4 swizzleInvocationsMaskedAMD(vec4, uvec3);"
3096
3097
"int swizzleInvocationsMaskedAMD(int, uvec3);"
3098
"ivec2 swizzleInvocationsMaskedAMD(ivec2, uvec3);"
3099
"ivec3 swizzleInvocationsMaskedAMD(ivec3, uvec3);"
3100
"ivec4 swizzleInvocationsMaskedAMD(ivec4, uvec3);"
3101
3102
"uint swizzleInvocationsMaskedAMD(uint, uvec3);"
3103
"uvec2 swizzleInvocationsMaskedAMD(uvec2, uvec3);"
3104
"uvec3 swizzleInvocationsMaskedAMD(uvec3, uvec3);"
3105
"uvec4 swizzleInvocationsMaskedAMD(uvec4, uvec3);"
3106
3107
"float writeInvocationAMD(float, float, uint);"
3108
"vec2 writeInvocationAMD(vec2, vec2, uint);"
3109
"vec3 writeInvocationAMD(vec3, vec3, uint);"
3110
"vec4 writeInvocationAMD(vec4, vec4, uint);"
3111
3112
"int writeInvocationAMD(int, int, uint);"
3113
"ivec2 writeInvocationAMD(ivec2, ivec2, uint);"
3114
"ivec3 writeInvocationAMD(ivec3, ivec3, uint);"
3115
"ivec4 writeInvocationAMD(ivec4, ivec4, uint);"
3116
3117
"uint writeInvocationAMD(uint, uint, uint);"
3118
"uvec2 writeInvocationAMD(uvec2, uvec2, uint);"
3119
"uvec3 writeInvocationAMD(uvec3, uvec3, uint);"
3120
"uvec4 writeInvocationAMD(uvec4, uvec4, uint);"
3121
3122
"uint mbcntAMD(uint64_t);"
3123
3124
"\n");
3125
}
3126
3127
// GL_AMD_gcn_shader
3128
if (profile != EEsProfile && version >= 440) {
3129
commonBuiltins.append(
3130
"float cubeFaceIndexAMD(vec3);"
3131
"vec2 cubeFaceCoordAMD(vec3);"
3132
"uint64_t timeAMD();"
3133
3134
"in int gl_SIMDGroupSizeAMD;"
3135
"\n");
3136
}
3137
3138
// GL_AMD_shader_fragment_mask
3139
if (profile != EEsProfile && version >= 450) {
3140
commonBuiltins.append(
3141
"uint fragmentMaskFetchAMD(sampler2DMS, ivec2);"
3142
"uint fragmentMaskFetchAMD(isampler2DMS, ivec2);"
3143
"uint fragmentMaskFetchAMD(usampler2DMS, ivec2);"
3144
3145
"uint fragmentMaskFetchAMD(sampler2DMSArray, ivec3);"
3146
"uint fragmentMaskFetchAMD(isampler2DMSArray, ivec3);"
3147
"uint fragmentMaskFetchAMD(usampler2DMSArray, ivec3);"
3148
3149
"vec4 fragmentFetchAMD(sampler2DMS, ivec2, uint);"
3150
"ivec4 fragmentFetchAMD(isampler2DMS, ivec2, uint);"
3151
"uvec4 fragmentFetchAMD(usampler2DMS, ivec2, uint);"
3152
3153
"vec4 fragmentFetchAMD(sampler2DMSArray, ivec3, uint);"
3154
"ivec4 fragmentFetchAMD(isampler2DMSArray, ivec3, uint);"
3155
"uvec4 fragmentFetchAMD(usampler2DMSArray, ivec3, uint);"
3156
3157
"\n");
3158
}
3159
3160
if ((profile != EEsProfile && version >= 130) ||
3161
(profile == EEsProfile && version >= 300)) {
3162
commonBuiltins.append(
3163
"uint countLeadingZeros(uint);"
3164
"uvec2 countLeadingZeros(uvec2);"
3165
"uvec3 countLeadingZeros(uvec3);"
3166
"uvec4 countLeadingZeros(uvec4);"
3167
3168
"uint countTrailingZeros(uint);"
3169
"uvec2 countTrailingZeros(uvec2);"
3170
"uvec3 countTrailingZeros(uvec3);"
3171
"uvec4 countTrailingZeros(uvec4);"
3172
3173
"uint absoluteDifference(int, int);"
3174
"uvec2 absoluteDifference(ivec2, ivec2);"
3175
"uvec3 absoluteDifference(ivec3, ivec3);"
3176
"uvec4 absoluteDifference(ivec4, ivec4);"
3177
3178
"uint16_t absoluteDifference(int16_t, int16_t);"
3179
"u16vec2 absoluteDifference(i16vec2, i16vec2);"
3180
"u16vec3 absoluteDifference(i16vec3, i16vec3);"
3181
"u16vec4 absoluteDifference(i16vec4, i16vec4);"
3182
3183
"uint64_t absoluteDifference(int64_t, int64_t);"
3184
"u64vec2 absoluteDifference(i64vec2, i64vec2);"
3185
"u64vec3 absoluteDifference(i64vec3, i64vec3);"
3186
"u64vec4 absoluteDifference(i64vec4, i64vec4);"
3187
3188
"uint absoluteDifference(uint, uint);"
3189
"uvec2 absoluteDifference(uvec2, uvec2);"
3190
"uvec3 absoluteDifference(uvec3, uvec3);"
3191
"uvec4 absoluteDifference(uvec4, uvec4);"
3192
3193
"uint16_t absoluteDifference(uint16_t, uint16_t);"
3194
"u16vec2 absoluteDifference(u16vec2, u16vec2);"
3195
"u16vec3 absoluteDifference(u16vec3, u16vec3);"
3196
"u16vec4 absoluteDifference(u16vec4, u16vec4);"
3197
3198
"uint64_t absoluteDifference(uint64_t, uint64_t);"
3199
"u64vec2 absoluteDifference(u64vec2, u64vec2);"
3200
"u64vec3 absoluteDifference(u64vec3, u64vec3);"
3201
"u64vec4 absoluteDifference(u64vec4, u64vec4);"
3202
3203
"int addSaturate(int, int);"
3204
"ivec2 addSaturate(ivec2, ivec2);"
3205
"ivec3 addSaturate(ivec3, ivec3);"
3206
"ivec4 addSaturate(ivec4, ivec4);"
3207
3208
"int16_t addSaturate(int16_t, int16_t);"
3209
"i16vec2 addSaturate(i16vec2, i16vec2);"
3210
"i16vec3 addSaturate(i16vec3, i16vec3);"
3211
"i16vec4 addSaturate(i16vec4, i16vec4);"
3212
3213
"int64_t addSaturate(int64_t, int64_t);"
3214
"i64vec2 addSaturate(i64vec2, i64vec2);"
3215
"i64vec3 addSaturate(i64vec3, i64vec3);"
3216
"i64vec4 addSaturate(i64vec4, i64vec4);"
3217
3218
"uint addSaturate(uint, uint);"
3219
"uvec2 addSaturate(uvec2, uvec2);"
3220
"uvec3 addSaturate(uvec3, uvec3);"
3221
"uvec4 addSaturate(uvec4, uvec4);"
3222
3223
"uint16_t addSaturate(uint16_t, uint16_t);"
3224
"u16vec2 addSaturate(u16vec2, u16vec2);"
3225
"u16vec3 addSaturate(u16vec3, u16vec3);"
3226
"u16vec4 addSaturate(u16vec4, u16vec4);"
3227
3228
"uint64_t addSaturate(uint64_t, uint64_t);"
3229
"u64vec2 addSaturate(u64vec2, u64vec2);"
3230
"u64vec3 addSaturate(u64vec3, u64vec3);"
3231
"u64vec4 addSaturate(u64vec4, u64vec4);"
3232
3233
"int subtractSaturate(int, int);"
3234
"ivec2 subtractSaturate(ivec2, ivec2);"
3235
"ivec3 subtractSaturate(ivec3, ivec3);"
3236
"ivec4 subtractSaturate(ivec4, ivec4);"
3237
3238
"int16_t subtractSaturate(int16_t, int16_t);"
3239
"i16vec2 subtractSaturate(i16vec2, i16vec2);"
3240
"i16vec3 subtractSaturate(i16vec3, i16vec3);"
3241
"i16vec4 subtractSaturate(i16vec4, i16vec4);"
3242
3243
"int64_t subtractSaturate(int64_t, int64_t);"
3244
"i64vec2 subtractSaturate(i64vec2, i64vec2);"
3245
"i64vec3 subtractSaturate(i64vec3, i64vec3);"
3246
"i64vec4 subtractSaturate(i64vec4, i64vec4);"
3247
3248
"uint subtractSaturate(uint, uint);"
3249
"uvec2 subtractSaturate(uvec2, uvec2);"
3250
"uvec3 subtractSaturate(uvec3, uvec3);"
3251
"uvec4 subtractSaturate(uvec4, uvec4);"
3252
3253
"uint16_t subtractSaturate(uint16_t, uint16_t);"
3254
"u16vec2 subtractSaturate(u16vec2, u16vec2);"
3255
"u16vec3 subtractSaturate(u16vec3, u16vec3);"
3256
"u16vec4 subtractSaturate(u16vec4, u16vec4);"
3257
3258
"uint64_t subtractSaturate(uint64_t, uint64_t);"
3259
"u64vec2 subtractSaturate(u64vec2, u64vec2);"
3260
"u64vec3 subtractSaturate(u64vec3, u64vec3);"
3261
"u64vec4 subtractSaturate(u64vec4, u64vec4);"
3262
3263
"int average(int, int);"
3264
"ivec2 average(ivec2, ivec2);"
3265
"ivec3 average(ivec3, ivec3);"
3266
"ivec4 average(ivec4, ivec4);"
3267
3268
"int16_t average(int16_t, int16_t);"
3269
"i16vec2 average(i16vec2, i16vec2);"
3270
"i16vec3 average(i16vec3, i16vec3);"
3271
"i16vec4 average(i16vec4, i16vec4);"
3272
3273
"int64_t average(int64_t, int64_t);"
3274
"i64vec2 average(i64vec2, i64vec2);"
3275
"i64vec3 average(i64vec3, i64vec3);"
3276
"i64vec4 average(i64vec4, i64vec4);"
3277
3278
"uint average(uint, uint);"
3279
"uvec2 average(uvec2, uvec2);"
3280
"uvec3 average(uvec3, uvec3);"
3281
"uvec4 average(uvec4, uvec4);"
3282
3283
"uint16_t average(uint16_t, uint16_t);"
3284
"u16vec2 average(u16vec2, u16vec2);"
3285
"u16vec3 average(u16vec3, u16vec3);"
3286
"u16vec4 average(u16vec4, u16vec4);"
3287
3288
"uint64_t average(uint64_t, uint64_t);"
3289
"u64vec2 average(u64vec2, u64vec2);"
3290
"u64vec3 average(u64vec3, u64vec3);"
3291
"u64vec4 average(u64vec4, u64vec4);"
3292
3293
"int averageRounded(int, int);"
3294
"ivec2 averageRounded(ivec2, ivec2);"
3295
"ivec3 averageRounded(ivec3, ivec3);"
3296
"ivec4 averageRounded(ivec4, ivec4);"
3297
3298
"int16_t averageRounded(int16_t, int16_t);"
3299
"i16vec2 averageRounded(i16vec2, i16vec2);"
3300
"i16vec3 averageRounded(i16vec3, i16vec3);"
3301
"i16vec4 averageRounded(i16vec4, i16vec4);"
3302
3303
"int64_t averageRounded(int64_t, int64_t);"
3304
"i64vec2 averageRounded(i64vec2, i64vec2);"
3305
"i64vec3 averageRounded(i64vec3, i64vec3);"
3306
"i64vec4 averageRounded(i64vec4, i64vec4);"
3307
3308
"uint averageRounded(uint, uint);"
3309
"uvec2 averageRounded(uvec2, uvec2);"
3310
"uvec3 averageRounded(uvec3, uvec3);"
3311
"uvec4 averageRounded(uvec4, uvec4);"
3312
3313
"uint16_t averageRounded(uint16_t, uint16_t);"
3314
"u16vec2 averageRounded(u16vec2, u16vec2);"
3315
"u16vec3 averageRounded(u16vec3, u16vec3);"
3316
"u16vec4 averageRounded(u16vec4, u16vec4);"
3317
3318
"uint64_t averageRounded(uint64_t, uint64_t);"
3319
"u64vec2 averageRounded(u64vec2, u64vec2);"
3320
"u64vec3 averageRounded(u64vec3, u64vec3);"
3321
"u64vec4 averageRounded(u64vec4, u64vec4);"
3322
3323
"int multiply32x16(int, int);"
3324
"ivec2 multiply32x16(ivec2, ivec2);"
3325
"ivec3 multiply32x16(ivec3, ivec3);"
3326
"ivec4 multiply32x16(ivec4, ivec4);"
3327
3328
"uint multiply32x16(uint, uint);"
3329
"uvec2 multiply32x16(uvec2, uvec2);"
3330
"uvec3 multiply32x16(uvec3, uvec3);"
3331
"uvec4 multiply32x16(uvec4, uvec4);"
3332
"\n");
3333
}
3334
3335
if ((profile != EEsProfile && version >= 450) ||
3336
(profile == EEsProfile && version >= 320)) {
3337
commonBuiltins.append(
3338
"struct gl_TextureFootprint2DNV {"
3339
"uvec2 anchor;"
3340
"uvec2 offset;"
3341
"uvec2 mask;"
3342
"uint lod;"
3343
"uint granularity;"
3344
"};"
3345
3346
"struct gl_TextureFootprint3DNV {"
3347
"uvec3 anchor;"
3348
"uvec3 offset;"
3349
"uvec2 mask;"
3350
"uint lod;"
3351
"uint granularity;"
3352
"};"
3353
"bool textureFootprintNV(sampler2D, vec2, int, bool, out gl_TextureFootprint2DNV);"
3354
"bool textureFootprintNV(sampler3D, vec3, int, bool, out gl_TextureFootprint3DNV);"
3355
"bool textureFootprintNV(sampler2D, vec2, int, bool, out gl_TextureFootprint2DNV, float);"
3356
"bool textureFootprintNV(sampler3D, vec3, int, bool, out gl_TextureFootprint3DNV, float);"
3357
"bool textureFootprintClampNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV);"
3358
"bool textureFootprintClampNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV);"
3359
"bool textureFootprintClampNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV, float);"
3360
"bool textureFootprintClampNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV, float);"
3361
"bool textureFootprintLodNV(sampler2D, vec2, float, int, bool, out gl_TextureFootprint2DNV);"
3362
"bool textureFootprintLodNV(sampler3D, vec3, float, int, bool, out gl_TextureFootprint3DNV);"
3363
"bool textureFootprintGradNV(sampler2D, vec2, vec2, vec2, int, bool, out gl_TextureFootprint2DNV);"
3364
"bool textureFootprintGradClampNV(sampler2D, vec2, vec2, vec2, float, int, bool, out gl_TextureFootprint2DNV);"
3365
"\n");
3366
}
3367
3368
if ((profile == EEsProfile && version >= 300 && version < 310) ||
3369
(profile != EEsProfile && version >= 150 && version < 450)) { // GL_EXT_shader_integer_mix
3370
commonBuiltins.append("int mix(int, int, bool);"
3371
"ivec2 mix(ivec2, ivec2, bvec2);"
3372
"ivec3 mix(ivec3, ivec3, bvec3);"
3373
"ivec4 mix(ivec4, ivec4, bvec4);"
3374
"uint mix(uint, uint, bool );"
3375
"uvec2 mix(uvec2, uvec2, bvec2);"
3376
"uvec3 mix(uvec3, uvec3, bvec3);"
3377
"uvec4 mix(uvec4, uvec4, bvec4);"
3378
"bool mix(bool, bool, bool );"
3379
"bvec2 mix(bvec2, bvec2, bvec2);"
3380
"bvec3 mix(bvec3, bvec3, bvec3);"
3381
"bvec4 mix(bvec4, bvec4, bvec4);"
3382
3383
"\n");
3384
}
3385
3386
// GL_AMD_gpu_shader_half_float/Explicit types
3387
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) {
3388
commonBuiltins.append(
3389
"float16_t radians(float16_t);"
3390
"f16vec2 radians(f16vec2);"
3391
"f16vec3 radians(f16vec3);"
3392
"f16vec4 radians(f16vec4);"
3393
3394
"float16_t degrees(float16_t);"
3395
"f16vec2 degrees(f16vec2);"
3396
"f16vec3 degrees(f16vec3);"
3397
"f16vec4 degrees(f16vec4);"
3398
3399
"float16_t sin(float16_t);"
3400
"f16vec2 sin(f16vec2);"
3401
"f16vec3 sin(f16vec3);"
3402
"f16vec4 sin(f16vec4);"
3403
3404
"float16_t cos(float16_t);"
3405
"f16vec2 cos(f16vec2);"
3406
"f16vec3 cos(f16vec3);"
3407
"f16vec4 cos(f16vec4);"
3408
3409
"float16_t tan(float16_t);"
3410
"f16vec2 tan(f16vec2);"
3411
"f16vec3 tan(f16vec3);"
3412
"f16vec4 tan(f16vec4);"
3413
3414
"float16_t asin(float16_t);"
3415
"f16vec2 asin(f16vec2);"
3416
"f16vec3 asin(f16vec3);"
3417
"f16vec4 asin(f16vec4);"
3418
3419
"float16_t acos(float16_t);"
3420
"f16vec2 acos(f16vec2);"
3421
"f16vec3 acos(f16vec3);"
3422
"f16vec4 acos(f16vec4);"
3423
3424
"float16_t atan(float16_t, float16_t);"
3425
"f16vec2 atan(f16vec2, f16vec2);"
3426
"f16vec3 atan(f16vec3, f16vec3);"
3427
"f16vec4 atan(f16vec4, f16vec4);"
3428
3429
"float16_t atan(float16_t);"
3430
"f16vec2 atan(f16vec2);"
3431
"f16vec3 atan(f16vec3);"
3432
"f16vec4 atan(f16vec4);"
3433
3434
"float16_t sinh(float16_t);"
3435
"f16vec2 sinh(f16vec2);"
3436
"f16vec3 sinh(f16vec3);"
3437
"f16vec4 sinh(f16vec4);"
3438
3439
"float16_t cosh(float16_t);"
3440
"f16vec2 cosh(f16vec2);"
3441
"f16vec3 cosh(f16vec3);"
3442
"f16vec4 cosh(f16vec4);"
3443
3444
"float16_t tanh(float16_t);"
3445
"f16vec2 tanh(f16vec2);"
3446
"f16vec3 tanh(f16vec3);"
3447
"f16vec4 tanh(f16vec4);"
3448
3449
"float16_t asinh(float16_t);"
3450
"f16vec2 asinh(f16vec2);"
3451
"f16vec3 asinh(f16vec3);"
3452
"f16vec4 asinh(f16vec4);"
3453
3454
"float16_t acosh(float16_t);"
3455
"f16vec2 acosh(f16vec2);"
3456
"f16vec3 acosh(f16vec3);"
3457
"f16vec4 acosh(f16vec4);"
3458
3459
"float16_t atanh(float16_t);"
3460
"f16vec2 atanh(f16vec2);"
3461
"f16vec3 atanh(f16vec3);"
3462
"f16vec4 atanh(f16vec4);"
3463
3464
"float16_t pow(float16_t, float16_t);"
3465
"f16vec2 pow(f16vec2, f16vec2);"
3466
"f16vec3 pow(f16vec3, f16vec3);"
3467
"f16vec4 pow(f16vec4, f16vec4);"
3468
3469
"float16_t exp(float16_t);"
3470
"f16vec2 exp(f16vec2);"
3471
"f16vec3 exp(f16vec3);"
3472
"f16vec4 exp(f16vec4);"
3473
3474
"float16_t log(float16_t);"
3475
"f16vec2 log(f16vec2);"
3476
"f16vec3 log(f16vec3);"
3477
"f16vec4 log(f16vec4);"
3478
3479
"float16_t exp2(float16_t);"
3480
"f16vec2 exp2(f16vec2);"
3481
"f16vec3 exp2(f16vec3);"
3482
"f16vec4 exp2(f16vec4);"
3483
3484
"float16_t log2(float16_t);"
3485
"f16vec2 log2(f16vec2);"
3486
"f16vec3 log2(f16vec3);"
3487
"f16vec4 log2(f16vec4);"
3488
3489
"float16_t sqrt(float16_t);"
3490
"f16vec2 sqrt(f16vec2);"
3491
"f16vec3 sqrt(f16vec3);"
3492
"f16vec4 sqrt(f16vec4);"
3493
3494
"float16_t inversesqrt(float16_t);"
3495
"f16vec2 inversesqrt(f16vec2);"
3496
"f16vec3 inversesqrt(f16vec3);"
3497
"f16vec4 inversesqrt(f16vec4);"
3498
3499
"float16_t abs(float16_t);"
3500
"f16vec2 abs(f16vec2);"
3501
"f16vec3 abs(f16vec3);"
3502
"f16vec4 abs(f16vec4);"
3503
3504
"float16_t sign(float16_t);"
3505
"f16vec2 sign(f16vec2);"
3506
"f16vec3 sign(f16vec3);"
3507
"f16vec4 sign(f16vec4);"
3508
3509
"float16_t floor(float16_t);"
3510
"f16vec2 floor(f16vec2);"
3511
"f16vec3 floor(f16vec3);"
3512
"f16vec4 floor(f16vec4);"
3513
3514
"float16_t trunc(float16_t);"
3515
"f16vec2 trunc(f16vec2);"
3516
"f16vec3 trunc(f16vec3);"
3517
"f16vec4 trunc(f16vec4);"
3518
3519
"float16_t round(float16_t);"
3520
"f16vec2 round(f16vec2);"
3521
"f16vec3 round(f16vec3);"
3522
"f16vec4 round(f16vec4);"
3523
3524
"float16_t roundEven(float16_t);"
3525
"f16vec2 roundEven(f16vec2);"
3526
"f16vec3 roundEven(f16vec3);"
3527
"f16vec4 roundEven(f16vec4);"
3528
3529
"float16_t ceil(float16_t);"
3530
"f16vec2 ceil(f16vec2);"
3531
"f16vec3 ceil(f16vec3);"
3532
"f16vec4 ceil(f16vec4);"
3533
3534
"float16_t fract(float16_t);"
3535
"f16vec2 fract(f16vec2);"
3536
"f16vec3 fract(f16vec3);"
3537
"f16vec4 fract(f16vec4);"
3538
3539
"float16_t mod(float16_t, float16_t);"
3540
"f16vec2 mod(f16vec2, float16_t);"
3541
"f16vec3 mod(f16vec3, float16_t);"
3542
"f16vec4 mod(f16vec4, float16_t);"
3543
"f16vec2 mod(f16vec2, f16vec2);"
3544
"f16vec3 mod(f16vec3, f16vec3);"
3545
"f16vec4 mod(f16vec4, f16vec4);"
3546
3547
"float16_t modf(float16_t, out float16_t);"
3548
"f16vec2 modf(f16vec2, out f16vec2);"
3549
"f16vec3 modf(f16vec3, out f16vec3);"
3550
"f16vec4 modf(f16vec4, out f16vec4);"
3551
3552
"float16_t min(float16_t, float16_t);"
3553
"f16vec2 min(f16vec2, float16_t);"
3554
"f16vec3 min(f16vec3, float16_t);"
3555
"f16vec4 min(f16vec4, float16_t);"
3556
"f16vec2 min(f16vec2, f16vec2);"
3557
"f16vec3 min(f16vec3, f16vec3);"
3558
"f16vec4 min(f16vec4, f16vec4);"
3559
3560
"float16_t max(float16_t, float16_t);"
3561
"f16vec2 max(f16vec2, float16_t);"
3562
"f16vec3 max(f16vec3, float16_t);"
3563
"f16vec4 max(f16vec4, float16_t);"
3564
"f16vec2 max(f16vec2, f16vec2);"
3565
"f16vec3 max(f16vec3, f16vec3);"
3566
"f16vec4 max(f16vec4, f16vec4);"
3567
3568
"float16_t clamp(float16_t, float16_t, float16_t);"
3569
"f16vec2 clamp(f16vec2, float16_t, float16_t);"
3570
"f16vec3 clamp(f16vec3, float16_t, float16_t);"
3571
"f16vec4 clamp(f16vec4, float16_t, float16_t);"
3572
"f16vec2 clamp(f16vec2, f16vec2, f16vec2);"
3573
"f16vec3 clamp(f16vec3, f16vec3, f16vec3);"
3574
"f16vec4 clamp(f16vec4, f16vec4, f16vec4);"
3575
3576
"float16_t mix(float16_t, float16_t, float16_t);"
3577
"f16vec2 mix(f16vec2, f16vec2, float16_t);"
3578
"f16vec3 mix(f16vec3, f16vec3, float16_t);"
3579
"f16vec4 mix(f16vec4, f16vec4, float16_t);"
3580
"f16vec2 mix(f16vec2, f16vec2, f16vec2);"
3581
"f16vec3 mix(f16vec3, f16vec3, f16vec3);"
3582
"f16vec4 mix(f16vec4, f16vec4, f16vec4);"
3583
"float16_t mix(float16_t, float16_t, bool);"
3584
"f16vec2 mix(f16vec2, f16vec2, bvec2);"
3585
"f16vec3 mix(f16vec3, f16vec3, bvec3);"
3586
"f16vec4 mix(f16vec4, f16vec4, bvec4);"
3587
3588
"float16_t step(float16_t, float16_t);"
3589
"f16vec2 step(f16vec2, f16vec2);"
3590
"f16vec3 step(f16vec3, f16vec3);"
3591
"f16vec4 step(f16vec4, f16vec4);"
3592
"f16vec2 step(float16_t, f16vec2);"
3593
"f16vec3 step(float16_t, f16vec3);"
3594
"f16vec4 step(float16_t, f16vec4);"
3595
3596
"float16_t smoothstep(float16_t, float16_t, float16_t);"
3597
"f16vec2 smoothstep(f16vec2, f16vec2, f16vec2);"
3598
"f16vec3 smoothstep(f16vec3, f16vec3, f16vec3);"
3599
"f16vec4 smoothstep(f16vec4, f16vec4, f16vec4);"
3600
"f16vec2 smoothstep(float16_t, float16_t, f16vec2);"
3601
"f16vec3 smoothstep(float16_t, float16_t, f16vec3);"
3602
"f16vec4 smoothstep(float16_t, float16_t, f16vec4);"
3603
3604
"bool isnan(float16_t);"
3605
"bvec2 isnan(f16vec2);"
3606
"bvec3 isnan(f16vec3);"
3607
"bvec4 isnan(f16vec4);"
3608
3609
"bool isinf(float16_t);"
3610
"bvec2 isinf(f16vec2);"
3611
"bvec3 isinf(f16vec3);"
3612
"bvec4 isinf(f16vec4);"
3613
3614
"float16_t fma(float16_t, float16_t, float16_t);"
3615
"f16vec2 fma(f16vec2, f16vec2, f16vec2);"
3616
"f16vec3 fma(f16vec3, f16vec3, f16vec3);"
3617
"f16vec4 fma(f16vec4, f16vec4, f16vec4);"
3618
3619
"float16_t frexp(float16_t, out int);"
3620
"f16vec2 frexp(f16vec2, out ivec2);"
3621
"f16vec3 frexp(f16vec3, out ivec3);"
3622
"f16vec4 frexp(f16vec4, out ivec4);"
3623
3624
"float16_t ldexp(float16_t, in int);"
3625
"f16vec2 ldexp(f16vec2, in ivec2);"
3626
"f16vec3 ldexp(f16vec3, in ivec3);"
3627
"f16vec4 ldexp(f16vec4, in ivec4);"
3628
3629
"uint packFloat2x16(f16vec2);"
3630
"f16vec2 unpackFloat2x16(uint);"
3631
3632
"float16_t length(float16_t);"
3633
"float16_t length(f16vec2);"
3634
"float16_t length(f16vec3);"
3635
"float16_t length(f16vec4);"
3636
3637
"float16_t distance(float16_t, float16_t);"
3638
"float16_t distance(f16vec2, f16vec2);"
3639
"float16_t distance(f16vec3, f16vec3);"
3640
"float16_t distance(f16vec4, f16vec4);"
3641
3642
"float16_t dot(float16_t, float16_t);"
3643
"float16_t dot(f16vec2, f16vec2);"
3644
"float16_t dot(f16vec3, f16vec3);"
3645
"float16_t dot(f16vec4, f16vec4);"
3646
3647
"f16vec3 cross(f16vec3, f16vec3);"
3648
3649
"float16_t normalize(float16_t);"
3650
"f16vec2 normalize(f16vec2);"
3651
"f16vec3 normalize(f16vec3);"
3652
"f16vec4 normalize(f16vec4);"
3653
3654
"float16_t faceforward(float16_t, float16_t, float16_t);"
3655
"f16vec2 faceforward(f16vec2, f16vec2, f16vec2);"
3656
"f16vec3 faceforward(f16vec3, f16vec3, f16vec3);"
3657
"f16vec4 faceforward(f16vec4, f16vec4, f16vec4);"
3658
3659
"float16_t reflect(float16_t, float16_t);"
3660
"f16vec2 reflect(f16vec2, f16vec2);"
3661
"f16vec3 reflect(f16vec3, f16vec3);"
3662
"f16vec4 reflect(f16vec4, f16vec4);"
3663
3664
"float16_t refract(float16_t, float16_t, float16_t);"
3665
"f16vec2 refract(f16vec2, f16vec2, float16_t);"
3666
"f16vec3 refract(f16vec3, f16vec3, float16_t);"
3667
"f16vec4 refract(f16vec4, f16vec4, float16_t);"
3668
3669
"f16mat2 matrixCompMult(f16mat2, f16mat2);"
3670
"f16mat3 matrixCompMult(f16mat3, f16mat3);"
3671
"f16mat4 matrixCompMult(f16mat4, f16mat4);"
3672
"f16mat2x3 matrixCompMult(f16mat2x3, f16mat2x3);"
3673
"f16mat2x4 matrixCompMult(f16mat2x4, f16mat2x4);"
3674
"f16mat3x2 matrixCompMult(f16mat3x2, f16mat3x2);"
3675
"f16mat3x4 matrixCompMult(f16mat3x4, f16mat3x4);"
3676
"f16mat4x2 matrixCompMult(f16mat4x2, f16mat4x2);"
3677
"f16mat4x3 matrixCompMult(f16mat4x3, f16mat4x3);"
3678
3679
"f16mat2 outerProduct(f16vec2, f16vec2);"
3680
"f16mat3 outerProduct(f16vec3, f16vec3);"
3681
"f16mat4 outerProduct(f16vec4, f16vec4);"
3682
"f16mat2x3 outerProduct(f16vec3, f16vec2);"
3683
"f16mat3x2 outerProduct(f16vec2, f16vec3);"
3684
"f16mat2x4 outerProduct(f16vec4, f16vec2);"
3685
"f16mat4x2 outerProduct(f16vec2, f16vec4);"
3686
"f16mat3x4 outerProduct(f16vec4, f16vec3);"
3687
"f16mat4x3 outerProduct(f16vec3, f16vec4);"
3688
3689
"f16mat2 transpose(f16mat2);"
3690
"f16mat3 transpose(f16mat3);"
3691
"f16mat4 transpose(f16mat4);"
3692
"f16mat2x3 transpose(f16mat3x2);"
3693
"f16mat3x2 transpose(f16mat2x3);"
3694
"f16mat2x4 transpose(f16mat4x2);"
3695
"f16mat4x2 transpose(f16mat2x4);"
3696
"f16mat3x4 transpose(f16mat4x3);"
3697
"f16mat4x3 transpose(f16mat3x4);"
3698
3699
"float16_t determinant(f16mat2);"
3700
"float16_t determinant(f16mat3);"
3701
"float16_t determinant(f16mat4);"
3702
3703
"f16mat2 inverse(f16mat2);"
3704
"f16mat3 inverse(f16mat3);"
3705
"f16mat4 inverse(f16mat4);"
3706
3707
"bvec2 lessThan(f16vec2, f16vec2);"
3708
"bvec3 lessThan(f16vec3, f16vec3);"
3709
"bvec4 lessThan(f16vec4, f16vec4);"
3710
3711
"bvec2 lessThanEqual(f16vec2, f16vec2);"
3712
"bvec3 lessThanEqual(f16vec3, f16vec3);"
3713
"bvec4 lessThanEqual(f16vec4, f16vec4);"
3714
3715
"bvec2 greaterThan(f16vec2, f16vec2);"
3716
"bvec3 greaterThan(f16vec3, f16vec3);"
3717
"bvec4 greaterThan(f16vec4, f16vec4);"
3718
3719
"bvec2 greaterThanEqual(f16vec2, f16vec2);"
3720
"bvec3 greaterThanEqual(f16vec3, f16vec3);"
3721
"bvec4 greaterThanEqual(f16vec4, f16vec4);"
3722
3723
"bvec2 equal(f16vec2, f16vec2);"
3724
"bvec3 equal(f16vec3, f16vec3);"
3725
"bvec4 equal(f16vec4, f16vec4);"
3726
3727
"bvec2 notEqual(f16vec2, f16vec2);"
3728
"bvec3 notEqual(f16vec3, f16vec3);"
3729
"bvec4 notEqual(f16vec4, f16vec4);"
3730
3731
"\n");
3732
}
3733
3734
// Explicit types
3735
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) {
3736
commonBuiltins.append(
3737
"int8_t abs(int8_t);"
3738
"i8vec2 abs(i8vec2);"
3739
"i8vec3 abs(i8vec3);"
3740
"i8vec4 abs(i8vec4);"
3741
3742
"int8_t sign(int8_t);"
3743
"i8vec2 sign(i8vec2);"
3744
"i8vec3 sign(i8vec3);"
3745
"i8vec4 sign(i8vec4);"
3746
3747
"int8_t min(int8_t x, int8_t y);"
3748
"i8vec2 min(i8vec2 x, int8_t y);"
3749
"i8vec3 min(i8vec3 x, int8_t y);"
3750
"i8vec4 min(i8vec4 x, int8_t y);"
3751
"i8vec2 min(i8vec2 x, i8vec2 y);"
3752
"i8vec3 min(i8vec3 x, i8vec3 y);"
3753
"i8vec4 min(i8vec4 x, i8vec4 y);"
3754
3755
"uint8_t min(uint8_t x, uint8_t y);"
3756
"u8vec2 min(u8vec2 x, uint8_t y);"
3757
"u8vec3 min(u8vec3 x, uint8_t y);"
3758
"u8vec4 min(u8vec4 x, uint8_t y);"
3759
"u8vec2 min(u8vec2 x, u8vec2 y);"
3760
"u8vec3 min(u8vec3 x, u8vec3 y);"
3761
"u8vec4 min(u8vec4 x, u8vec4 y);"
3762
3763
"int8_t max(int8_t x, int8_t y);"
3764
"i8vec2 max(i8vec2 x, int8_t y);"
3765
"i8vec3 max(i8vec3 x, int8_t y);"
3766
"i8vec4 max(i8vec4 x, int8_t y);"
3767
"i8vec2 max(i8vec2 x, i8vec2 y);"
3768
"i8vec3 max(i8vec3 x, i8vec3 y);"
3769
"i8vec4 max(i8vec4 x, i8vec4 y);"
3770
3771
"uint8_t max(uint8_t x, uint8_t y);"
3772
"u8vec2 max(u8vec2 x, uint8_t y);"
3773
"u8vec3 max(u8vec3 x, uint8_t y);"
3774
"u8vec4 max(u8vec4 x, uint8_t y);"
3775
"u8vec2 max(u8vec2 x, u8vec2 y);"
3776
"u8vec3 max(u8vec3 x, u8vec3 y);"
3777
"u8vec4 max(u8vec4 x, u8vec4 y);"
3778
3779
"int8_t clamp(int8_t x, int8_t minVal, int8_t maxVal);"
3780
"i8vec2 clamp(i8vec2 x, int8_t minVal, int8_t maxVal);"
3781
"i8vec3 clamp(i8vec3 x, int8_t minVal, int8_t maxVal);"
3782
"i8vec4 clamp(i8vec4 x, int8_t minVal, int8_t maxVal);"
3783
"i8vec2 clamp(i8vec2 x, i8vec2 minVal, i8vec2 maxVal);"
3784
"i8vec3 clamp(i8vec3 x, i8vec3 minVal, i8vec3 maxVal);"
3785
"i8vec4 clamp(i8vec4 x, i8vec4 minVal, i8vec4 maxVal);"
3786
3787
"uint8_t clamp(uint8_t x, uint8_t minVal, uint8_t maxVal);"
3788
"u8vec2 clamp(u8vec2 x, uint8_t minVal, uint8_t maxVal);"
3789
"u8vec3 clamp(u8vec3 x, uint8_t minVal, uint8_t maxVal);"
3790
"u8vec4 clamp(u8vec4 x, uint8_t minVal, uint8_t maxVal);"
3791
"u8vec2 clamp(u8vec2 x, u8vec2 minVal, u8vec2 maxVal);"
3792
"u8vec3 clamp(u8vec3 x, u8vec3 minVal, u8vec3 maxVal);"
3793
"u8vec4 clamp(u8vec4 x, u8vec4 minVal, u8vec4 maxVal);"
3794
3795
"int8_t mix(int8_t, int8_t, bool);"
3796
"i8vec2 mix(i8vec2, i8vec2, bvec2);"
3797
"i8vec3 mix(i8vec3, i8vec3, bvec3);"
3798
"i8vec4 mix(i8vec4, i8vec4, bvec4);"
3799
"uint8_t mix(uint8_t, uint8_t, bool);"
3800
"u8vec2 mix(u8vec2, u8vec2, bvec2);"
3801
"u8vec3 mix(u8vec3, u8vec3, bvec3);"
3802
"u8vec4 mix(u8vec4, u8vec4, bvec4);"
3803
3804
"bvec2 lessThan(i8vec2, i8vec2);"
3805
"bvec3 lessThan(i8vec3, i8vec3);"
3806
"bvec4 lessThan(i8vec4, i8vec4);"
3807
"bvec2 lessThan(u8vec2, u8vec2);"
3808
"bvec3 lessThan(u8vec3, u8vec3);"
3809
"bvec4 lessThan(u8vec4, u8vec4);"
3810
3811
"bvec2 lessThanEqual(i8vec2, i8vec2);"
3812
"bvec3 lessThanEqual(i8vec3, i8vec3);"
3813
"bvec4 lessThanEqual(i8vec4, i8vec4);"
3814
"bvec2 lessThanEqual(u8vec2, u8vec2);"
3815
"bvec3 lessThanEqual(u8vec3, u8vec3);"
3816
"bvec4 lessThanEqual(u8vec4, u8vec4);"
3817
3818
"bvec2 greaterThan(i8vec2, i8vec2);"
3819
"bvec3 greaterThan(i8vec3, i8vec3);"
3820
"bvec4 greaterThan(i8vec4, i8vec4);"
3821
"bvec2 greaterThan(u8vec2, u8vec2);"
3822
"bvec3 greaterThan(u8vec3, u8vec3);"
3823
"bvec4 greaterThan(u8vec4, u8vec4);"
3824
3825
"bvec2 greaterThanEqual(i8vec2, i8vec2);"
3826
"bvec3 greaterThanEqual(i8vec3, i8vec3);"
3827
"bvec4 greaterThanEqual(i8vec4, i8vec4);"
3828
"bvec2 greaterThanEqual(u8vec2, u8vec2);"
3829
"bvec3 greaterThanEqual(u8vec3, u8vec3);"
3830
"bvec4 greaterThanEqual(u8vec4, u8vec4);"
3831
3832
"bvec2 equal(i8vec2, i8vec2);"
3833
"bvec3 equal(i8vec3, i8vec3);"
3834
"bvec4 equal(i8vec4, i8vec4);"
3835
"bvec2 equal(u8vec2, u8vec2);"
3836
"bvec3 equal(u8vec3, u8vec3);"
3837
"bvec4 equal(u8vec4, u8vec4);"
3838
3839
"bvec2 notEqual(i8vec2, i8vec2);"
3840
"bvec3 notEqual(i8vec3, i8vec3);"
3841
"bvec4 notEqual(i8vec4, i8vec4);"
3842
"bvec2 notEqual(u8vec2, u8vec2);"
3843
"bvec3 notEqual(u8vec3, u8vec3);"
3844
"bvec4 notEqual(u8vec4, u8vec4);"
3845
3846
" int8_t bitfieldExtract( int8_t, int8_t, int8_t);"
3847
"i8vec2 bitfieldExtract(i8vec2, int8_t, int8_t);"
3848
"i8vec3 bitfieldExtract(i8vec3, int8_t, int8_t);"
3849
"i8vec4 bitfieldExtract(i8vec4, int8_t, int8_t);"
3850
3851
" uint8_t bitfieldExtract( uint8_t, int8_t, int8_t);"
3852
"u8vec2 bitfieldExtract(u8vec2, int8_t, int8_t);"
3853
"u8vec3 bitfieldExtract(u8vec3, int8_t, int8_t);"
3854
"u8vec4 bitfieldExtract(u8vec4, int8_t, int8_t);"
3855
3856
" int8_t bitfieldInsert( int8_t base, int8_t, int8_t, int8_t);"
3857
"i8vec2 bitfieldInsert(i8vec2 base, i8vec2, int8_t, int8_t);"
3858
"i8vec3 bitfieldInsert(i8vec3 base, i8vec3, int8_t, int8_t);"
3859
"i8vec4 bitfieldInsert(i8vec4 base, i8vec4, int8_t, int8_t);"
3860
3861
" uint8_t bitfieldInsert( uint8_t base, uint8_t, int8_t, int8_t);"
3862
"u8vec2 bitfieldInsert(u8vec2 base, u8vec2, int8_t, int8_t);"
3863
"u8vec3 bitfieldInsert(u8vec3 base, u8vec3, int8_t, int8_t);"
3864
"u8vec4 bitfieldInsert(u8vec4 base, u8vec4, int8_t, int8_t);"
3865
3866
" int8_t bitCount( int8_t);"
3867
"i8vec2 bitCount(i8vec2);"
3868
"i8vec3 bitCount(i8vec3);"
3869
"i8vec4 bitCount(i8vec4);"
3870
3871
" int8_t bitCount( uint8_t);"
3872
"i8vec2 bitCount(u8vec2);"
3873
"i8vec3 bitCount(u8vec3);"
3874
"i8vec4 bitCount(u8vec4);"
3875
3876
" int8_t findLSB( int8_t);"
3877
"i8vec2 findLSB(i8vec2);"
3878
"i8vec3 findLSB(i8vec3);"
3879
"i8vec4 findLSB(i8vec4);"
3880
3881
" int8_t findLSB( uint8_t);"
3882
"i8vec2 findLSB(u8vec2);"
3883
"i8vec3 findLSB(u8vec3);"
3884
"i8vec4 findLSB(u8vec4);"
3885
3886
" int8_t findMSB( int8_t);"
3887
"i8vec2 findMSB(i8vec2);"
3888
"i8vec3 findMSB(i8vec3);"
3889
"i8vec4 findMSB(i8vec4);"
3890
3891
" int8_t findMSB( uint8_t);"
3892
"i8vec2 findMSB(u8vec2);"
3893
"i8vec3 findMSB(u8vec3);"
3894
"i8vec4 findMSB(u8vec4);"
3895
3896
"int16_t abs(int16_t);"
3897
"i16vec2 abs(i16vec2);"
3898
"i16vec3 abs(i16vec3);"
3899
"i16vec4 abs(i16vec4);"
3900
3901
"int16_t sign(int16_t);"
3902
"i16vec2 sign(i16vec2);"
3903
"i16vec3 sign(i16vec3);"
3904
"i16vec4 sign(i16vec4);"
3905
3906
"int16_t min(int16_t x, int16_t y);"
3907
"i16vec2 min(i16vec2 x, int16_t y);"
3908
"i16vec3 min(i16vec3 x, int16_t y);"
3909
"i16vec4 min(i16vec4 x, int16_t y);"
3910
"i16vec2 min(i16vec2 x, i16vec2 y);"
3911
"i16vec3 min(i16vec3 x, i16vec3 y);"
3912
"i16vec4 min(i16vec4 x, i16vec4 y);"
3913
3914
"uint16_t min(uint16_t x, uint16_t y);"
3915
"u16vec2 min(u16vec2 x, uint16_t y);"
3916
"u16vec3 min(u16vec3 x, uint16_t y);"
3917
"u16vec4 min(u16vec4 x, uint16_t y);"
3918
"u16vec2 min(u16vec2 x, u16vec2 y);"
3919
"u16vec3 min(u16vec3 x, u16vec3 y);"
3920
"u16vec4 min(u16vec4 x, u16vec4 y);"
3921
3922
"int16_t max(int16_t x, int16_t y);"
3923
"i16vec2 max(i16vec2 x, int16_t y);"
3924
"i16vec3 max(i16vec3 x, int16_t y);"
3925
"i16vec4 max(i16vec4 x, int16_t y);"
3926
"i16vec2 max(i16vec2 x, i16vec2 y);"
3927
"i16vec3 max(i16vec3 x, i16vec3 y);"
3928
"i16vec4 max(i16vec4 x, i16vec4 y);"
3929
3930
"uint16_t max(uint16_t x, uint16_t y);"
3931
"u16vec2 max(u16vec2 x, uint16_t y);"
3932
"u16vec3 max(u16vec3 x, uint16_t y);"
3933
"u16vec4 max(u16vec4 x, uint16_t y);"
3934
"u16vec2 max(u16vec2 x, u16vec2 y);"
3935
"u16vec3 max(u16vec3 x, u16vec3 y);"
3936
"u16vec4 max(u16vec4 x, u16vec4 y);"
3937
3938
"int16_t clamp(int16_t x, int16_t minVal, int16_t maxVal);"
3939
"i16vec2 clamp(i16vec2 x, int16_t minVal, int16_t maxVal);"
3940
"i16vec3 clamp(i16vec3 x, int16_t minVal, int16_t maxVal);"
3941
"i16vec4 clamp(i16vec4 x, int16_t minVal, int16_t maxVal);"
3942
"i16vec2 clamp(i16vec2 x, i16vec2 minVal, i16vec2 maxVal);"
3943
"i16vec3 clamp(i16vec3 x, i16vec3 minVal, i16vec3 maxVal);"
3944
"i16vec4 clamp(i16vec4 x, i16vec4 minVal, i16vec4 maxVal);"
3945
3946
"uint16_t clamp(uint16_t x, uint16_t minVal, uint16_t maxVal);"
3947
"u16vec2 clamp(u16vec2 x, uint16_t minVal, uint16_t maxVal);"
3948
"u16vec3 clamp(u16vec3 x, uint16_t minVal, uint16_t maxVal);"
3949
"u16vec4 clamp(u16vec4 x, uint16_t minVal, uint16_t maxVal);"
3950
"u16vec2 clamp(u16vec2 x, u16vec2 minVal, u16vec2 maxVal);"
3951
"u16vec3 clamp(u16vec3 x, u16vec3 minVal, u16vec3 maxVal);"
3952
"u16vec4 clamp(u16vec4 x, u16vec4 minVal, u16vec4 maxVal);"
3953
3954
"int16_t mix(int16_t, int16_t, bool);"
3955
"i16vec2 mix(i16vec2, i16vec2, bvec2);"
3956
"i16vec3 mix(i16vec3, i16vec3, bvec3);"
3957
"i16vec4 mix(i16vec4, i16vec4, bvec4);"
3958
"uint16_t mix(uint16_t, uint16_t, bool);"
3959
"u16vec2 mix(u16vec2, u16vec2, bvec2);"
3960
"u16vec3 mix(u16vec3, u16vec3, bvec3);"
3961
"u16vec4 mix(u16vec4, u16vec4, bvec4);"
3962
3963
"float16_t frexp(float16_t, out int16_t);"
3964
"f16vec2 frexp(f16vec2, out i16vec2);"
3965
"f16vec3 frexp(f16vec3, out i16vec3);"
3966
"f16vec4 frexp(f16vec4, out i16vec4);"
3967
3968
"float16_t ldexp(float16_t, int16_t);"
3969
"f16vec2 ldexp(f16vec2, i16vec2);"
3970
"f16vec3 ldexp(f16vec3, i16vec3);"
3971
"f16vec4 ldexp(f16vec4, i16vec4);"
3972
3973
"int16_t halfBitsToInt16(float16_t);"
3974
"i16vec2 halfBitsToInt16(f16vec2);"
3975
"i16vec3 halhBitsToInt16(f16vec3);"
3976
"i16vec4 halfBitsToInt16(f16vec4);"
3977
3978
"uint16_t halfBitsToUint16(float16_t);"
3979
"u16vec2 halfBitsToUint16(f16vec2);"
3980
"u16vec3 halfBitsToUint16(f16vec3);"
3981
"u16vec4 halfBitsToUint16(f16vec4);"
3982
3983
"int16_t float16BitsToInt16(float16_t);"
3984
"i16vec2 float16BitsToInt16(f16vec2);"
3985
"i16vec3 float16BitsToInt16(f16vec3);"
3986
"i16vec4 float16BitsToInt16(f16vec4);"
3987
3988
"uint16_t float16BitsToUint16(float16_t);"
3989
"u16vec2 float16BitsToUint16(f16vec2);"
3990
"u16vec3 float16BitsToUint16(f16vec3);"
3991
"u16vec4 float16BitsToUint16(f16vec4);"
3992
3993
"float16_t int16BitsToFloat16(int16_t);"
3994
"f16vec2 int16BitsToFloat16(i16vec2);"
3995
"f16vec3 int16BitsToFloat16(i16vec3);"
3996
"f16vec4 int16BitsToFloat16(i16vec4);"
3997
3998
"float16_t uint16BitsToFloat16(uint16_t);"
3999
"f16vec2 uint16BitsToFloat16(u16vec2);"
4000
"f16vec3 uint16BitsToFloat16(u16vec3);"
4001
"f16vec4 uint16BitsToFloat16(u16vec4);"
4002
4003
"float16_t int16BitsToHalf(int16_t);"
4004
"f16vec2 int16BitsToHalf(i16vec2);"
4005
"f16vec3 int16BitsToHalf(i16vec3);"
4006
"f16vec4 int16BitsToHalf(i16vec4);"
4007
4008
"float16_t uint16BitsToHalf(uint16_t);"
4009
"f16vec2 uint16BitsToHalf(u16vec2);"
4010
"f16vec3 uint16BitsToHalf(u16vec3);"
4011
"f16vec4 uint16BitsToHalf(u16vec4);"
4012
4013
"int packInt2x16(i16vec2);"
4014
"uint packUint2x16(u16vec2);"
4015
"int64_t packInt4x16(i16vec4);"
4016
"uint64_t packUint4x16(u16vec4);"
4017
"i16vec2 unpackInt2x16(int);"
4018
"u16vec2 unpackUint2x16(uint);"
4019
"i16vec4 unpackInt4x16(int64_t);"
4020
"u16vec4 unpackUint4x16(uint64_t);"
4021
4022
"bvec2 lessThan(i16vec2, i16vec2);"
4023
"bvec3 lessThan(i16vec3, i16vec3);"
4024
"bvec4 lessThan(i16vec4, i16vec4);"
4025
"bvec2 lessThan(u16vec2, u16vec2);"
4026
"bvec3 lessThan(u16vec3, u16vec3);"
4027
"bvec4 lessThan(u16vec4, u16vec4);"
4028
4029
"bvec2 lessThanEqual(i16vec2, i16vec2);"
4030
"bvec3 lessThanEqual(i16vec3, i16vec3);"
4031
"bvec4 lessThanEqual(i16vec4, i16vec4);"
4032
"bvec2 lessThanEqual(u16vec2, u16vec2);"
4033
"bvec3 lessThanEqual(u16vec3, u16vec3);"
4034
"bvec4 lessThanEqual(u16vec4, u16vec4);"
4035
4036
"bvec2 greaterThan(i16vec2, i16vec2);"
4037
"bvec3 greaterThan(i16vec3, i16vec3);"
4038
"bvec4 greaterThan(i16vec4, i16vec4);"
4039
"bvec2 greaterThan(u16vec2, u16vec2);"
4040
"bvec3 greaterThan(u16vec3, u16vec3);"
4041
"bvec4 greaterThan(u16vec4, u16vec4);"
4042
4043
"bvec2 greaterThanEqual(i16vec2, i16vec2);"
4044
"bvec3 greaterThanEqual(i16vec3, i16vec3);"
4045
"bvec4 greaterThanEqual(i16vec4, i16vec4);"
4046
"bvec2 greaterThanEqual(u16vec2, u16vec2);"
4047
"bvec3 greaterThanEqual(u16vec3, u16vec3);"
4048
"bvec4 greaterThanEqual(u16vec4, u16vec4);"
4049
4050
"bvec2 equal(i16vec2, i16vec2);"
4051
"bvec3 equal(i16vec3, i16vec3);"
4052
"bvec4 equal(i16vec4, i16vec4);"
4053
"bvec2 equal(u16vec2, u16vec2);"
4054
"bvec3 equal(u16vec3, u16vec3);"
4055
"bvec4 equal(u16vec4, u16vec4);"
4056
4057
"bvec2 notEqual(i16vec2, i16vec2);"
4058
"bvec3 notEqual(i16vec3, i16vec3);"
4059
"bvec4 notEqual(i16vec4, i16vec4);"
4060
"bvec2 notEqual(u16vec2, u16vec2);"
4061
"bvec3 notEqual(u16vec3, u16vec3);"
4062
"bvec4 notEqual(u16vec4, u16vec4);"
4063
4064
" int16_t bitfieldExtract( int16_t, int16_t, int16_t);"
4065
"i16vec2 bitfieldExtract(i16vec2, int16_t, int16_t);"
4066
"i16vec3 bitfieldExtract(i16vec3, int16_t, int16_t);"
4067
"i16vec4 bitfieldExtract(i16vec4, int16_t, int16_t);"
4068
4069
" uint16_t bitfieldExtract( uint16_t, int16_t, int16_t);"
4070
"u16vec2 bitfieldExtract(u16vec2, int16_t, int16_t);"
4071
"u16vec3 bitfieldExtract(u16vec3, int16_t, int16_t);"
4072
"u16vec4 bitfieldExtract(u16vec4, int16_t, int16_t);"
4073
4074
" int16_t bitfieldInsert( int16_t base, int16_t, int16_t, int16_t);"
4075
"i16vec2 bitfieldInsert(i16vec2 base, i16vec2, int16_t, int16_t);"
4076
"i16vec3 bitfieldInsert(i16vec3 base, i16vec3, int16_t, int16_t);"
4077
"i16vec4 bitfieldInsert(i16vec4 base, i16vec4, int16_t, int16_t);"
4078
4079
" uint16_t bitfieldInsert( uint16_t base, uint16_t, int16_t, int16_t);"
4080
"u16vec2 bitfieldInsert(u16vec2 base, u16vec2, int16_t, int16_t);"
4081
"u16vec3 bitfieldInsert(u16vec3 base, u16vec3, int16_t, int16_t);"
4082
"u16vec4 bitfieldInsert(u16vec4 base, u16vec4, int16_t, int16_t);"
4083
4084
" int16_t bitCount( int16_t);"
4085
"i16vec2 bitCount(i16vec2);"
4086
"i16vec3 bitCount(i16vec3);"
4087
"i16vec4 bitCount(i16vec4);"
4088
4089
" int16_t bitCount( uint16_t);"
4090
"i16vec2 bitCount(u16vec2);"
4091
"i16vec3 bitCount(u16vec3);"
4092
"i16vec4 bitCount(u16vec4);"
4093
4094
" int16_t findLSB( int16_t);"
4095
"i16vec2 findLSB(i16vec2);"
4096
"i16vec3 findLSB(i16vec3);"
4097
"i16vec4 findLSB(i16vec4);"
4098
4099
" int16_t findLSB( uint16_t);"
4100
"i16vec2 findLSB(u16vec2);"
4101
"i16vec3 findLSB(u16vec3);"
4102
"i16vec4 findLSB(u16vec4);"
4103
4104
" int16_t findMSB( int16_t);"
4105
"i16vec2 findMSB(i16vec2);"
4106
"i16vec3 findMSB(i16vec3);"
4107
"i16vec4 findMSB(i16vec4);"
4108
4109
" int16_t findMSB( uint16_t);"
4110
"i16vec2 findMSB(u16vec2);"
4111
"i16vec3 findMSB(u16vec3);"
4112
"i16vec4 findMSB(u16vec4);"
4113
4114
"int16_t pack16(i8vec2);"
4115
"uint16_t pack16(u8vec2);"
4116
"int32_t pack32(i8vec4);"
4117
"uint32_t pack32(u8vec4);"
4118
"int32_t pack32(i16vec2);"
4119
"uint32_t pack32(u16vec2);"
4120
"int64_t pack64(i16vec4);"
4121
"uint64_t pack64(u16vec4);"
4122
"int64_t pack64(i32vec2);"
4123
"uint64_t pack64(u32vec2);"
4124
4125
"i8vec2 unpack8(int16_t);"
4126
"u8vec2 unpack8(uint16_t);"
4127
"i8vec4 unpack8(int32_t);"
4128
"u8vec4 unpack8(uint32_t);"
4129
"i16vec2 unpack16(int32_t);"
4130
"u16vec2 unpack16(uint32_t);"
4131
"i16vec4 unpack16(int64_t);"
4132
"u16vec4 unpack16(uint64_t);"
4133
"i32vec2 unpack32(int64_t);"
4134
"u32vec2 unpack32(uint64_t);"
4135
4136
// GL_EXT_expect_assume
4137
"int8_t expectEXT(int8_t, int8_t);"
4138
"i8vec2 expectEXT(i8vec2, i8vec2);"
4139
"i8vec3 expectEXT(i8vec3, i8vec3);"
4140
"i8vec4 expectEXT(i8vec4, i8vec4);"
4141
4142
"uint8_t expectEXT(uint8_t, uint8_t);"
4143
"u8vec2 expectEXT(u8vec2, u8vec2);"
4144
"u8vec3 expectEXT(u8vec3, u8vec3);"
4145
"u8vec4 expectEXT(u8vec4, u8vec4);"
4146
4147
"int16_t expectEXT(int16_t, int16_t);"
4148
"i16vec2 expectEXT(i16vec2, i16vec2);"
4149
"i16vec3 expectEXT(i16vec3, i16vec3);"
4150
"i16vec4 expectEXT(i16vec4, i16vec4);"
4151
4152
"uint16_t expectEXT(uint16_t, uint16_t);"
4153
"u16vec2 expectEXT(u16vec2, u16vec2);"
4154
"u16vec3 expectEXT(u16vec3, u16vec3);"
4155
"u16vec4 expectEXT(u16vec4, u16vec4);"
4156
4157
"int64_t expectEXT(int64_t, int64_t);"
4158
"i64vec2 expectEXT(i64vec2, i64vec2);"
4159
"i64vec3 expectEXT(i64vec3, i64vec3);"
4160
"i64vec4 expectEXT(i64vec4, i64vec4);"
4161
4162
"uint64_t expectEXT(uint64_t, uint64_t);"
4163
"u64vec2 expectEXT(u64vec2, u64vec2);"
4164
"u64vec3 expectEXT(u64vec3, u64vec3);"
4165
"u64vec4 expectEXT(u64vec4, u64vec4);"
4166
"\n");
4167
}
4168
4169
// Builtins for GL_EXT_texture_shadow_lod
4170
if ((profile == EEsProfile && version >= 300) || ((profile != EEsProfile && version >= 130))) {
4171
commonBuiltins.append(
4172
"float texture(sampler2DArrayShadow, vec4, float);"
4173
"float texture(samplerCubeArrayShadow, vec4, float, float);"
4174
"float textureLod(sampler2DArrayShadow, vec4, float);"
4175
"float textureLod(samplerCubeShadow, vec4, float);"
4176
"float textureLod(samplerCubeArrayShadow, vec4, float, float);"
4177
"float textureLodOffset(sampler2DArrayShadow, vec4, float, ivec2);"
4178
"float textureOffset(sampler2DArrayShadow, vec4 , ivec2, float);"
4179
"\n");
4180
}
4181
4182
if (profile != EEsProfile && version >= 450) {
4183
stageBuiltins[EShLangFragment].append(derivativesAndControl64bits);
4184
stageBuiltins[EShLangFragment].append(
4185
"float64_t interpolateAtCentroid(float64_t);"
4186
"f64vec2 interpolateAtCentroid(f64vec2);"
4187
"f64vec3 interpolateAtCentroid(f64vec3);"
4188
"f64vec4 interpolateAtCentroid(f64vec4);"
4189
4190
"float64_t interpolateAtSample(float64_t, int);"
4191
"f64vec2 interpolateAtSample(f64vec2, int);"
4192
"f64vec3 interpolateAtSample(f64vec3, int);"
4193
"f64vec4 interpolateAtSample(f64vec4, int);"
4194
4195
"float64_t interpolateAtOffset(float64_t, f64vec2);"
4196
"f64vec2 interpolateAtOffset(f64vec2, f64vec2);"
4197
"f64vec3 interpolateAtOffset(f64vec3, f64vec2);"
4198
"f64vec4 interpolateAtOffset(f64vec4, f64vec2);"
4199
4200
"\n");
4201
4202
}
4203
4204
// GL_EXT_expect_assume
4205
if ((profile == EEsProfile && version >= 310) ||
4206
((profile != EEsProfile && version >= 140))) {
4207
commonBuiltins.append(
4208
"void assumeEXT(bool);"
4209
4210
"bool expectEXT(bool, bool);"
4211
"bvec2 expectEXT(bvec2, bvec2);"
4212
"bvec3 expectEXT(bvec3, bvec3);"
4213
"bvec4 expectEXT(bvec4, bvec4);"
4214
4215
"int expectEXT(int, int);"
4216
"ivec2 expectEXT(ivec2, ivec2);"
4217
"ivec3 expectEXT(ivec3, ivec3);"
4218
"ivec4 expectEXT(ivec4, ivec4);"
4219
4220
"uint expectEXT(uint, uint);"
4221
"uvec2 expectEXT(uvec2, uvec2);"
4222
"uvec3 expectEXT(uvec3, uvec3);"
4223
"uvec4 expectEXT(uvec4, uvec4);"
4224
"\n");
4225
}
4226
4227
// QCOM_image_processing
4228
if ((profile == EEsProfile && version >= 310) ||
4229
(profile != EEsProfile && version >= 140)) {
4230
commonBuiltins.append(
4231
"vec4 textureWeightedQCOM(sampler2D, vec2, sampler2DArray);"
4232
"vec4 textureWeightedQCOM(sampler2D, vec2, sampler1DArray);"
4233
"vec4 textureBoxFilterQCOM(sampler2D, vec2, vec2);"
4234
"vec4 textureBlockMatchSADQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);"
4235
"vec4 textureBlockMatchSSDQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);"
4236
4237
"vec4 textureBlockMatchWindowSSDQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);"
4238
"vec4 textureBlockMatchWindowSADQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);"
4239
"vec4 textureBlockMatchGatherSSDQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);"
4240
"vec4 textureBlockMatchGatherSADQCOM(sampler2D, uvec2, sampler2D, uvec2, uvec2);"
4241
"\n");
4242
}
4243
4244
//============================================================================
4245
//
4246
// Prototypes for built-in functions seen by vertex shaders only.
4247
// (Except legacy lod functions, where it depends which release they are
4248
// vertex only.)
4249
//
4250
//============================================================================
4251
4252
//
4253
// Geometric Functions.
4254
//
4255
if (spvVersion.vulkan == 0 && IncludeLegacy(version, profile, spvVersion))
4256
stageBuiltins[EShLangVertex].append("vec4 ftransform();");
4257
4258
//
4259
// Original-style texture Functions with lod.
4260
//
4261
TString* s;
4262
if (version == 100)
4263
s = &stageBuiltins[EShLangVertex];
4264
else
4265
s = &commonBuiltins;
4266
if ((profile == EEsProfile && version == 100) ||
4267
profile == ECompatibilityProfile ||
4268
(profile == ECoreProfile && version < 420) ||
4269
profile == ENoProfile) {
4270
if (spvVersion.spv == 0) {
4271
s->append(
4272
"vec4 texture2DLod(sampler2D, vec2, float);" // GL_ARB_shader_texture_lod
4273
"vec4 texture2DProjLod(sampler2D, vec3, float);" // GL_ARB_shader_texture_lod
4274
"vec4 texture2DProjLod(sampler2D, vec4, float);" // GL_ARB_shader_texture_lod
4275
"vec4 texture3DLod(sampler3D, vec3, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check
4276
"vec4 texture3DProjLod(sampler3D, vec4, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check
4277
"vec4 textureCubeLod(samplerCube, vec3, float);" // GL_ARB_shader_texture_lod
4278
4279
"\n");
4280
}
4281
}
4282
if ( profile == ECompatibilityProfile ||
4283
(profile == ECoreProfile && version < 420) ||
4284
profile == ENoProfile) {
4285
if (spvVersion.spv == 0) {
4286
s->append(
4287
"vec4 texture1DLod(sampler1D, float, float);" // GL_ARB_shader_texture_lod
4288
"vec4 texture1DProjLod(sampler1D, vec2, float);" // GL_ARB_shader_texture_lod
4289
"vec4 texture1DProjLod(sampler1D, vec4, float);" // GL_ARB_shader_texture_lod
4290
"vec4 shadow1DLod(sampler1DShadow, vec3, float);" // GL_ARB_shader_texture_lod
4291
"vec4 shadow2DLod(sampler2DShadow, vec3, float);" // GL_ARB_shader_texture_lod
4292
"vec4 shadow1DProjLod(sampler1DShadow, vec4, float);" // GL_ARB_shader_texture_lod
4293
"vec4 shadow2DProjLod(sampler2DShadow, vec4, float);" // GL_ARB_shader_texture_lod
4294
4295
"vec4 texture1DGradARB(sampler1D, float, float, float);" // GL_ARB_shader_texture_lod
4296
"vec4 texture1DProjGradARB(sampler1D, vec2, float, float);" // GL_ARB_shader_texture_lod
4297
"vec4 texture1DProjGradARB(sampler1D, vec4, float, float);" // GL_ARB_shader_texture_lod
4298
"vec4 texture2DGradARB(sampler2D, vec2, vec2, vec2);" // GL_ARB_shader_texture_lod
4299
"vec4 texture2DProjGradARB(sampler2D, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod
4300
"vec4 texture2DProjGradARB(sampler2D, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod
4301
"vec4 texture3DGradARB(sampler3D, vec3, vec3, vec3);" // GL_ARB_shader_texture_lod
4302
"vec4 texture3DProjGradARB(sampler3D, vec4, vec3, vec3);" // GL_ARB_shader_texture_lod
4303
"vec4 textureCubeGradARB(samplerCube, vec3, vec3, vec3);" // GL_ARB_shader_texture_lod
4304
"vec4 shadow1DGradARB(sampler1DShadow, vec3, float, float);" // GL_ARB_shader_texture_lod
4305
"vec4 shadow1DProjGradARB( sampler1DShadow, vec4, float, float);" // GL_ARB_shader_texture_lod
4306
"vec4 shadow2DGradARB(sampler2DShadow, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod
4307
"vec4 shadow2DProjGradARB( sampler2DShadow, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod
4308
"vec4 texture2DRectGradARB(sampler2DRect, vec2, vec2, vec2);" // GL_ARB_shader_texture_lod
4309
"vec4 texture2DRectProjGradARB( sampler2DRect, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod
4310
"vec4 texture2DRectProjGradARB( sampler2DRect, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod
4311
"vec4 shadow2DRectGradARB( sampler2DRectShadow, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod
4312
"vec4 shadow2DRectProjGradARB(sampler2DRectShadow, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod
4313
4314
"\n");
4315
}
4316
}
4317
4318
if ((profile != EEsProfile && version >= 150) ||
4319
(profile == EEsProfile && version >= 310)) {
4320
//============================================================================
4321
//
4322
// Prototypes for built-in functions seen by geometry shaders only.
4323
//
4324
//============================================================================
4325
4326
if (profile != EEsProfile && (version >= 400 || version == 150)) {
4327
stageBuiltins[EShLangGeometry].append(
4328
"void EmitStreamVertex(int);"
4329
"void EndStreamPrimitive(int);"
4330
);
4331
}
4332
stageBuiltins[EShLangGeometry].append(
4333
"void EmitVertex();"
4334
"void EndPrimitive();"
4335
"\n");
4336
}
4337
4338
//============================================================================
4339
//
4340
// Prototypes for all control functions.
4341
//
4342
//============================================================================
4343
bool esBarrier = (profile == EEsProfile && version >= 310);
4344
if ((profile != EEsProfile && version >= 150) || esBarrier)
4345
stageBuiltins[EShLangTessControl].append(
4346
"void barrier();"
4347
);
4348
if ((profile != EEsProfile && version >= 420) || esBarrier)
4349
stageBuiltins[EShLangCompute].append(
4350
"void barrier();"
4351
);
4352
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
4353
stageBuiltins[EShLangMesh].append(
4354
"void barrier();"
4355
);
4356
stageBuiltins[EShLangTask].append(
4357
"void barrier();"
4358
);
4359
}
4360
if ((profile != EEsProfile && version >= 130) || esBarrier)
4361
commonBuiltins.append(
4362
"void memoryBarrier();"
4363
);
4364
if ((profile != EEsProfile && version >= 420) || esBarrier) {
4365
commonBuiltins.append(
4366
"void memoryBarrierBuffer();"
4367
);
4368
stageBuiltins[EShLangCompute].append(
4369
"void memoryBarrierShared();"
4370
"void groupMemoryBarrier();"
4371
);
4372
}
4373
if ((profile != EEsProfile && version >= 420) || esBarrier) {
4374
if (spvVersion.vulkan == 0 || spvVersion.vulkanRelaxed) {
4375
commonBuiltins.append("void memoryBarrierAtomicCounter();");
4376
}
4377
commonBuiltins.append("void memoryBarrierImage();");
4378
}
4379
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
4380
stageBuiltins[EShLangMesh].append(
4381
"void memoryBarrierShared();"
4382
"void groupMemoryBarrier();"
4383
);
4384
stageBuiltins[EShLangTask].append(
4385
"void memoryBarrierShared();"
4386
"void groupMemoryBarrier();"
4387
);
4388
}
4389
4390
commonBuiltins.append("void controlBarrier(int, int, int, int);\n"
4391
"void memoryBarrier(int, int, int);\n");
4392
4393
commonBuiltins.append("void debugPrintfEXT();\n");
4394
4395
if (profile != EEsProfile && version >= 450) {
4396
// coopMatStoreNV perhaps ought to have "out" on the buf parameter, but
4397
// adding it introduces undesirable tempArgs on the stack. What we want
4398
// is more like "buf" thought of as a pointer value being an in parameter.
4399
stageBuiltins[EShLangCompute].append(
4400
"void coopMatLoadNV(out fcoopmatNV m, volatile coherent float16_t[] buf, uint element, uint stride, bool colMajor);\n"
4401
"void coopMatLoadNV(out fcoopmatNV m, volatile coherent float[] buf, uint element, uint stride, bool colMajor);\n"
4402
"void coopMatLoadNV(out fcoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"
4403
"void coopMatLoadNV(out fcoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"
4404
"void coopMatLoadNV(out fcoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"
4405
"void coopMatLoadNV(out fcoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"
4406
"void coopMatLoadNV(out fcoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"
4407
"void coopMatLoadNV(out fcoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
4408
4409
"void coopMatStoreNV(fcoopmatNV m, volatile coherent float16_t[] buf, uint element, uint stride, bool colMajor);\n"
4410
"void coopMatStoreNV(fcoopmatNV m, volatile coherent float[] buf, uint element, uint stride, bool colMajor);\n"
4411
"void coopMatStoreNV(fcoopmatNV m, volatile coherent float64_t[] buf, uint element, uint stride, bool colMajor);\n"
4412
"void coopMatStoreNV(fcoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"
4413
"void coopMatStoreNV(fcoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"
4414
"void coopMatStoreNV(fcoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"
4415
"void coopMatStoreNV(fcoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"
4416
"void coopMatStoreNV(fcoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"
4417
"void coopMatStoreNV(fcoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
4418
4419
"fcoopmatNV coopMatMulAddNV(fcoopmatNV A, fcoopmatNV B, fcoopmatNV C);\n"
4420
"void coopMatLoadNV(out icoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"
4421
"void coopMatLoadNV(out icoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"
4422
"void coopMatLoadNV(out icoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"
4423
"void coopMatLoadNV(out icoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"
4424
"void coopMatLoadNV(out icoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"
4425
"void coopMatLoadNV(out icoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"
4426
"void coopMatLoadNV(out icoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"
4427
"void coopMatLoadNV(out icoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"
4428
"void coopMatLoadNV(out icoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"
4429
"void coopMatLoadNV(out icoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"
4430
"void coopMatLoadNV(out icoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"
4431
"void coopMatLoadNV(out icoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
4432
4433
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"
4434
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"
4435
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"
4436
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"
4437
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"
4438
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"
4439
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"
4440
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"
4441
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"
4442
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"
4443
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"
4444
"void coopMatLoadNV(out ucoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
4445
4446
"void coopMatStoreNV(icoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"
4447
"void coopMatStoreNV(icoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"
4448
"void coopMatStoreNV(icoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"
4449
"void coopMatStoreNV(icoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"
4450
"void coopMatStoreNV(icoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"
4451
"void coopMatStoreNV(icoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"
4452
"void coopMatStoreNV(icoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"
4453
"void coopMatStoreNV(icoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"
4454
"void coopMatStoreNV(icoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"
4455
"void coopMatStoreNV(icoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"
4456
"void coopMatStoreNV(icoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"
4457
"void coopMatStoreNV(icoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
4458
4459
"void coopMatStoreNV(ucoopmatNV m, volatile coherent int8_t[] buf, uint element, uint stride, bool colMajor);\n"
4460
"void coopMatStoreNV(ucoopmatNV m, volatile coherent int16_t[] buf, uint element, uint stride, bool colMajor);\n"
4461
"void coopMatStoreNV(ucoopmatNV m, volatile coherent int[] buf, uint element, uint stride, bool colMajor);\n"
4462
"void coopMatStoreNV(ucoopmatNV m, volatile coherent int64_t[] buf, uint element, uint stride, bool colMajor);\n"
4463
"void coopMatStoreNV(ucoopmatNV m, volatile coherent ivec2[] buf, uint element, uint stride, bool colMajor);\n"
4464
"void coopMatStoreNV(ucoopmatNV m, volatile coherent ivec4[] buf, uint element, uint stride, bool colMajor);\n"
4465
"void coopMatStoreNV(ucoopmatNV m, volatile coherent uint8_t[] buf, uint element, uint stride, bool colMajor);\n"
4466
"void coopMatStoreNV(ucoopmatNV m, volatile coherent uint16_t[] buf, uint element, uint stride, bool colMajor);\n"
4467
"void coopMatStoreNV(ucoopmatNV m, volatile coherent uint[] buf, uint element, uint stride, bool colMajor);\n"
4468
"void coopMatStoreNV(ucoopmatNV m, volatile coherent uint64_t[] buf, uint element, uint stride, bool colMajor);\n"
4469
"void coopMatStoreNV(ucoopmatNV m, volatile coherent uvec2[] buf, uint element, uint stride, bool colMajor);\n"
4470
"void coopMatStoreNV(ucoopmatNV m, volatile coherent uvec4[] buf, uint element, uint stride, bool colMajor);\n"
4471
4472
"icoopmatNV coopMatMulAddNV(icoopmatNV A, icoopmatNV B, icoopmatNV C);\n"
4473
"ucoopmatNV coopMatMulAddNV(ucoopmatNV A, ucoopmatNV B, ucoopmatNV C);\n"
4474
);
4475
4476
std::string cooperativeMatrixFuncs =
4477
"void coopMatLoad(out coopmat m, volatile coherent int8_t[] buf, uint element, uint stride, int matrixLayout);\n"
4478
"void coopMatLoad(out coopmat m, volatile coherent int16_t[] buf, uint element, uint stride, int matrixLayout);\n"
4479
"void coopMatLoad(out coopmat m, volatile coherent int32_t[] buf, uint element, uint stride, int matrixLayout);\n"
4480
"void coopMatLoad(out coopmat m, volatile coherent int64_t[] buf, uint element, uint stride, int matrixLayout);\n"
4481
"void coopMatLoad(out coopmat m, volatile coherent uint8_t[] buf, uint element, uint stride, int matrixLayout);\n"
4482
"void coopMatLoad(out coopmat m, volatile coherent uint16_t[] buf, uint element, uint stride, int matrixLayout);\n"
4483
"void coopMatLoad(out coopmat m, volatile coherent uint32_t[] buf, uint element, uint stride, int matrixLayout);\n"
4484
"void coopMatLoad(out coopmat m, volatile coherent uint64_t[] buf, uint element, uint stride, int matrixLayout);\n"
4485
"void coopMatLoad(out coopmat m, volatile coherent float16_t[] buf, uint element, uint stride, int matrixLayout);\n"
4486
"void coopMatLoad(out coopmat m, volatile coherent float[] buf, uint element, uint stride, int matrixLayout);\n"
4487
"void coopMatLoad(out coopmat m, volatile coherent float64_t[] buf, uint element, uint stride, int matrixLayout);\n"
4488
4489
"void coopMatLoad(out coopmat m, volatile coherent i8vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4490
"void coopMatLoad(out coopmat m, volatile coherent i16vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4491
"void coopMatLoad(out coopmat m, volatile coherent i32vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4492
"void coopMatLoad(out coopmat m, volatile coherent i64vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4493
"void coopMatLoad(out coopmat m, volatile coherent u8vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4494
"void coopMatLoad(out coopmat m, volatile coherent u16vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4495
"void coopMatLoad(out coopmat m, volatile coherent u32vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4496
"void coopMatLoad(out coopmat m, volatile coherent u64vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4497
"void coopMatLoad(out coopmat m, volatile coherent f16vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4498
"void coopMatLoad(out coopmat m, volatile coherent f32vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4499
"void coopMatLoad(out coopmat m, volatile coherent f64vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4500
4501
"void coopMatLoad(out coopmat m, volatile coherent i8vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4502
"void coopMatLoad(out coopmat m, volatile coherent i16vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4503
"void coopMatLoad(out coopmat m, volatile coherent i32vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4504
"void coopMatLoad(out coopmat m, volatile coherent i64vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4505
"void coopMatLoad(out coopmat m, volatile coherent u8vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4506
"void coopMatLoad(out coopmat m, volatile coherent u16vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4507
"void coopMatLoad(out coopmat m, volatile coherent u32vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4508
"void coopMatLoad(out coopmat m, volatile coherent u64vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4509
"void coopMatLoad(out coopmat m, volatile coherent f16vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4510
"void coopMatLoad(out coopmat m, volatile coherent f32vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4511
"void coopMatLoad(out coopmat m, volatile coherent f64vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4512
4513
"void coopMatStore(coopmat m, volatile coherent int8_t[] buf, uint element, uint stride, int matrixLayout);\n"
4514
"void coopMatStore(coopmat m, volatile coherent int16_t[] buf, uint element, uint stride, int matrixLayout);\n"
4515
"void coopMatStore(coopmat m, volatile coherent int32_t[] buf, uint element, uint stride, int matrixLayout);\n"
4516
"void coopMatStore(coopmat m, volatile coherent int64_t[] buf, uint element, uint stride, int matrixLayout);\n"
4517
"void coopMatStore(coopmat m, volatile coherent uint8_t[] buf, uint element, uint stride, int matrixLayout);\n"
4518
"void coopMatStore(coopmat m, volatile coherent uint16_t[] buf, uint element, uint stride, int matrixLayout);\n"
4519
"void coopMatStore(coopmat m, volatile coherent uint32_t[] buf, uint element, uint stride, int matrixLayout);\n"
4520
"void coopMatStore(coopmat m, volatile coherent uint64_t[] buf, uint element, uint stride, int matrixLayout);\n"
4521
"void coopMatStore(coopmat m, volatile coherent float16_t[] buf, uint element, uint stride, int matrixLayout);\n"
4522
"void coopMatStore(coopmat m, volatile coherent float[] buf, uint element, uint stride, int matrixLayout);\n"
4523
"void coopMatStore(coopmat m, volatile coherent float64_t[] buf, uint element, uint stride, int matrixLayout);\n"
4524
4525
"void coopMatStore(coopmat m, volatile coherent i8vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4526
"void coopMatStore(coopmat m, volatile coherent i16vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4527
"void coopMatStore(coopmat m, volatile coherent i32vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4528
"void coopMatStore(coopmat m, volatile coherent i64vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4529
"void coopMatStore(coopmat m, volatile coherent u8vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4530
"void coopMatStore(coopmat m, volatile coherent u16vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4531
"void coopMatStore(coopmat m, volatile coherent u32vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4532
"void coopMatStore(coopmat m, volatile coherent u64vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4533
"void coopMatStore(coopmat m, volatile coherent f16vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4534
"void coopMatStore(coopmat m, volatile coherent f32vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4535
"void coopMatStore(coopmat m, volatile coherent f64vec2[] buf, uint element, uint stride, int matrixLayout);\n"
4536
4537
"void coopMatStore(coopmat m, volatile coherent i8vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4538
"void coopMatStore(coopmat m, volatile coherent i16vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4539
"void coopMatStore(coopmat m, volatile coherent i32vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4540
"void coopMatStore(coopmat m, volatile coherent i64vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4541
"void coopMatStore(coopmat m, volatile coherent u8vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4542
"void coopMatStore(coopmat m, volatile coherent u16vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4543
"void coopMatStore(coopmat m, volatile coherent u32vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4544
"void coopMatStore(coopmat m, volatile coherent u64vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4545
"void coopMatStore(coopmat m, volatile coherent f16vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4546
"void coopMatStore(coopmat m, volatile coherent f32vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4547
"void coopMatStore(coopmat m, volatile coherent f64vec4[] buf, uint element, uint stride, int matrixLayout);\n"
4548
4549
"coopmat coopMatMulAdd(coopmat A, coopmat B, coopmat C);\n"
4550
"coopmat coopMatMulAdd(coopmat A, coopmat B, coopmat C, int matrixOperands);\n";
4551
4552
commonBuiltins.append(cooperativeMatrixFuncs.c_str());
4553
4554
commonBuiltins.append(
4555
"const int gl_MatrixUseA = 0;\n"
4556
"const int gl_MatrixUseB = 1;\n"
4557
"const int gl_MatrixUseAccumulator = 2;\n"
4558
"const int gl_MatrixOperandsSaturatingAccumulation = 0x10;\n"
4559
"const int gl_CooperativeMatrixLayoutRowMajor = 0;\n"
4560
"const int gl_CooperativeMatrixLayoutColumnMajor = 1;\n"
4561
"\n"
4562
);
4563
}
4564
4565
//============================================================================
4566
//
4567
// Prototypes for built-in functions seen by fragment shaders only.
4568
//
4569
//============================================================================
4570
4571
//
4572
// Original-style texture Functions with bias.
4573
//
4574
if (spvVersion.spv == 0 && (profile != EEsProfile || version == 100)) {
4575
stageBuiltins[EShLangFragment].append(
4576
"vec4 texture2D(sampler2D, vec2, float);"
4577
"vec4 texture2DProj(sampler2D, vec3, float);"
4578
"vec4 texture2DProj(sampler2D, vec4, float);"
4579
"vec4 texture3D(sampler3D, vec3, float);" // OES_texture_3D
4580
"vec4 texture3DProj(sampler3D, vec4, float);" // OES_texture_3D
4581
"vec4 textureCube(samplerCube, vec3, float);"
4582
4583
"\n");
4584
}
4585
if (spvVersion.spv == 0 && (profile != EEsProfile && version > 100)) {
4586
stageBuiltins[EShLangFragment].append(
4587
"vec4 texture1D(sampler1D, float, float);"
4588
"vec4 texture1DProj(sampler1D, vec2, float);"
4589
"vec4 texture1DProj(sampler1D, vec4, float);"
4590
"vec4 shadow1D(sampler1DShadow, vec3, float);"
4591
"vec4 shadow2D(sampler2DShadow, vec3, float);"
4592
"vec4 shadow1DProj(sampler1DShadow, vec4, float);"
4593
"vec4 shadow2DProj(sampler2DShadow, vec4, float);"
4594
4595
"\n");
4596
}
4597
if (spvVersion.spv == 0 && profile == EEsProfile) {
4598
stageBuiltins[EShLangFragment].append(
4599
"vec4 texture2DLodEXT(sampler2D, vec2, float);" // GL_EXT_shader_texture_lod
4600
"vec4 texture2DProjLodEXT(sampler2D, vec3, float);" // GL_EXT_shader_texture_lod
4601
"vec4 texture2DProjLodEXT(sampler2D, vec4, float);" // GL_EXT_shader_texture_lod
4602
"vec4 textureCubeLodEXT(samplerCube, vec3, float);" // GL_EXT_shader_texture_lod
4603
4604
"\n");
4605
}
4606
4607
// GL_EXT_shader_tile_image
4608
if (spvVersion.vulkan > 0) {
4609
stageBuiltins[EShLangFragment].append(
4610
"lowp uint stencilAttachmentReadEXT();"
4611
"lowp uint stencilAttachmentReadEXT(int);"
4612
"highp float depthAttachmentReadEXT();"
4613
"highp float depthAttachmentReadEXT(int);"
4614
"\n");
4615
stageBuiltins[EShLangFragment].append(
4616
"vec4 colorAttachmentReadEXT(attachmentEXT);"
4617
"vec4 colorAttachmentReadEXT(attachmentEXT, int);"
4618
"ivec4 colorAttachmentReadEXT(iattachmentEXT);"
4619
"ivec4 colorAttachmentReadEXT(iattachmentEXT, int);"
4620
"uvec4 colorAttachmentReadEXT(uattachmentEXT);"
4621
"uvec4 colorAttachmentReadEXT(uattachmentEXT, int);"
4622
"\n");
4623
}
4624
4625
// GL_ARB_derivative_control
4626
if (profile != EEsProfile && version >= 400) {
4627
stageBuiltins[EShLangFragment].append(derivativeControls);
4628
stageBuiltins[EShLangFragment].append("\n");
4629
}
4630
4631
// GL_OES_shader_multisample_interpolation
4632
if ((profile == EEsProfile && version >= 310) ||
4633
(profile != EEsProfile && version >= 400)) {
4634
stageBuiltins[EShLangFragment].append(
4635
"float interpolateAtCentroid(float);"
4636
"vec2 interpolateAtCentroid(vec2);"
4637
"vec3 interpolateAtCentroid(vec3);"
4638
"vec4 interpolateAtCentroid(vec4);"
4639
4640
"float interpolateAtSample(float, int);"
4641
"vec2 interpolateAtSample(vec2, int);"
4642
"vec3 interpolateAtSample(vec3, int);"
4643
"vec4 interpolateAtSample(vec4, int);"
4644
4645
"float interpolateAtOffset(float, vec2);"
4646
"vec2 interpolateAtOffset(vec2, vec2);"
4647
"vec3 interpolateAtOffset(vec3, vec2);"
4648
"vec4 interpolateAtOffset(vec4, vec2);"
4649
4650
"\n");
4651
}
4652
4653
stageBuiltins[EShLangFragment].append(
4654
"void beginInvocationInterlockARB(void);"
4655
"void endInvocationInterlockARB(void);");
4656
4657
stageBuiltins[EShLangFragment].append(
4658
"bool helperInvocationEXT();"
4659
"\n");
4660
4661
// GL_AMD_shader_explicit_vertex_parameter
4662
if (profile != EEsProfile && version >= 450) {
4663
stageBuiltins[EShLangFragment].append(
4664
"float interpolateAtVertexAMD(float, uint);"
4665
"vec2 interpolateAtVertexAMD(vec2, uint);"
4666
"vec3 interpolateAtVertexAMD(vec3, uint);"
4667
"vec4 interpolateAtVertexAMD(vec4, uint);"
4668
4669
"int interpolateAtVertexAMD(int, uint);"
4670
"ivec2 interpolateAtVertexAMD(ivec2, uint);"
4671
"ivec3 interpolateAtVertexAMD(ivec3, uint);"
4672
"ivec4 interpolateAtVertexAMD(ivec4, uint);"
4673
4674
"uint interpolateAtVertexAMD(uint, uint);"
4675
"uvec2 interpolateAtVertexAMD(uvec2, uint);"
4676
"uvec3 interpolateAtVertexAMD(uvec3, uint);"
4677
"uvec4 interpolateAtVertexAMD(uvec4, uint);"
4678
4679
"float16_t interpolateAtVertexAMD(float16_t, uint);"
4680
"f16vec2 interpolateAtVertexAMD(f16vec2, uint);"
4681
"f16vec3 interpolateAtVertexAMD(f16vec3, uint);"
4682
"f16vec4 interpolateAtVertexAMD(f16vec4, uint);"
4683
4684
"\n");
4685
}
4686
4687
// GL_AMD_gpu_shader_half_float
4688
if (profile != EEsProfile && version >= 450) {
4689
stageBuiltins[EShLangFragment].append(derivativesAndControl16bits);
4690
stageBuiltins[EShLangFragment].append("\n");
4691
4692
stageBuiltins[EShLangFragment].append(
4693
"float16_t interpolateAtCentroid(float16_t);"
4694
"f16vec2 interpolateAtCentroid(f16vec2);"
4695
"f16vec3 interpolateAtCentroid(f16vec3);"
4696
"f16vec4 interpolateAtCentroid(f16vec4);"
4697
4698
"float16_t interpolateAtSample(float16_t, int);"
4699
"f16vec2 interpolateAtSample(f16vec2, int);"
4700
"f16vec3 interpolateAtSample(f16vec3, int);"
4701
"f16vec4 interpolateAtSample(f16vec4, int);"
4702
4703
"float16_t interpolateAtOffset(float16_t, f16vec2);"
4704
"f16vec2 interpolateAtOffset(f16vec2, f16vec2);"
4705
"f16vec3 interpolateAtOffset(f16vec3, f16vec2);"
4706
"f16vec4 interpolateAtOffset(f16vec4, f16vec2);"
4707
4708
"\n");
4709
}
4710
4711
// GL_ARB_shader_clock& GL_EXT_shader_realtime_clock
4712
if (profile != EEsProfile && version >= 450) {
4713
commonBuiltins.append(
4714
"uvec2 clock2x32ARB();"
4715
"uint64_t clockARB();"
4716
"uvec2 clockRealtime2x32EXT();"
4717
"uint64_t clockRealtimeEXT();"
4718
"\n");
4719
}
4720
4721
// GL_AMD_shader_fragment_mask
4722
if (profile != EEsProfile && version >= 450 && spvVersion.vulkan > 0) {
4723
stageBuiltins[EShLangFragment].append(
4724
"uint fragmentMaskFetchAMD(subpassInputMS);"
4725
"uint fragmentMaskFetchAMD(isubpassInputMS);"
4726
"uint fragmentMaskFetchAMD(usubpassInputMS);"
4727
4728
"vec4 fragmentFetchAMD(subpassInputMS, uint);"
4729
"ivec4 fragmentFetchAMD(isubpassInputMS, uint);"
4730
"uvec4 fragmentFetchAMD(usubpassInputMS, uint);"
4731
4732
"\n");
4733
}
4734
4735
// Builtins for GL_NV_ray_tracing/GL_NV_ray_tracing_motion_blur/GL_EXT_ray_tracing/GL_EXT_ray_query/
4736
// GL_NV_shader_invocation_reorder/GL_KHR_ray_tracing_position_Fetch
4737
if (profile != EEsProfile && version >= 460) {
4738
commonBuiltins.append("void rayQueryInitializeEXT(rayQueryEXT, accelerationStructureEXT, uint, uint, vec3, float, vec3, float);"
4739
"void rayQueryTerminateEXT(rayQueryEXT);"
4740
"void rayQueryGenerateIntersectionEXT(rayQueryEXT, float);"
4741
"void rayQueryConfirmIntersectionEXT(rayQueryEXT);"
4742
"bool rayQueryProceedEXT(rayQueryEXT);"
4743
"uint rayQueryGetIntersectionTypeEXT(rayQueryEXT, bool);"
4744
"float rayQueryGetRayTMinEXT(rayQueryEXT);"
4745
"uint rayQueryGetRayFlagsEXT(rayQueryEXT);"
4746
"vec3 rayQueryGetWorldRayOriginEXT(rayQueryEXT);"
4747
"vec3 rayQueryGetWorldRayDirectionEXT(rayQueryEXT);"
4748
"float rayQueryGetIntersectionTEXT(rayQueryEXT, bool);"
4749
"int rayQueryGetIntersectionInstanceCustomIndexEXT(rayQueryEXT, bool);"
4750
"int rayQueryGetIntersectionInstanceIdEXT(rayQueryEXT, bool);"
4751
"uint rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT(rayQueryEXT, bool);"
4752
"int rayQueryGetIntersectionGeometryIndexEXT(rayQueryEXT, bool);"
4753
"int rayQueryGetIntersectionPrimitiveIndexEXT(rayQueryEXT, bool);"
4754
"vec2 rayQueryGetIntersectionBarycentricsEXT(rayQueryEXT, bool);"
4755
"bool rayQueryGetIntersectionFrontFaceEXT(rayQueryEXT, bool);"
4756
"bool rayQueryGetIntersectionCandidateAABBOpaqueEXT(rayQueryEXT);"
4757
"vec3 rayQueryGetIntersectionObjectRayDirectionEXT(rayQueryEXT, bool);"
4758
"vec3 rayQueryGetIntersectionObjectRayOriginEXT(rayQueryEXT, bool);"
4759
"mat4x3 rayQueryGetIntersectionObjectToWorldEXT(rayQueryEXT, bool);"
4760
"mat4x3 rayQueryGetIntersectionWorldToObjectEXT(rayQueryEXT, bool);"
4761
"void rayQueryGetIntersectionTriangleVertexPositionsEXT(rayQueryEXT, bool, out vec3[3]);"
4762
"\n");
4763
4764
stageBuiltins[EShLangRayGen].append(
4765
"void traceNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
4766
"void traceRayMotionNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"
4767
"void traceRayEXT(accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
4768
"void executeCallableNV(uint, int);"
4769
"void executeCallableEXT(uint, int);"
4770
"void hitObjectTraceRayNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
4771
"void hitObjectTraceRayMotionNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"
4772
"void hitObjectRecordHitNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,int);"
4773
"void hitObjectRecordHitMotionNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,float,int);"
4774
"void hitObjectRecordHitWithIndexNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,int);"
4775
"void hitObjectRecordHitWithIndexMotionNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,float,int);"
4776
"void hitObjectRecordMissNV(hitObjectNV,uint,vec3,float,vec3,float);"
4777
"void hitObjectRecordMissMotionNV(hitObjectNV,uint,vec3,float,vec3,float,float);"
4778
"void hitObjectRecordEmptyNV(hitObjectNV);"
4779
"void hitObjectExecuteShaderNV(hitObjectNV,int);"
4780
"bool hitObjectIsEmptyNV(hitObjectNV);"
4781
"bool hitObjectIsMissNV(hitObjectNV);"
4782
"bool hitObjectIsHitNV(hitObjectNV);"
4783
"float hitObjectGetRayTMinNV(hitObjectNV);"
4784
"float hitObjectGetRayTMaxNV(hitObjectNV);"
4785
"vec3 hitObjectGetWorldRayOriginNV(hitObjectNV);"
4786
"vec3 hitObjectGetWorldRayDirectionNV(hitObjectNV);"
4787
"vec3 hitObjectGetObjectRayOriginNV(hitObjectNV);"
4788
"vec3 hitObjectGetObjectRayDirectionNV(hitObjectNV);"
4789
"mat4x3 hitObjectGetWorldToObjectNV(hitObjectNV);"
4790
"mat4x3 hitObjectGetObjectToWorldNV(hitObjectNV);"
4791
"int hitObjectGetInstanceCustomIndexNV(hitObjectNV);"
4792
"int hitObjectGetInstanceIdNV(hitObjectNV);"
4793
"int hitObjectGetGeometryIndexNV(hitObjectNV);"
4794
"int hitObjectGetPrimitiveIndexNV(hitObjectNV);"
4795
"uint hitObjectGetHitKindNV(hitObjectNV);"
4796
"void hitObjectGetAttributesNV(hitObjectNV,int);"
4797
"float hitObjectGetCurrentTimeNV(hitObjectNV);"
4798
"uint hitObjectGetShaderBindingTableRecordIndexNV(hitObjectNV);"
4799
"uvec2 hitObjectGetShaderRecordBufferHandleNV(hitObjectNV);"
4800
"void reorderThreadNV(uint, uint);"
4801
"void reorderThreadNV(hitObjectNV);"
4802
"void reorderThreadNV(hitObjectNV, uint, uint);"
4803
"vec3 fetchMicroTriangleVertexPositionNV(accelerationStructureEXT, int, int, int, ivec2);"
4804
"vec2 fetchMicroTriangleVertexBarycentricNV(accelerationStructureEXT, int, int, int, ivec2);"
4805
"\n");
4806
stageBuiltins[EShLangIntersect].append(
4807
"bool reportIntersectionNV(float, uint);"
4808
"bool reportIntersectionEXT(float, uint);"
4809
"\n");
4810
stageBuiltins[EShLangAnyHit].append(
4811
"void ignoreIntersectionNV();"
4812
"void terminateRayNV();"
4813
"\n");
4814
stageBuiltins[EShLangClosestHit].append(
4815
"void traceNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
4816
"void traceRayMotionNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"
4817
"void traceRayEXT(accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
4818
"void executeCallableNV(uint, int);"
4819
"void executeCallableEXT(uint, int);"
4820
"void hitObjectTraceRayNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
4821
"void hitObjectTraceRayMotionNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"
4822
"void hitObjectRecordHitNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,int);"
4823
"void hitObjectRecordHitMotionNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,float,int);"
4824
"void hitObjectRecordHitWithIndexNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,int);"
4825
"void hitObjectRecordHitWithIndexMotionNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,float,int);"
4826
"void hitObjectRecordMissNV(hitObjectNV, uint, vec3, float, vec3, float);"
4827
"void hitObjectRecordMissMotionNV(hitObjectNV,uint,vec3,float,vec3,float,float);"
4828
"void hitObjectRecordEmptyNV(hitObjectNV);"
4829
"void hitObjectExecuteShaderNV(hitObjectNV, int);"
4830
"bool hitObjectIsEmptyNV(hitObjectNV);"
4831
"bool hitObjectIsMissNV(hitObjectNV);"
4832
"bool hitObjectIsHitNV(hitObjectNV);"
4833
"float hitObjectGetRayTMinNV(hitObjectNV);"
4834
"float hitObjectGetRayTMaxNV(hitObjectNV);"
4835
"vec3 hitObjectGetWorldRayOriginNV(hitObjectNV);"
4836
"vec3 hitObjectGetWorldRayDirectionNV(hitObjectNV);"
4837
"vec3 hitObjectGetObjectRayOriginNV(hitObjectNV);"
4838
"vec3 hitObjectGetObjectRayDirectionNV(hitObjectNV);"
4839
"mat4x3 hitObjectGetWorldToObjectNV(hitObjectNV);"
4840
"mat4x3 hitObjectGetObjectToWorldNV(hitObjectNV);"
4841
"int hitObjectGetInstanceCustomIndexNV(hitObjectNV);"
4842
"int hitObjectGetInstanceIdNV(hitObjectNV);"
4843
"int hitObjectGetGeometryIndexNV(hitObjectNV);"
4844
"int hitObjectGetPrimitiveIndexNV(hitObjectNV);"
4845
"uint hitObjectGetHitKindNV(hitObjectNV);"
4846
"void hitObjectGetAttributesNV(hitObjectNV,int);"
4847
"float hitObjectGetCurrentTimeNV(hitObjectNV);"
4848
"uint hitObjectGetShaderBindingTableRecordIndexNV(hitObjectNV);"
4849
"uvec2 hitObjectGetShaderRecordBufferHandleNV(hitObjectNV);"
4850
"\n");
4851
stageBuiltins[EShLangMiss].append(
4852
"void traceNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
4853
"void traceRayMotionNV(accelerationStructureNV,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"
4854
"void traceRayEXT(accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
4855
"void executeCallableNV(uint, int);"
4856
"void executeCallableEXT(uint, int);"
4857
"void hitObjectTraceRayNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,int);"
4858
"void hitObjectTraceRayMotionNV(hitObjectNV,accelerationStructureEXT,uint,uint,uint,uint,uint,vec3,float,vec3,float,float,int);"
4859
"void hitObjectRecordHitNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,int);"
4860
"void hitObjectRecordHitMotionNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,uint,vec3,float,vec3,float,float,int);"
4861
"void hitObjectRecordHitWithIndexNV(hitObjectNV,accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,int);"
4862
"void hitObjectRecordHitWithIndexMotionNV(hitObjectNV, accelerationStructureEXT,int,int,int,uint,uint,vec3,float,vec3,float,float,int);"
4863
"void hitObjectRecordMissNV(hitObjectNV, uint, vec3, float, vec3, float);"
4864
"void hitObjectRecordMissMotionNV(hitObjectNV,uint,vec3,float,vec3,float,float);"
4865
"void hitObjectRecordEmptyNV(hitObjectNV);"
4866
"void hitObjectExecuteShaderNV(hitObjectNV, int);"
4867
"bool hitObjectIsEmptyNV(hitObjectNV);"
4868
"bool hitObjectIsMissNV(hitObjectNV);"
4869
"bool hitObjectIsHitNV(hitObjectNV);"
4870
"float hitObjectGetRayTMinNV(hitObjectNV);"
4871
"float hitObjectGetRayTMaxNV(hitObjectNV);"
4872
"vec3 hitObjectGetWorldRayOriginNV(hitObjectNV);"
4873
"vec3 hitObjectGetWorldRayDirectionNV(hitObjectNV);"
4874
"vec3 hitObjectGetObjectRayOriginNV(hitObjectNV);"
4875
"vec3 hitObjectGetObjectRayDirectionNV(hitObjectNV);"
4876
"mat4x3 hitObjectGetWorldToObjectNV(hitObjectNV);"
4877
"mat4x3 hitObjectGetObjectToWorldNV(hitObjectNV);"
4878
"int hitObjectGetInstanceCustomIndexNV(hitObjectNV);"
4879
"int hitObjectGetInstanceIdNV(hitObjectNV);"
4880
"int hitObjectGetGeometryIndexNV(hitObjectNV);"
4881
"int hitObjectGetPrimitiveIndexNV(hitObjectNV);"
4882
"uint hitObjectGetHitKindNV(hitObjectNV);"
4883
"void hitObjectGetAttributesNV(hitObjectNV,int);"
4884
"float hitObjectGetCurrentTimeNV(hitObjectNV);"
4885
"uint hitObjectGetShaderBindingTableRecordIndexNV(hitObjectNV);"
4886
"uvec2 hitObjectGetShaderRecordBufferHandleNV(hitObjectNV);"
4887
"\n");
4888
stageBuiltins[EShLangCallable].append(
4889
"void executeCallableNV(uint, int);"
4890
"void executeCallableEXT(uint, int);"
4891
"\n");
4892
}
4893
4894
//E_SPV_NV_compute_shader_derivatives
4895
if ((profile == EEsProfile && version >= 320) || (profile != EEsProfile && version >= 450)) {
4896
stageBuiltins[EShLangCompute].append(derivativeControls);
4897
stageBuiltins[EShLangCompute].append("\n");
4898
}
4899
if (profile != EEsProfile && version >= 450) {
4900
stageBuiltins[EShLangCompute].append(derivativesAndControl16bits);
4901
stageBuiltins[EShLangCompute].append(derivativesAndControl64bits);
4902
stageBuiltins[EShLangCompute].append("\n");
4903
}
4904
4905
// Builtins for GL_NV_mesh_shader
4906
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
4907
stageBuiltins[EShLangMesh].append(
4908
"void writePackedPrimitiveIndices4x8NV(uint, uint);"
4909
"\n");
4910
}
4911
// Builtins for GL_EXT_mesh_shader
4912
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
4913
// Builtins for GL_EXT_mesh_shader
4914
stageBuiltins[EShLangTask].append(
4915
"void EmitMeshTasksEXT(uint, uint, uint);"
4916
"\n");
4917
4918
stageBuiltins[EShLangMesh].append(
4919
"void SetMeshOutputsEXT(uint, uint);"
4920
"\n");
4921
}
4922
// Builtins for GL_NV_displacement_micromap
4923
if ((profile != EEsProfile && version >= 460) || (profile == EEsProfile && version >= 320)) {
4924
stageBuiltins[EShLangMesh].append(
4925
"vec3 fetchMicroTriangleVertexPositionNV(accelerationStructureEXT, int, int, int, ivec2);"
4926
"vec2 fetchMicroTriangleVertexBarycentricNV(accelerationStructureEXT, int, int, int, ivec2);"
4927
"\n");
4928
4929
stageBuiltins[EShLangCompute].append(
4930
"vec3 fetchMicroTriangleVertexPositionNV(accelerationStructureEXT, int, int, int, ivec2);"
4931
"vec2 fetchMicroTriangleVertexBarycentricNV(accelerationStructureEXT, int, int, int, ivec2);"
4932
"\n");
4933
4934
}
4935
4936
4937
//============================================================================
4938
//
4939
// Standard Uniforms
4940
//
4941
//============================================================================
4942
4943
//
4944
// Depth range in window coordinates, p. 33
4945
//
4946
if (spvVersion.spv == 0) {
4947
commonBuiltins.append(
4948
"struct gl_DepthRangeParameters {"
4949
);
4950
if (profile == EEsProfile) {
4951
commonBuiltins.append(
4952
"highp float near;" // n
4953
"highp float far;" // f
4954
"highp float diff;" // f - n
4955
);
4956
} else {
4957
commonBuiltins.append(
4958
"float near;" // n
4959
"float far;" // f
4960
"float diff;" // f - n
4961
);
4962
}
4963
4964
commonBuiltins.append(
4965
"};"
4966
"uniform gl_DepthRangeParameters gl_DepthRange;"
4967
"\n");
4968
}
4969
4970
if (spvVersion.spv == 0 && IncludeLegacy(version, profile, spvVersion)) {
4971
//
4972
// Matrix state. p. 31, 32, 37, 39, 40.
4973
//
4974
commonBuiltins.append(
4975
"uniform mat4 gl_ModelViewMatrix;"
4976
"uniform mat4 gl_ProjectionMatrix;"
4977
"uniform mat4 gl_ModelViewProjectionMatrix;"
4978
4979
//
4980
// Derived matrix state that provides inverse and transposed versions
4981
// of the matrices above.
4982
//
4983
"uniform mat3 gl_NormalMatrix;"
4984
4985
"uniform mat4 gl_ModelViewMatrixInverse;"
4986
"uniform mat4 gl_ProjectionMatrixInverse;"
4987
"uniform mat4 gl_ModelViewProjectionMatrixInverse;"
4988
4989
"uniform mat4 gl_ModelViewMatrixTranspose;"
4990
"uniform mat4 gl_ProjectionMatrixTranspose;"
4991
"uniform mat4 gl_ModelViewProjectionMatrixTranspose;"
4992
4993
"uniform mat4 gl_ModelViewMatrixInverseTranspose;"
4994
"uniform mat4 gl_ProjectionMatrixInverseTranspose;"
4995
"uniform mat4 gl_ModelViewProjectionMatrixInverseTranspose;"
4996
4997
//
4998
// Normal scaling p. 39.
4999
//
5000
"uniform float gl_NormalScale;"
5001
5002
//
5003
// Point Size, p. 66, 67.
5004
//
5005
"struct gl_PointParameters {"
5006
"float size;"
5007
"float sizeMin;"
5008
"float sizeMax;"
5009
"float fadeThresholdSize;"
5010
"float distanceConstantAttenuation;"
5011
"float distanceLinearAttenuation;"
5012
"float distanceQuadraticAttenuation;"
5013
"};"
5014
5015
"uniform gl_PointParameters gl_Point;"
5016
5017
//
5018
// Material State p. 50, 55.
5019
//
5020
"struct gl_MaterialParameters {"
5021
"vec4 emission;" // Ecm
5022
"vec4 ambient;" // Acm
5023
"vec4 diffuse;" // Dcm
5024
"vec4 specular;" // Scm
5025
"float shininess;" // Srm
5026
"};"
5027
"uniform gl_MaterialParameters gl_FrontMaterial;"
5028
"uniform gl_MaterialParameters gl_BackMaterial;"
5029
5030
//
5031
// Light State p 50, 53, 55.
5032
//
5033
"struct gl_LightSourceParameters {"
5034
"vec4 ambient;" // Acli
5035
"vec4 diffuse;" // Dcli
5036
"vec4 specular;" // Scli
5037
"vec4 position;" // Ppli
5038
"vec4 halfVector;" // Derived: Hi
5039
"vec3 spotDirection;" // Sdli
5040
"float spotExponent;" // Srli
5041
"float spotCutoff;" // Crli
5042
// (range: [0.0,90.0], 180.0)
5043
"float spotCosCutoff;" // Derived: cos(Crli)
5044
// (range: [1.0,0.0],-1.0)
5045
"float constantAttenuation;" // K0
5046
"float linearAttenuation;" // K1
5047
"float quadraticAttenuation;"// K2
5048
"};"
5049
5050
"struct gl_LightModelParameters {"
5051
"vec4 ambient;" // Acs
5052
"};"
5053
5054
"uniform gl_LightModelParameters gl_LightModel;"
5055
5056
//
5057
// Derived state from products of light and material.
5058
//
5059
"struct gl_LightModelProducts {"
5060
"vec4 sceneColor;" // Derived. Ecm + Acm * Acs
5061
"};"
5062
5063
"uniform gl_LightModelProducts gl_FrontLightModelProduct;"
5064
"uniform gl_LightModelProducts gl_BackLightModelProduct;"
5065
5066
"struct gl_LightProducts {"
5067
"vec4 ambient;" // Acm * Acli
5068
"vec4 diffuse;" // Dcm * Dcli
5069
"vec4 specular;" // Scm * Scli
5070
"};"
5071
5072
//
5073
// Fog p. 161
5074
//
5075
"struct gl_FogParameters {"
5076
"vec4 color;"
5077
"float density;"
5078
"float start;"
5079
"float end;"
5080
"float scale;" // 1 / (gl_FogEnd - gl_FogStart)
5081
"};"
5082
5083
"uniform gl_FogParameters gl_Fog;"
5084
5085
"\n");
5086
}
5087
5088
//============================================================================
5089
//
5090
// Define the interface to the compute shader.
5091
//
5092
//============================================================================
5093
5094
if ((profile != EEsProfile && version >= 420) ||
5095
(profile == EEsProfile && version >= 310)) {
5096
stageBuiltins[EShLangCompute].append(
5097
"in highp uvec3 gl_NumWorkGroups;"
5098
"const highp uvec3 gl_WorkGroupSize = uvec3(1,1,1);"
5099
5100
"in highp uvec3 gl_WorkGroupID;"
5101
"in highp uvec3 gl_LocalInvocationID;"
5102
5103
"in highp uvec3 gl_GlobalInvocationID;"
5104
"in highp uint gl_LocalInvocationIndex;"
5105
5106
"\n");
5107
}
5108
5109
if ((profile != EEsProfile && version >= 140) ||
5110
(profile == EEsProfile && version >= 310)) {
5111
stageBuiltins[EShLangCompute].append(
5112
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
5113
"\n");
5114
}
5115
5116
//============================================================================
5117
//
5118
// Define the interface to the mesh/task shader.
5119
//
5120
//============================================================================
5121
5122
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
5123
// per-vertex attributes
5124
stageBuiltins[EShLangMesh].append(
5125
"out gl_MeshPerVertexNV {"
5126
"vec4 gl_Position;"
5127
"float gl_PointSize;"
5128
"float gl_ClipDistance[];"
5129
"float gl_CullDistance[];"
5130
"perviewNV vec4 gl_PositionPerViewNV[];"
5131
"perviewNV float gl_ClipDistancePerViewNV[][];"
5132
"perviewNV float gl_CullDistancePerViewNV[][];"
5133
"} gl_MeshVerticesNV[];"
5134
);
5135
5136
// per-primitive attributes
5137
stageBuiltins[EShLangMesh].append(
5138
"perprimitiveNV out gl_MeshPerPrimitiveNV {"
5139
"int gl_PrimitiveID;"
5140
"int gl_Layer;"
5141
"int gl_ViewportIndex;"
5142
"int gl_ViewportMask[];"
5143
"perviewNV int gl_LayerPerViewNV[];"
5144
"perviewNV int gl_ViewportMaskPerViewNV[][];"
5145
"} gl_MeshPrimitivesNV[];"
5146
);
5147
5148
stageBuiltins[EShLangMesh].append(
5149
"out uint gl_PrimitiveCountNV;"
5150
"out uint gl_PrimitiveIndicesNV[];"
5151
5152
"in uint gl_MeshViewCountNV;"
5153
"in uint gl_MeshViewIndicesNV[4];"
5154
5155
"const highp uvec3 gl_WorkGroupSize = uvec3(1,1,1);"
5156
5157
"in highp uvec3 gl_WorkGroupID;"
5158
"in highp uvec3 gl_LocalInvocationID;"
5159
5160
"in highp uvec3 gl_GlobalInvocationID;"
5161
"in highp uint gl_LocalInvocationIndex;"
5162
"\n");
5163
5164
// GL_EXT_mesh_shader
5165
stageBuiltins[EShLangMesh].append(
5166
"out uint gl_PrimitivePointIndicesEXT[];"
5167
"out uvec2 gl_PrimitiveLineIndicesEXT[];"
5168
"out uvec3 gl_PrimitiveTriangleIndicesEXT[];"
5169
"in highp uvec3 gl_NumWorkGroups;"
5170
"\n");
5171
5172
// per-vertex attributes
5173
stageBuiltins[EShLangMesh].append(
5174
"out gl_MeshPerVertexEXT {"
5175
"vec4 gl_Position;"
5176
"float gl_PointSize;"
5177
"float gl_ClipDistance[];"
5178
"float gl_CullDistance[];"
5179
"} gl_MeshVerticesEXT[];"
5180
);
5181
5182
// per-primitive attributes
5183
stageBuiltins[EShLangMesh].append(
5184
"perprimitiveEXT out gl_MeshPerPrimitiveEXT {"
5185
"int gl_PrimitiveID;"
5186
"int gl_Layer;"
5187
"int gl_ViewportIndex;"
5188
"bool gl_CullPrimitiveEXT;"
5189
"int gl_PrimitiveShadingRateEXT;"
5190
"} gl_MeshPrimitivesEXT[];"
5191
);
5192
5193
stageBuiltins[EShLangTask].append(
5194
"out uint gl_TaskCountNV;"
5195
5196
"const highp uvec3 gl_WorkGroupSize = uvec3(1,1,1);"
5197
5198
"in highp uvec3 gl_WorkGroupID;"
5199
"in highp uvec3 gl_LocalInvocationID;"
5200
5201
"in highp uvec3 gl_GlobalInvocationID;"
5202
"in highp uint gl_LocalInvocationIndex;"
5203
5204
"in uint gl_MeshViewCountNV;"
5205
"in uint gl_MeshViewIndicesNV[4];"
5206
"in highp uvec3 gl_NumWorkGroups;"
5207
"\n");
5208
}
5209
5210
if (profile != EEsProfile && version >= 450) {
5211
stageBuiltins[EShLangMesh].append(
5212
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
5213
"in int gl_DrawIDARB;" // GL_ARB_shader_draw_parameters
5214
"in int gl_ViewIndex;" // GL_EXT_multiview
5215
"\n");
5216
5217
stageBuiltins[EShLangTask].append(
5218
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
5219
"in int gl_DrawIDARB;" // GL_ARB_shader_draw_parameters
5220
"\n");
5221
5222
if (version >= 460) {
5223
stageBuiltins[EShLangMesh].append(
5224
"in int gl_DrawID;"
5225
"\n");
5226
5227
stageBuiltins[EShLangTask].append(
5228
"in int gl_DrawID;"
5229
"\n");
5230
}
5231
}
5232
5233
//============================================================================
5234
//
5235
// Define the interface to the vertex shader.
5236
//
5237
//============================================================================
5238
5239
if (profile != EEsProfile) {
5240
if (version < 130) {
5241
stageBuiltins[EShLangVertex].append(
5242
"attribute vec4 gl_Color;"
5243
"attribute vec4 gl_SecondaryColor;"
5244
"attribute vec3 gl_Normal;"
5245
"attribute vec4 gl_Vertex;"
5246
"attribute vec4 gl_MultiTexCoord0;"
5247
"attribute vec4 gl_MultiTexCoord1;"
5248
"attribute vec4 gl_MultiTexCoord2;"
5249
"attribute vec4 gl_MultiTexCoord3;"
5250
"attribute vec4 gl_MultiTexCoord4;"
5251
"attribute vec4 gl_MultiTexCoord5;"
5252
"attribute vec4 gl_MultiTexCoord6;"
5253
"attribute vec4 gl_MultiTexCoord7;"
5254
"attribute float gl_FogCoord;"
5255
"\n");
5256
} else if (IncludeLegacy(version, profile, spvVersion)) {
5257
stageBuiltins[EShLangVertex].append(
5258
"in vec4 gl_Color;"
5259
"in vec4 gl_SecondaryColor;"
5260
"in vec3 gl_Normal;"
5261
"in vec4 gl_Vertex;"
5262
"in vec4 gl_MultiTexCoord0;"
5263
"in vec4 gl_MultiTexCoord1;"
5264
"in vec4 gl_MultiTexCoord2;"
5265
"in vec4 gl_MultiTexCoord3;"
5266
"in vec4 gl_MultiTexCoord4;"
5267
"in vec4 gl_MultiTexCoord5;"
5268
"in vec4 gl_MultiTexCoord6;"
5269
"in vec4 gl_MultiTexCoord7;"
5270
"in float gl_FogCoord;"
5271
"\n");
5272
}
5273
5274
if (version < 150) {
5275
if (version < 130) {
5276
stageBuiltins[EShLangVertex].append(
5277
" vec4 gl_ClipVertex;" // needs qualifier fixed later
5278
"varying vec4 gl_FrontColor;"
5279
"varying vec4 gl_BackColor;"
5280
"varying vec4 gl_FrontSecondaryColor;"
5281
"varying vec4 gl_BackSecondaryColor;"
5282
"varying vec4 gl_TexCoord[];"
5283
"varying float gl_FogFragCoord;"
5284
"\n");
5285
} else if (IncludeLegacy(version, profile, spvVersion)) {
5286
stageBuiltins[EShLangVertex].append(
5287
" vec4 gl_ClipVertex;" // needs qualifier fixed later
5288
"out vec4 gl_FrontColor;"
5289
"out vec4 gl_BackColor;"
5290
"out vec4 gl_FrontSecondaryColor;"
5291
"out vec4 gl_BackSecondaryColor;"
5292
"out vec4 gl_TexCoord[];"
5293
"out float gl_FogFragCoord;"
5294
"\n");
5295
}
5296
stageBuiltins[EShLangVertex].append(
5297
"vec4 gl_Position;" // needs qualifier fixed later
5298
"float gl_PointSize;" // needs qualifier fixed later
5299
);
5300
5301
if (version == 130 || version == 140)
5302
stageBuiltins[EShLangVertex].append(
5303
"out float gl_ClipDistance[];"
5304
);
5305
} else {
5306
// version >= 150
5307
stageBuiltins[EShLangVertex].append(
5308
"out gl_PerVertex {"
5309
"vec4 gl_Position;" // needs qualifier fixed later
5310
"float gl_PointSize;" // needs qualifier fixed later
5311
"float gl_ClipDistance[];"
5312
);
5313
if (IncludeLegacy(version, profile, spvVersion))
5314
stageBuiltins[EShLangVertex].append(
5315
"vec4 gl_ClipVertex;" // needs qualifier fixed later
5316
"vec4 gl_FrontColor;"
5317
"vec4 gl_BackColor;"
5318
"vec4 gl_FrontSecondaryColor;"
5319
"vec4 gl_BackSecondaryColor;"
5320
"vec4 gl_TexCoord[];"
5321
"float gl_FogFragCoord;"
5322
);
5323
if (version >= 450)
5324
stageBuiltins[EShLangVertex].append(
5325
"float gl_CullDistance[];"
5326
);
5327
stageBuiltins[EShLangVertex].append(
5328
"};"
5329
"\n");
5330
}
5331
if (version >= 130 && spvVersion.vulkan == 0)
5332
stageBuiltins[EShLangVertex].append(
5333
"int gl_VertexID;" // needs qualifier fixed later
5334
);
5335
if (spvVersion.vulkan == 0)
5336
stageBuiltins[EShLangVertex].append(
5337
"int gl_InstanceID;" // needs qualifier fixed later
5338
);
5339
if (spvVersion.vulkan > 0 && version >= 140)
5340
stageBuiltins[EShLangVertex].append(
5341
"in int gl_VertexIndex;"
5342
"in int gl_InstanceIndex;"
5343
);
5344
5345
if (spvVersion.vulkan > 0 && version >= 140 && spvVersion.vulkanRelaxed)
5346
stageBuiltins[EShLangVertex].append(
5347
"in int gl_VertexID;" // declare with 'in' qualifier
5348
"in int gl_InstanceID;"
5349
);
5350
5351
if (version >= 440) {
5352
stageBuiltins[EShLangVertex].append(
5353
"in int gl_BaseVertexARB;"
5354
"in int gl_BaseInstanceARB;"
5355
"in int gl_DrawIDARB;"
5356
);
5357
}
5358
if (version >= 410) {
5359
stageBuiltins[EShLangVertex].append(
5360
"out int gl_ViewportIndex;"
5361
"out int gl_Layer;"
5362
);
5363
}
5364
if (version >= 460) {
5365
stageBuiltins[EShLangVertex].append(
5366
"in int gl_BaseVertex;"
5367
"in int gl_BaseInstance;"
5368
"in int gl_DrawID;"
5369
);
5370
}
5371
5372
if (version >= 430)
5373
stageBuiltins[EShLangVertex].append(
5374
"out int gl_ViewportMask[];" // GL_NV_viewport_array2
5375
);
5376
5377
if (version >= 450)
5378
stageBuiltins[EShLangVertex].append(
5379
"out int gl_SecondaryViewportMaskNV[];" // GL_NV_stereo_view_rendering
5380
"out vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering
5381
"out vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes
5382
"out int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes
5383
);
5384
} else {
5385
// ES profile
5386
if (version == 100) {
5387
stageBuiltins[EShLangVertex].append(
5388
"highp vec4 gl_Position;" // needs qualifier fixed later
5389
"mediump float gl_PointSize;" // needs qualifier fixed later
5390
"highp int gl_InstanceID;" // needs qualifier fixed later
5391
);
5392
} else {
5393
if (spvVersion.vulkan == 0 || spvVersion.vulkanRelaxed)
5394
stageBuiltins[EShLangVertex].append(
5395
"in highp int gl_VertexID;" // needs qualifier fixed later
5396
"in highp int gl_InstanceID;" // needs qualifier fixed later
5397
);
5398
if (spvVersion.vulkan > 0)
5399
stageBuiltins[EShLangVertex].append(
5400
"in highp int gl_VertexIndex;"
5401
"in highp int gl_InstanceIndex;"
5402
);
5403
if (version < 310)
5404
stageBuiltins[EShLangVertex].append(
5405
"highp vec4 gl_Position;" // needs qualifier fixed later
5406
"highp float gl_PointSize;" // needs qualifier fixed later
5407
);
5408
else
5409
stageBuiltins[EShLangVertex].append(
5410
"out gl_PerVertex {"
5411
"highp vec4 gl_Position;" // needs qualifier fixed later
5412
"highp float gl_PointSize;" // needs qualifier fixed later
5413
"};"
5414
);
5415
}
5416
}
5417
5418
if ((profile != EEsProfile && version >= 140) ||
5419
(profile == EEsProfile && version >= 310)) {
5420
stageBuiltins[EShLangVertex].append(
5421
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
5422
"in highp int gl_ViewIndex;" // GL_EXT_multiview
5423
"\n");
5424
}
5425
5426
if (version >= 300 /* both ES and non-ES */) {
5427
stageBuiltins[EShLangVertex].append(
5428
"in highp uint gl_ViewID_OVR;" // GL_OVR_multiview, GL_OVR_multiview2
5429
"\n");
5430
}
5431
5432
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) {
5433
stageBuiltins[EShLangVertex].append(
5434
"out highp int gl_PrimitiveShadingRateEXT;" // GL_EXT_fragment_shading_rate
5435
"\n");
5436
}
5437
5438
//============================================================================
5439
//
5440
// Define the interface to the geometry shader.
5441
//
5442
//============================================================================
5443
5444
if (profile == ECoreProfile || profile == ECompatibilityProfile) {
5445
stageBuiltins[EShLangGeometry].append(
5446
"in gl_PerVertex {"
5447
"vec4 gl_Position;"
5448
"float gl_PointSize;"
5449
"float gl_ClipDistance[];"
5450
);
5451
if (profile == ECompatibilityProfile)
5452
stageBuiltins[EShLangGeometry].append(
5453
"vec4 gl_ClipVertex;"
5454
"vec4 gl_FrontColor;"
5455
"vec4 gl_BackColor;"
5456
"vec4 gl_FrontSecondaryColor;"
5457
"vec4 gl_BackSecondaryColor;"
5458
"vec4 gl_TexCoord[];"
5459
"float gl_FogFragCoord;"
5460
);
5461
if (version >= 450)
5462
stageBuiltins[EShLangGeometry].append(
5463
"float gl_CullDistance[];"
5464
"vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering
5465
"vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes
5466
);
5467
stageBuiltins[EShLangGeometry].append(
5468
"} gl_in[];"
5469
5470
"in int gl_PrimitiveIDIn;"
5471
"out gl_PerVertex {"
5472
"vec4 gl_Position;"
5473
"float gl_PointSize;"
5474
"float gl_ClipDistance[];"
5475
"\n");
5476
if (profile == ECompatibilityProfile && version >= 400)
5477
stageBuiltins[EShLangGeometry].append(
5478
"vec4 gl_ClipVertex;"
5479
"vec4 gl_FrontColor;"
5480
"vec4 gl_BackColor;"
5481
"vec4 gl_FrontSecondaryColor;"
5482
"vec4 gl_BackSecondaryColor;"
5483
"vec4 gl_TexCoord[];"
5484
"float gl_FogFragCoord;"
5485
);
5486
if (version >= 450)
5487
stageBuiltins[EShLangGeometry].append(
5488
"float gl_CullDistance[];"
5489
);
5490
stageBuiltins[EShLangGeometry].append(
5491
"};"
5492
5493
"out int gl_PrimitiveID;"
5494
"out int gl_Layer;");
5495
5496
if (version >= 150)
5497
stageBuiltins[EShLangGeometry].append(
5498
"out int gl_ViewportIndex;"
5499
);
5500
5501
if (profile == ECompatibilityProfile && version < 400)
5502
stageBuiltins[EShLangGeometry].append(
5503
"out vec4 gl_ClipVertex;"
5504
);
5505
5506
if (version >= 400)
5507
stageBuiltins[EShLangGeometry].append(
5508
"in int gl_InvocationID;"
5509
);
5510
5511
if (version >= 430)
5512
stageBuiltins[EShLangGeometry].append(
5513
"out int gl_ViewportMask[];" // GL_NV_viewport_array2
5514
);
5515
5516
if (version >= 450)
5517
stageBuiltins[EShLangGeometry].append(
5518
"out int gl_SecondaryViewportMaskNV[];" // GL_NV_stereo_view_rendering
5519
"out vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering
5520
"out vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes
5521
"out int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes
5522
);
5523
5524
stageBuiltins[EShLangGeometry].append("\n");
5525
} else if (profile == EEsProfile && version >= 310) {
5526
stageBuiltins[EShLangGeometry].append(
5527
"in gl_PerVertex {"
5528
"highp vec4 gl_Position;"
5529
"highp float gl_PointSize;"
5530
"} gl_in[];"
5531
"\n"
5532
"in highp int gl_PrimitiveIDIn;"
5533
"in highp int gl_InvocationID;"
5534
"\n"
5535
"out gl_PerVertex {"
5536
"highp vec4 gl_Position;"
5537
"highp float gl_PointSize;"
5538
"};"
5539
"\n"
5540
"out highp int gl_PrimitiveID;"
5541
"out highp int gl_Layer;"
5542
"\n"
5543
);
5544
}
5545
5546
if ((profile != EEsProfile && version >= 140) ||
5547
(profile == EEsProfile && version >= 310)) {
5548
stageBuiltins[EShLangGeometry].append(
5549
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
5550
"in highp int gl_ViewIndex;" // GL_EXT_multiview
5551
"\n");
5552
}
5553
5554
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) {
5555
stageBuiltins[EShLangGeometry].append(
5556
"out highp int gl_PrimitiveShadingRateEXT;" // GL_EXT_fragment_shading_rate
5557
"\n");
5558
}
5559
5560
//============================================================================
5561
//
5562
// Define the interface to the tessellation control shader.
5563
//
5564
//============================================================================
5565
5566
if (profile != EEsProfile && version >= 150) {
5567
// Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below,
5568
// as it depends on the resource sizing of gl_MaxPatchVertices.
5569
5570
stageBuiltins[EShLangTessControl].append(
5571
"in int gl_PatchVerticesIn;"
5572
"in int gl_PrimitiveID;"
5573
"in int gl_InvocationID;"
5574
5575
"out gl_PerVertex {"
5576
"vec4 gl_Position;"
5577
"float gl_PointSize;"
5578
"float gl_ClipDistance[];"
5579
);
5580
if (profile == ECompatibilityProfile)
5581
stageBuiltins[EShLangTessControl].append(
5582
"vec4 gl_ClipVertex;"
5583
"vec4 gl_FrontColor;"
5584
"vec4 gl_BackColor;"
5585
"vec4 gl_FrontSecondaryColor;"
5586
"vec4 gl_BackSecondaryColor;"
5587
"vec4 gl_TexCoord[];"
5588
"float gl_FogFragCoord;"
5589
);
5590
if (version >= 450)
5591
stageBuiltins[EShLangTessControl].append(
5592
"float gl_CullDistance[];"
5593
);
5594
if (version >= 430)
5595
stageBuiltins[EShLangTessControl].append(
5596
"int gl_ViewportMask[];" // GL_NV_viewport_array2
5597
);
5598
if (version >= 450)
5599
stageBuiltins[EShLangTessControl].append(
5600
"vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering
5601
"int gl_SecondaryViewportMaskNV[];" // GL_NV_stereo_view_rendering
5602
"vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes
5603
"int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes
5604
);
5605
stageBuiltins[EShLangTessControl].append(
5606
"} gl_out[];"
5607
5608
"patch out float gl_TessLevelOuter[4];"
5609
"patch out float gl_TessLevelInner[2];"
5610
"\n");
5611
5612
if (version >= 410)
5613
stageBuiltins[EShLangTessControl].append(
5614
"out int gl_ViewportIndex;"
5615
"out int gl_Layer;"
5616
"\n");
5617
5618
} else {
5619
// Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below,
5620
// as it depends on the resource sizing of gl_MaxPatchVertices.
5621
5622
stageBuiltins[EShLangTessControl].append(
5623
"in highp int gl_PatchVerticesIn;"
5624
"in highp int gl_PrimitiveID;"
5625
"in highp int gl_InvocationID;"
5626
5627
"out gl_PerVertex {"
5628
"highp vec4 gl_Position;"
5629
"highp float gl_PointSize;"
5630
);
5631
stageBuiltins[EShLangTessControl].append(
5632
"} gl_out[];"
5633
5634
"patch out highp float gl_TessLevelOuter[4];"
5635
"patch out highp float gl_TessLevelInner[2];"
5636
"patch out highp vec4 gl_BoundingBoxOES[2];"
5637
"patch out highp vec4 gl_BoundingBoxEXT[2];"
5638
"\n");
5639
if (profile == EEsProfile && version >= 320) {
5640
stageBuiltins[EShLangTessControl].append(
5641
"patch out highp vec4 gl_BoundingBox[2];"
5642
"\n"
5643
);
5644
}
5645
}
5646
5647
if ((profile != EEsProfile && version >= 140) ||
5648
(profile == EEsProfile && version >= 310)) {
5649
stageBuiltins[EShLangTessControl].append(
5650
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
5651
"in highp int gl_ViewIndex;" // GL_EXT_multiview
5652
"\n");
5653
}
5654
5655
//============================================================================
5656
//
5657
// Define the interface to the tessellation evaluation shader.
5658
//
5659
//============================================================================
5660
5661
if (profile != EEsProfile && version >= 150) {
5662
// Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below,
5663
// as it depends on the resource sizing of gl_MaxPatchVertices.
5664
5665
stageBuiltins[EShLangTessEvaluation].append(
5666
"in int gl_PatchVerticesIn;"
5667
"in int gl_PrimitiveID;"
5668
"in vec3 gl_TessCoord;"
5669
5670
"patch in float gl_TessLevelOuter[4];"
5671
"patch in float gl_TessLevelInner[2];"
5672
5673
"out gl_PerVertex {"
5674
"vec4 gl_Position;"
5675
"float gl_PointSize;"
5676
"float gl_ClipDistance[];"
5677
);
5678
if (version >= 400 && profile == ECompatibilityProfile)
5679
stageBuiltins[EShLangTessEvaluation].append(
5680
"vec4 gl_ClipVertex;"
5681
"vec4 gl_FrontColor;"
5682
"vec4 gl_BackColor;"
5683
"vec4 gl_FrontSecondaryColor;"
5684
"vec4 gl_BackSecondaryColor;"
5685
"vec4 gl_TexCoord[];"
5686
"float gl_FogFragCoord;"
5687
);
5688
if (version >= 450)
5689
stageBuiltins[EShLangTessEvaluation].append(
5690
"float gl_CullDistance[];"
5691
);
5692
stageBuiltins[EShLangTessEvaluation].append(
5693
"};"
5694
"\n");
5695
5696
if (version >= 410)
5697
stageBuiltins[EShLangTessEvaluation].append(
5698
"out int gl_ViewportIndex;"
5699
"out int gl_Layer;"
5700
"\n");
5701
5702
if (version >= 430)
5703
stageBuiltins[EShLangTessEvaluation].append(
5704
"out int gl_ViewportMask[];" // GL_NV_viewport_array2
5705
);
5706
5707
if (version >= 450)
5708
stageBuiltins[EShLangTessEvaluation].append(
5709
"out vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering
5710
"out int gl_SecondaryViewportMaskNV[];" // GL_NV_stereo_view_rendering
5711
"out vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes
5712
"out int gl_ViewportMaskPerViewNV[];" // GL_NVX_multiview_per_view_attributes
5713
);
5714
5715
} else if (profile == EEsProfile && version >= 310) {
5716
// Note: "in gl_PerVertex {...} gl_in[gl_MaxPatchVertices];" is declared in initialize() below,
5717
// as it depends on the resource sizing of gl_MaxPatchVertices.
5718
5719
stageBuiltins[EShLangTessEvaluation].append(
5720
"in highp int gl_PatchVerticesIn;"
5721
"in highp int gl_PrimitiveID;"
5722
"in highp vec3 gl_TessCoord;"
5723
5724
"patch in highp float gl_TessLevelOuter[4];"
5725
"patch in highp float gl_TessLevelInner[2];"
5726
5727
"out gl_PerVertex {"
5728
"highp vec4 gl_Position;"
5729
"highp float gl_PointSize;"
5730
);
5731
stageBuiltins[EShLangTessEvaluation].append(
5732
"};"
5733
"\n");
5734
}
5735
5736
if ((profile != EEsProfile && version >= 140) ||
5737
(profile == EEsProfile && version >= 310)) {
5738
stageBuiltins[EShLangTessEvaluation].append(
5739
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
5740
"in highp int gl_ViewIndex;" // GL_EXT_multiview
5741
"\n");
5742
}
5743
5744
//============================================================================
5745
//
5746
// Define the interface to the fragment shader.
5747
//
5748
//============================================================================
5749
5750
if (profile != EEsProfile) {
5751
5752
stageBuiltins[EShLangFragment].append(
5753
"vec4 gl_FragCoord;" // needs qualifier fixed later
5754
"bool gl_FrontFacing;" // needs qualifier fixed later
5755
"float gl_FragDepth;" // needs qualifier fixed later
5756
);
5757
if (version >= 120)
5758
stageBuiltins[EShLangFragment].append(
5759
"vec2 gl_PointCoord;" // needs qualifier fixed later
5760
);
5761
if (version >= 140)
5762
stageBuiltins[EShLangFragment].append(
5763
"out int gl_FragStencilRefARB;"
5764
);
5765
if (IncludeLegacy(version, profile, spvVersion) || (! ForwardCompatibility && version < 420))
5766
stageBuiltins[EShLangFragment].append(
5767
"vec4 gl_FragColor;" // needs qualifier fixed later
5768
);
5769
5770
if (version < 130) {
5771
stageBuiltins[EShLangFragment].append(
5772
"varying vec4 gl_Color;"
5773
"varying vec4 gl_SecondaryColor;"
5774
"varying vec4 gl_TexCoord[];"
5775
"varying float gl_FogFragCoord;"
5776
);
5777
} else {
5778
stageBuiltins[EShLangFragment].append(
5779
"in float gl_ClipDistance[];"
5780
);
5781
5782
if (IncludeLegacy(version, profile, spvVersion)) {
5783
if (version < 150)
5784
stageBuiltins[EShLangFragment].append(
5785
"in float gl_FogFragCoord;"
5786
"in vec4 gl_TexCoord[];"
5787
"in vec4 gl_Color;"
5788
"in vec4 gl_SecondaryColor;"
5789
);
5790
else
5791
stageBuiltins[EShLangFragment].append(
5792
"in gl_PerFragment {"
5793
"in float gl_FogFragCoord;"
5794
"in vec4 gl_TexCoord[];"
5795
"in vec4 gl_Color;"
5796
"in vec4 gl_SecondaryColor;"
5797
"};"
5798
);
5799
}
5800
}
5801
5802
if (version >= 150)
5803
stageBuiltins[EShLangFragment].append(
5804
"flat in int gl_PrimitiveID;"
5805
);
5806
5807
if (version >= 130) { // ARB_sample_shading
5808
stageBuiltins[EShLangFragment].append(
5809
"flat in int gl_SampleID;"
5810
" in vec2 gl_SamplePosition;"
5811
" out int gl_SampleMask[];"
5812
);
5813
5814
if (spvVersion.spv == 0) {
5815
stageBuiltins[EShLangFragment].append(
5816
"uniform int gl_NumSamples;"
5817
);
5818
}
5819
}
5820
5821
if (version >= 400)
5822
stageBuiltins[EShLangFragment].append(
5823
"flat in int gl_SampleMaskIn[];"
5824
);
5825
5826
if (version >= 430)
5827
stageBuiltins[EShLangFragment].append(
5828
"flat in int gl_Layer;"
5829
"flat in int gl_ViewportIndex;"
5830
);
5831
5832
if (version >= 450)
5833
stageBuiltins[EShLangFragment].append(
5834
"in float gl_CullDistance[];"
5835
"bool gl_HelperInvocation;" // needs qualifier fixed later
5836
);
5837
5838
if (version >= 450)
5839
stageBuiltins[EShLangFragment].append( // GL_EXT_fragment_invocation_density
5840
"flat in ivec2 gl_FragSizeEXT;"
5841
"flat in int gl_FragInvocationCountEXT;"
5842
);
5843
5844
if (version >= 450)
5845
stageBuiltins[EShLangFragment].append(
5846
"in vec2 gl_BaryCoordNoPerspAMD;"
5847
"in vec2 gl_BaryCoordNoPerspCentroidAMD;"
5848
"in vec2 gl_BaryCoordNoPerspSampleAMD;"
5849
"in vec2 gl_BaryCoordSmoothAMD;"
5850
"in vec2 gl_BaryCoordSmoothCentroidAMD;"
5851
"in vec2 gl_BaryCoordSmoothSampleAMD;"
5852
"in vec3 gl_BaryCoordPullModelAMD;"
5853
);
5854
5855
if (version >= 430)
5856
stageBuiltins[EShLangFragment].append(
5857
"in bool gl_FragFullyCoveredNV;"
5858
);
5859
if (version >= 450)
5860
stageBuiltins[EShLangFragment].append(
5861
"flat in ivec2 gl_FragmentSizeNV;" // GL_NV_shading_rate_image
5862
"flat in int gl_InvocationsPerPixelNV;"
5863
"in vec3 gl_BaryCoordNV;" // GL_NV_fragment_shader_barycentric
5864
"in vec3 gl_BaryCoordNoPerspNV;"
5865
"in vec3 gl_BaryCoordEXT;" // GL_EXT_fragment_shader_barycentric
5866
"in vec3 gl_BaryCoordNoPerspEXT;"
5867
);
5868
5869
if (version >= 450)
5870
stageBuiltins[EShLangFragment].append(
5871
"flat in int gl_ShadingRateEXT;" // GL_EXT_fragment_shading_rate
5872
);
5873
5874
} else {
5875
// ES profile
5876
5877
if (version == 100) {
5878
stageBuiltins[EShLangFragment].append(
5879
"mediump vec4 gl_FragCoord;" // needs qualifier fixed later
5880
" bool gl_FrontFacing;" // needs qualifier fixed later
5881
"mediump vec4 gl_FragColor;" // needs qualifier fixed later
5882
"mediump vec2 gl_PointCoord;" // needs qualifier fixed later
5883
);
5884
}
5885
if (version >= 300) {
5886
stageBuiltins[EShLangFragment].append(
5887
"highp vec4 gl_FragCoord;" // needs qualifier fixed later
5888
" bool gl_FrontFacing;" // needs qualifier fixed later
5889
"mediump vec2 gl_PointCoord;" // needs qualifier fixed later
5890
"highp float gl_FragDepth;" // needs qualifier fixed later
5891
);
5892
}
5893
if (version >= 310) {
5894
stageBuiltins[EShLangFragment].append(
5895
"bool gl_HelperInvocation;" // needs qualifier fixed later
5896
"flat in highp int gl_PrimitiveID;" // needs qualifier fixed later
5897
"flat in highp int gl_Layer;" // needs qualifier fixed later
5898
);
5899
5900
stageBuiltins[EShLangFragment].append( // GL_OES_sample_variables
5901
"flat in lowp int gl_SampleID;"
5902
" in mediump vec2 gl_SamplePosition;"
5903
"flat in highp int gl_SampleMaskIn[];"
5904
" out highp int gl_SampleMask[];"
5905
);
5906
if (spvVersion.spv == 0)
5907
stageBuiltins[EShLangFragment].append( // GL_OES_sample_variables
5908
"uniform lowp int gl_NumSamples;"
5909
);
5910
}
5911
stageBuiltins[EShLangFragment].append(
5912
"highp float gl_FragDepthEXT;" // GL_EXT_frag_depth
5913
);
5914
5915
if (version >= 310)
5916
stageBuiltins[EShLangFragment].append( // GL_EXT_fragment_invocation_density
5917
"flat in ivec2 gl_FragSizeEXT;"
5918
"flat in int gl_FragInvocationCountEXT;"
5919
);
5920
if (version >= 320)
5921
stageBuiltins[EShLangFragment].append( // GL_NV_shading_rate_image
5922
"flat in ivec2 gl_FragmentSizeNV;"
5923
"flat in int gl_InvocationsPerPixelNV;"
5924
);
5925
if (version >= 320)
5926
stageBuiltins[EShLangFragment].append(
5927
"in vec3 gl_BaryCoordNV;"
5928
"in vec3 gl_BaryCoordNoPerspNV;"
5929
"in vec3 gl_BaryCoordEXT;"
5930
"in vec3 gl_BaryCoordNoPerspEXT;"
5931
);
5932
if (version >= 310)
5933
stageBuiltins[EShLangFragment].append(
5934
"flat in highp int gl_ShadingRateEXT;" // GL_EXT_fragment_shading_rate
5935
);
5936
}
5937
5938
stageBuiltins[EShLangFragment].append("\n");
5939
5940
if (version >= 130)
5941
add2ndGenerationSamplingImaging(version, profile, spvVersion);
5942
5943
if ((profile != EEsProfile && version >= 140) ||
5944
(profile == EEsProfile && version >= 310)) {
5945
stageBuiltins[EShLangFragment].append(
5946
"flat in highp int gl_DeviceIndex;" // GL_EXT_device_group
5947
"flat in highp int gl_ViewIndex;" // GL_EXT_multiview
5948
"\n");
5949
}
5950
5951
if (version >= 300 /* both ES and non-ES */) {
5952
stageBuiltins[EShLangFragment].append(
5953
"flat in highp uint gl_ViewID_OVR;" // GL_OVR_multiview, GL_OVR_multiview2
5954
"\n");
5955
}
5956
5957
// GL_ARB_shader_ballot
5958
if (profile != EEsProfile && version >= 450) {
5959
const char* ballotDecls =
5960
"uniform uint gl_SubGroupSizeARB;"
5961
"in uint gl_SubGroupInvocationARB;"
5962
"in uint64_t gl_SubGroupEqMaskARB;"
5963
"in uint64_t gl_SubGroupGeMaskARB;"
5964
"in uint64_t gl_SubGroupGtMaskARB;"
5965
"in uint64_t gl_SubGroupLeMaskARB;"
5966
"in uint64_t gl_SubGroupLtMaskARB;"
5967
"\n";
5968
const char* rtBallotDecls =
5969
"uniform volatile uint gl_SubGroupSizeARB;"
5970
"in volatile uint gl_SubGroupInvocationARB;"
5971
"in volatile uint64_t gl_SubGroupEqMaskARB;"
5972
"in volatile uint64_t gl_SubGroupGeMaskARB;"
5973
"in volatile uint64_t gl_SubGroupGtMaskARB;"
5974
"in volatile uint64_t gl_SubGroupLeMaskARB;"
5975
"in volatile uint64_t gl_SubGroupLtMaskARB;"
5976
"\n";
5977
const char* fragmentBallotDecls =
5978
"uniform uint gl_SubGroupSizeARB;"
5979
"flat in uint gl_SubGroupInvocationARB;"
5980
"flat in uint64_t gl_SubGroupEqMaskARB;"
5981
"flat in uint64_t gl_SubGroupGeMaskARB;"
5982
"flat in uint64_t gl_SubGroupGtMaskARB;"
5983
"flat in uint64_t gl_SubGroupLeMaskARB;"
5984
"flat in uint64_t gl_SubGroupLtMaskARB;"
5985
"\n";
5986
stageBuiltins[EShLangVertex] .append(ballotDecls);
5987
stageBuiltins[EShLangTessControl] .append(ballotDecls);
5988
stageBuiltins[EShLangTessEvaluation].append(ballotDecls);
5989
stageBuiltins[EShLangGeometry] .append(ballotDecls);
5990
stageBuiltins[EShLangCompute] .append(ballotDecls);
5991
stageBuiltins[EShLangFragment] .append(fragmentBallotDecls);
5992
stageBuiltins[EShLangMesh] .append(ballotDecls);
5993
stageBuiltins[EShLangTask] .append(ballotDecls);
5994
stageBuiltins[EShLangRayGen] .append(rtBallotDecls);
5995
stageBuiltins[EShLangIntersect] .append(rtBallotDecls);
5996
// No volatile qualifier on these builtins in any-hit
5997
stageBuiltins[EShLangAnyHit] .append(ballotDecls);
5998
stageBuiltins[EShLangClosestHit] .append(rtBallotDecls);
5999
stageBuiltins[EShLangMiss] .append(rtBallotDecls);
6000
stageBuiltins[EShLangCallable] .append(rtBallotDecls);
6001
}
6002
6003
// GL_KHR_shader_subgroup
6004
if ((profile == EEsProfile && version >= 310) ||
6005
(profile != EEsProfile && version >= 140)) {
6006
const char* subgroupDecls =
6007
"in mediump uint gl_SubgroupSize;"
6008
"in mediump uint gl_SubgroupInvocationID;"
6009
"in highp uvec4 gl_SubgroupEqMask;"
6010
"in highp uvec4 gl_SubgroupGeMask;"
6011
"in highp uvec4 gl_SubgroupGtMask;"
6012
"in highp uvec4 gl_SubgroupLeMask;"
6013
"in highp uvec4 gl_SubgroupLtMask;"
6014
// GL_NV_shader_sm_builtins
6015
"in highp uint gl_WarpsPerSMNV;"
6016
"in highp uint gl_SMCountNV;"
6017
"in highp uint gl_WarpIDNV;"
6018
"in highp uint gl_SMIDNV;"
6019
// GL_ARM_shader_core_builtins
6020
"in highp uint gl_CoreIDARM;"
6021
"in highp uint gl_CoreCountARM;"
6022
"in highp uint gl_CoreMaxIDARM;"
6023
"in highp uint gl_WarpIDARM;"
6024
"in highp uint gl_WarpMaxIDARM;"
6025
"\n";
6026
const char* fragmentSubgroupDecls =
6027
"flat in mediump uint gl_SubgroupSize;"
6028
"flat in mediump uint gl_SubgroupInvocationID;"
6029
"flat in highp uvec4 gl_SubgroupEqMask;"
6030
"flat in highp uvec4 gl_SubgroupGeMask;"
6031
"flat in highp uvec4 gl_SubgroupGtMask;"
6032
"flat in highp uvec4 gl_SubgroupLeMask;"
6033
"flat in highp uvec4 gl_SubgroupLtMask;"
6034
// GL_NV_shader_sm_builtins
6035
"flat in highp uint gl_WarpsPerSMNV;"
6036
"flat in highp uint gl_SMCountNV;"
6037
"flat in highp uint gl_WarpIDNV;"
6038
"flat in highp uint gl_SMIDNV;"
6039
// GL_ARM_shader_core_builtins
6040
"flat in highp uint gl_CoreIDARM;"
6041
"flat in highp uint gl_CoreCountARM;"
6042
"flat in highp uint gl_CoreMaxIDARM;"
6043
"flat in highp uint gl_WarpIDARM;"
6044
"flat in highp uint gl_WarpMaxIDARM;"
6045
"\n";
6046
const char* computeSubgroupDecls =
6047
"in highp uint gl_NumSubgroups;"
6048
"in highp uint gl_SubgroupID;"
6049
"\n";
6050
// These builtins are volatile for RT stages
6051
const char* rtSubgroupDecls =
6052
"in mediump volatile uint gl_SubgroupSize;"
6053
"in mediump volatile uint gl_SubgroupInvocationID;"
6054
"in highp volatile uvec4 gl_SubgroupEqMask;"
6055
"in highp volatile uvec4 gl_SubgroupGeMask;"
6056
"in highp volatile uvec4 gl_SubgroupGtMask;"
6057
"in highp volatile uvec4 gl_SubgroupLeMask;"
6058
"in highp volatile uvec4 gl_SubgroupLtMask;"
6059
// GL_NV_shader_sm_builtins
6060
"in highp uint gl_WarpsPerSMNV;"
6061
"in highp uint gl_SMCountNV;"
6062
"in highp volatile uint gl_WarpIDNV;"
6063
"in highp volatile uint gl_SMIDNV;"
6064
// GL_ARM_shader_core_builtins
6065
"in highp uint gl_CoreIDARM;"
6066
"in highp uint gl_CoreCountARM;"
6067
"in highp uint gl_CoreMaxIDARM;"
6068
"in highp uint gl_WarpIDARM;"
6069
"in highp uint gl_WarpMaxIDARM;"
6070
"\n";
6071
6072
stageBuiltins[EShLangVertex] .append(subgroupDecls);
6073
stageBuiltins[EShLangTessControl] .append(subgroupDecls);
6074
stageBuiltins[EShLangTessEvaluation].append(subgroupDecls);
6075
stageBuiltins[EShLangGeometry] .append(subgroupDecls);
6076
stageBuiltins[EShLangCompute] .append(subgroupDecls);
6077
stageBuiltins[EShLangCompute] .append(computeSubgroupDecls);
6078
stageBuiltins[EShLangFragment] .append(fragmentSubgroupDecls);
6079
stageBuiltins[EShLangMesh] .append(subgroupDecls);
6080
stageBuiltins[EShLangMesh] .append(computeSubgroupDecls);
6081
stageBuiltins[EShLangTask] .append(subgroupDecls);
6082
stageBuiltins[EShLangTask] .append(computeSubgroupDecls);
6083
stageBuiltins[EShLangRayGen] .append(rtSubgroupDecls);
6084
stageBuiltins[EShLangIntersect] .append(rtSubgroupDecls);
6085
// No volatile qualifier on these builtins in any-hit
6086
stageBuiltins[EShLangAnyHit] .append(subgroupDecls);
6087
stageBuiltins[EShLangClosestHit] .append(rtSubgroupDecls);
6088
stageBuiltins[EShLangMiss] .append(rtSubgroupDecls);
6089
stageBuiltins[EShLangCallable] .append(rtSubgroupDecls);
6090
}
6091
6092
// GL_NV_ray_tracing/GL_EXT_ray_tracing
6093
if (profile != EEsProfile && version >= 460) {
6094
6095
const char *constRayFlags =
6096
"const uint gl_RayFlagsNoneNV = 0U;"
6097
"const uint gl_RayFlagsNoneEXT = 0U;"
6098
"const uint gl_RayFlagsOpaqueNV = 1U;"
6099
"const uint gl_RayFlagsOpaqueEXT = 1U;"
6100
"const uint gl_RayFlagsNoOpaqueNV = 2U;"
6101
"const uint gl_RayFlagsNoOpaqueEXT = 2U;"
6102
"const uint gl_RayFlagsTerminateOnFirstHitNV = 4U;"
6103
"const uint gl_RayFlagsTerminateOnFirstHitEXT = 4U;"
6104
"const uint gl_RayFlagsSkipClosestHitShaderNV = 8U;"
6105
"const uint gl_RayFlagsSkipClosestHitShaderEXT = 8U;"
6106
"const uint gl_RayFlagsCullBackFacingTrianglesNV = 16U;"
6107
"const uint gl_RayFlagsCullBackFacingTrianglesEXT = 16U;"
6108
"const uint gl_RayFlagsCullFrontFacingTrianglesNV = 32U;"
6109
"const uint gl_RayFlagsCullFrontFacingTrianglesEXT = 32U;"
6110
"const uint gl_RayFlagsCullOpaqueNV = 64U;"
6111
"const uint gl_RayFlagsCullOpaqueEXT = 64U;"
6112
"const uint gl_RayFlagsCullNoOpaqueNV = 128U;"
6113
"const uint gl_RayFlagsCullNoOpaqueEXT = 128U;"
6114
"const uint gl_RayFlagsSkipTrianglesEXT = 256U;"
6115
"const uint gl_RayFlagsSkipAABBEXT = 512U;"
6116
"const uint gl_RayFlagsForceOpacityMicromap2StateEXT = 1024U;"
6117
"const uint gl_HitKindFrontFacingTriangleEXT = 254U;"
6118
"const uint gl_HitKindBackFacingTriangleEXT = 255U;"
6119
"in uint gl_HitKindFrontFacingMicroTriangleNV;"
6120
"in uint gl_HitKindBackFacingMicroTriangleNV;"
6121
"\n";
6122
6123
const char *constRayQueryIntersection =
6124
"const uint gl_RayQueryCandidateIntersectionEXT = 0U;"
6125
"const uint gl_RayQueryCommittedIntersectionEXT = 1U;"
6126
"const uint gl_RayQueryCommittedIntersectionNoneEXT = 0U;"
6127
"const uint gl_RayQueryCommittedIntersectionTriangleEXT = 1U;"
6128
"const uint gl_RayQueryCommittedIntersectionGeneratedEXT = 2U;"
6129
"const uint gl_RayQueryCandidateIntersectionTriangleEXT = 0U;"
6130
"const uint gl_RayQueryCandidateIntersectionAABBEXT = 1U;"
6131
"\n";
6132
6133
const char *rayGenDecls =
6134
"in uvec3 gl_LaunchIDNV;"
6135
"in uvec3 gl_LaunchIDEXT;"
6136
"in uvec3 gl_LaunchSizeNV;"
6137
"in uvec3 gl_LaunchSizeEXT;"
6138
"\n";
6139
const char *intersectDecls =
6140
"in uvec3 gl_LaunchIDNV;"
6141
"in uvec3 gl_LaunchIDEXT;"
6142
"in uvec3 gl_LaunchSizeNV;"
6143
"in uvec3 gl_LaunchSizeEXT;"
6144
"in int gl_PrimitiveID;"
6145
"in int gl_InstanceID;"
6146
"in int gl_InstanceCustomIndexNV;"
6147
"in int gl_InstanceCustomIndexEXT;"
6148
"in int gl_GeometryIndexEXT;"
6149
"in vec3 gl_WorldRayOriginNV;"
6150
"in vec3 gl_WorldRayOriginEXT;"
6151
"in vec3 gl_WorldRayDirectionNV;"
6152
"in vec3 gl_WorldRayDirectionEXT;"
6153
"in vec3 gl_ObjectRayOriginNV;"
6154
"in vec3 gl_ObjectRayOriginEXT;"
6155
"in vec3 gl_ObjectRayDirectionNV;"
6156
"in vec3 gl_ObjectRayDirectionEXT;"
6157
"in float gl_RayTminNV;"
6158
"in float gl_RayTminEXT;"
6159
"in float gl_RayTmaxNV;"
6160
"in volatile float gl_RayTmaxEXT;"
6161
"in mat4x3 gl_ObjectToWorldNV;"
6162
"in mat4x3 gl_ObjectToWorldEXT;"
6163
"in mat3x4 gl_ObjectToWorld3x4EXT;"
6164
"in mat4x3 gl_WorldToObjectNV;"
6165
"in mat4x3 gl_WorldToObjectEXT;"
6166
"in mat3x4 gl_WorldToObject3x4EXT;"
6167
"in uint gl_IncomingRayFlagsNV;"
6168
"in uint gl_IncomingRayFlagsEXT;"
6169
"in float gl_CurrentRayTimeNV;"
6170
"in uint gl_CullMaskEXT;"
6171
"\n";
6172
const char *hitDecls =
6173
"in uvec3 gl_LaunchIDNV;"
6174
"in uvec3 gl_LaunchIDEXT;"
6175
"in uvec3 gl_LaunchSizeNV;"
6176
"in uvec3 gl_LaunchSizeEXT;"
6177
"in int gl_PrimitiveID;"
6178
"in int gl_InstanceID;"
6179
"in int gl_InstanceCustomIndexNV;"
6180
"in int gl_InstanceCustomIndexEXT;"
6181
"in int gl_GeometryIndexEXT;"
6182
"in vec3 gl_WorldRayOriginNV;"
6183
"in vec3 gl_WorldRayOriginEXT;"
6184
"in vec3 gl_WorldRayDirectionNV;"
6185
"in vec3 gl_WorldRayDirectionEXT;"
6186
"in vec3 gl_ObjectRayOriginNV;"
6187
"in vec3 gl_ObjectRayOriginEXT;"
6188
"in vec3 gl_ObjectRayDirectionNV;"
6189
"in vec3 gl_ObjectRayDirectionEXT;"
6190
"in float gl_RayTminNV;"
6191
"in float gl_RayTminEXT;"
6192
"in float gl_RayTmaxNV;"
6193
"in float gl_RayTmaxEXT;"
6194
"in float gl_HitTNV;"
6195
"in float gl_HitTEXT;"
6196
"in uint gl_HitKindNV;"
6197
"in uint gl_HitKindEXT;"
6198
"in mat4x3 gl_ObjectToWorldNV;"
6199
"in mat4x3 gl_ObjectToWorldEXT;"
6200
"in mat3x4 gl_ObjectToWorld3x4EXT;"
6201
"in mat4x3 gl_WorldToObjectNV;"
6202
"in mat4x3 gl_WorldToObjectEXT;"
6203
"in mat3x4 gl_WorldToObject3x4EXT;"
6204
"in uint gl_IncomingRayFlagsNV;"
6205
"in uint gl_IncomingRayFlagsEXT;"
6206
"in float gl_CurrentRayTimeNV;"
6207
"in uint gl_CullMaskEXT;"
6208
"in vec3 gl_HitTriangleVertexPositionsEXT[3];"
6209
"in vec3 gl_HitMicroTriangleVertexPositionsNV[3];"
6210
"in vec2 gl_HitMicroTriangleVertexBarycentricsNV[3];"
6211
"\n";
6212
6213
const char *missDecls =
6214
"in uvec3 gl_LaunchIDNV;"
6215
"in uvec3 gl_LaunchIDEXT;"
6216
"in uvec3 gl_LaunchSizeNV;"
6217
"in uvec3 gl_LaunchSizeEXT;"
6218
"in vec3 gl_WorldRayOriginNV;"
6219
"in vec3 gl_WorldRayOriginEXT;"
6220
"in vec3 gl_WorldRayDirectionNV;"
6221
"in vec3 gl_WorldRayDirectionEXT;"
6222
"in vec3 gl_ObjectRayOriginNV;"
6223
"in vec3 gl_ObjectRayDirectionNV;"
6224
"in float gl_RayTminNV;"
6225
"in float gl_RayTminEXT;"
6226
"in float gl_RayTmaxNV;"
6227
"in float gl_RayTmaxEXT;"
6228
"in uint gl_IncomingRayFlagsNV;"
6229
"in uint gl_IncomingRayFlagsEXT;"
6230
"in float gl_CurrentRayTimeNV;"
6231
"in uint gl_CullMaskEXT;"
6232
"\n";
6233
6234
const char *callableDecls =
6235
"in uvec3 gl_LaunchIDNV;"
6236
"in uvec3 gl_LaunchIDEXT;"
6237
"in uvec3 gl_LaunchSizeNV;"
6238
"in uvec3 gl_LaunchSizeEXT;"
6239
"\n";
6240
6241
6242
commonBuiltins.append(constRayQueryIntersection);
6243
commonBuiltins.append(constRayFlags);
6244
6245
stageBuiltins[EShLangRayGen].append(rayGenDecls);
6246
stageBuiltins[EShLangIntersect].append(intersectDecls);
6247
stageBuiltins[EShLangAnyHit].append(hitDecls);
6248
stageBuiltins[EShLangClosestHit].append(hitDecls);
6249
stageBuiltins[EShLangMiss].append(missDecls);
6250
stageBuiltins[EShLangCallable].append(callableDecls);
6251
6252
}
6253
6254
if ((profile != EEsProfile && version >= 140)) {
6255
const char *deviceIndex =
6256
"in highp int gl_DeviceIndex;" // GL_EXT_device_group
6257
"\n";
6258
6259
stageBuiltins[EShLangRayGen].append(deviceIndex);
6260
stageBuiltins[EShLangIntersect].append(deviceIndex);
6261
stageBuiltins[EShLangAnyHit].append(deviceIndex);
6262
stageBuiltins[EShLangClosestHit].append(deviceIndex);
6263
stageBuiltins[EShLangMiss].append(deviceIndex);
6264
}
6265
6266
if ((profile != EEsProfile && version >= 420) ||
6267
(profile == EEsProfile && version >= 310)) {
6268
commonBuiltins.append("const int gl_ScopeDevice = 1;\n");
6269
commonBuiltins.append("const int gl_ScopeWorkgroup = 2;\n");
6270
commonBuiltins.append("const int gl_ScopeSubgroup = 3;\n");
6271
commonBuiltins.append("const int gl_ScopeInvocation = 4;\n");
6272
commonBuiltins.append("const int gl_ScopeQueueFamily = 5;\n");
6273
commonBuiltins.append("const int gl_ScopeShaderCallEXT = 6;\n");
6274
6275
commonBuiltins.append("const int gl_SemanticsRelaxed = 0x0;\n");
6276
commonBuiltins.append("const int gl_SemanticsAcquire = 0x2;\n");
6277
commonBuiltins.append("const int gl_SemanticsRelease = 0x4;\n");
6278
commonBuiltins.append("const int gl_SemanticsAcquireRelease = 0x8;\n");
6279
commonBuiltins.append("const int gl_SemanticsMakeAvailable = 0x2000;\n");
6280
commonBuiltins.append("const int gl_SemanticsMakeVisible = 0x4000;\n");
6281
commonBuiltins.append("const int gl_SemanticsVolatile = 0x8000;\n");
6282
6283
commonBuiltins.append("const int gl_StorageSemanticsNone = 0x0;\n");
6284
commonBuiltins.append("const int gl_StorageSemanticsBuffer = 0x40;\n");
6285
commonBuiltins.append("const int gl_StorageSemanticsShared = 0x100;\n");
6286
commonBuiltins.append("const int gl_StorageSemanticsImage = 0x800;\n");
6287
commonBuiltins.append("const int gl_StorageSemanticsOutput = 0x1000;\n");
6288
}
6289
6290
// Adding these to common built-ins triggers an assert due to a memory corruption in related code when testing
6291
// So instead add to each stage individually, avoiding the GLSLang bug
6292
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 310)) {
6293
for (int stage=EShLangVertex; stage<EShLangCount; stage++)
6294
{
6295
stageBuiltins[static_cast<EShLanguage>(stage)].append("const highp int gl_ShadingRateFlag2VerticalPixelsEXT = 1;\n");
6296
stageBuiltins[static_cast<EShLanguage>(stage)].append("const highp int gl_ShadingRateFlag4VerticalPixelsEXT = 2;\n");
6297
stageBuiltins[static_cast<EShLanguage>(stage)].append("const highp int gl_ShadingRateFlag2HorizontalPixelsEXT = 4;\n");
6298
stageBuiltins[static_cast<EShLanguage>(stage)].append("const highp int gl_ShadingRateFlag4HorizontalPixelsEXT = 8;\n");
6299
}
6300
}
6301
6302
// GL_EXT_shader_image_int64
6303
if ((profile != EEsProfile && version >= 420) ||
6304
(profile == EEsProfile && version >= 310)) {
6305
6306
const TBasicType bTypes[] = { EbtInt64, EbtUint64 };
6307
for (int ms = 0; ms <= 1; ++ms) { // loop over "bool" multisample or not
6308
for (int arrayed = 0; arrayed <= 1; ++arrayed) { // loop over "bool" arrayed or not
6309
for (int dim = Esd1D; dim < EsdSubpass; ++dim) { // 1D, ..., buffer
6310
if ((dim == Esd1D || dim == EsdRect) && profile == EEsProfile)
6311
continue;
6312
6313
if ((dim == Esd3D || dim == EsdRect || dim == EsdBuffer) && arrayed)
6314
continue;
6315
6316
if (dim != Esd2D && ms)
6317
continue;
6318
6319
// Loop over the bTypes
6320
for (size_t bType = 0; bType < sizeof(bTypes)/sizeof(TBasicType); ++bType) {
6321
//
6322
// Now, make all the function prototypes for the type we just built...
6323
//
6324
TSampler sampler;
6325
6326
sampler.setImage(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false,
6327
false,
6328
ms ? true : false);
6329
6330
TString typeName = sampler.getString();
6331
6332
addQueryFunctions(sampler, typeName, version, profile);
6333
addImageFunctions(sampler, typeName, version, profile);
6334
}
6335
}
6336
}
6337
}
6338
}
6339
6340
// printf("%s\n", commonBuiltins.c_str());
6341
// printf("%s\n", stageBuiltins[EShLangFragment].c_str());
6342
}
6343
6344
//
6345
// Helper function for initialize(), to add the second set of names for texturing,
6346
// when adding context-independent built-in functions.
6347
//
6348
void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, const SpvVersion& spvVersion)
6349
{
6350
//
6351
// In this function proper, enumerate the types, then calls the next set of functions
6352
// to enumerate all the uses for that type.
6353
//
6354
6355
// enumerate all the types
6356
const TBasicType bTypes[] = { EbtFloat, EbtInt, EbtUint,
6357
EbtFloat16
6358
};
6359
bool skipBuffer = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 140);
6360
bool skipCubeArrayed = (profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 130);
6361
for (int image = 0; image <= 1; ++image) // loop over "bool" image vs sampler
6362
{
6363
for (int shadow = 0; shadow <= 1; ++shadow) { // loop over "bool" shadow or not
6364
for (int ms = 0; ms <= 1; ++ms) // loop over "bool" multisample or not
6365
{
6366
if ((ms || image) && shadow)
6367
continue;
6368
if (ms && profile != EEsProfile && version < 140)
6369
continue;
6370
if (ms && image && profile == EEsProfile)
6371
continue;
6372
if (ms && profile == EEsProfile && version < 310)
6373
continue;
6374
6375
for (int arrayed = 0; arrayed <= 1; ++arrayed) { // loop over "bool" arrayed or not
6376
for (int dim = Esd1D; dim < EsdNumDims; ++dim) { // 1D, ..., buffer, subpass
6377
if (dim == EsdAttachmentEXT)
6378
continue;
6379
if (dim == EsdSubpass && spvVersion.vulkan == 0)
6380
continue;
6381
if (dim == EsdSubpass && (image || shadow || arrayed))
6382
continue;
6383
if ((dim == Esd1D || dim == EsdRect) && profile == EEsProfile)
6384
continue;
6385
if (dim == EsdSubpass && spvVersion.vulkan == 0)
6386
continue;
6387
if (dim == EsdSubpass && (image || shadow || arrayed))
6388
continue;
6389
if ((dim == Esd1D || dim == EsdRect) && profile == EEsProfile)
6390
continue;
6391
if (dim != Esd2D && dim != EsdSubpass && ms)
6392
continue;
6393
if (dim == EsdBuffer && skipBuffer)
6394
continue;
6395
if (dim == EsdBuffer && (shadow || arrayed || ms))
6396
continue;
6397
if (ms && arrayed && profile == EEsProfile && version < 310)
6398
continue;
6399
if (dim == Esd3D && shadow)
6400
continue;
6401
if (dim == EsdCube && arrayed && skipCubeArrayed)
6402
continue;
6403
if ((dim == Esd3D || dim == EsdRect) && arrayed)
6404
continue;
6405
6406
// Loop over the bTypes
6407
for (size_t bType = 0; bType < sizeof(bTypes)/sizeof(TBasicType); ++bType) {
6408
if (bTypes[bType] == EbtFloat16 && (profile == EEsProfile || version < 450))
6409
continue;
6410
if (dim == EsdRect && version < 140 && bType > 0)
6411
continue;
6412
if (shadow && (bTypes[bType] == EbtInt || bTypes[bType] == EbtUint))
6413
continue;
6414
//
6415
// Now, make all the function prototypes for the type we just built...
6416
//
6417
TSampler sampler;
6418
if (dim == EsdSubpass) {
6419
sampler.setSubpass(bTypes[bType], ms ? true : false);
6420
} else if (dim == EsdAttachmentEXT) {
6421
sampler.setAttachmentEXT(bTypes[bType]);
6422
} else
6423
if (image) {
6424
sampler.setImage(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false,
6425
shadow ? true : false,
6426
ms ? true : false);
6427
} else {
6428
sampler.set(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false,
6429
shadow ? true : false,
6430
ms ? true : false);
6431
}
6432
6433
TString typeName = sampler.getString();
6434
6435
if (dim == EsdSubpass) {
6436
addSubpassSampling(sampler, typeName, version, profile);
6437
continue;
6438
}
6439
6440
addQueryFunctions(sampler, typeName, version, profile);
6441
6442
if (image)
6443
addImageFunctions(sampler, typeName, version, profile);
6444
else {
6445
addSamplingFunctions(sampler, typeName, version, profile);
6446
addGatherFunctions(sampler, typeName, version, profile);
6447
if (spvVersion.vulkan > 0 && sampler.isCombined() && !sampler.shadow) {
6448
// Base Vulkan allows texelFetch() for
6449
// textureBuffer (i.e. without sampler).
6450
//
6451
// GL_EXT_samplerless_texture_functions
6452
// allows texelFetch() and query functions
6453
// (other than textureQueryLod()) for all
6454
// texture types.
6455
sampler.setTexture(sampler.type, sampler.dim, sampler.arrayed, sampler.shadow,
6456
sampler.ms);
6457
TString textureTypeName = sampler.getString();
6458
addSamplingFunctions(sampler, textureTypeName, version, profile);
6459
addQueryFunctions(sampler, textureTypeName, version, profile);
6460
}
6461
}
6462
}
6463
}
6464
}
6465
}
6466
}
6467
}
6468
6469
//
6470
// sparseTexelsResidentARB()
6471
//
6472
if (profile != EEsProfile && version >= 450) {
6473
commonBuiltins.append("bool sparseTexelsResidentARB(int code);\n");
6474
}
6475
}
6476
6477
//
6478
// Helper function for add2ndGenerationSamplingImaging(),
6479
// when adding context-independent built-in functions.
6480
//
6481
// Add all the query functions for the given type.
6482
//
6483
void TBuiltIns::addQueryFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile)
6484
{
6485
//
6486
// textureSize() and imageSize()
6487
//
6488
6489
int sizeDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0) - (sampler.dim == EsdCube ? 1 : 0);
6490
6491
if (sampler.isImage() && ((profile == EEsProfile && version < 310) || (profile != EEsProfile && version < 420)))
6492
return;
6493
6494
if (profile == EEsProfile)
6495
commonBuiltins.append("highp ");
6496
if (sizeDims == 1)
6497
commonBuiltins.append("int");
6498
else {
6499
commonBuiltins.append("ivec");
6500
commonBuiltins.append(postfixes[sizeDims]);
6501
}
6502
if (sampler.isImage())
6503
commonBuiltins.append(" imageSize(readonly writeonly volatile coherent ");
6504
else
6505
commonBuiltins.append(" textureSize(");
6506
commonBuiltins.append(typeName);
6507
if (! sampler.isImage() && ! sampler.isRect() && ! sampler.isBuffer() && ! sampler.isMultiSample())
6508
commonBuiltins.append(",int);\n");
6509
else
6510
commonBuiltins.append(");\n");
6511
6512
//
6513
// textureSamples() and imageSamples()
6514
//
6515
6516
// GL_ARB_shader_texture_image_samples
6517
// TODO: spec issue? there are no memory qualifiers; how to query a writeonly/readonly image, etc?
6518
if (profile != EEsProfile && version >= 430 && sampler.isMultiSample()) {
6519
commonBuiltins.append("int ");
6520
if (sampler.isImage())
6521
commonBuiltins.append("imageSamples(readonly writeonly volatile coherent ");
6522
else
6523
commonBuiltins.append("textureSamples(");
6524
commonBuiltins.append(typeName);
6525
commonBuiltins.append(");\n");
6526
}
6527
6528
//
6529
// textureQueryLod(), fragment stage only
6530
// Also enabled with extension GL_ARB_texture_query_lod
6531
// Extension GL_ARB_texture_query_lod says that textureQueryLOD() also exist at extension.
6532
6533
if (profile != EEsProfile && version >= 150 && sampler.isCombined() && sampler.dim != EsdRect &&
6534
! sampler.isMultiSample() && ! sampler.isBuffer()) {
6535
6536
const TString funcName[2] = {"vec2 textureQueryLod(", "vec2 textureQueryLOD("};
6537
6538
for (int i = 0; i < 2; ++i){
6539
for (int f16TexAddr = 0; f16TexAddr < 2; ++f16TexAddr) {
6540
if (f16TexAddr && sampler.type != EbtFloat16)
6541
continue;
6542
stageBuiltins[EShLangFragment].append(funcName[i]);
6543
stageBuiltins[EShLangFragment].append(typeName);
6544
if (dimMap[sampler.dim] == 1)
6545
if (f16TexAddr)
6546
stageBuiltins[EShLangFragment].append(", float16_t");
6547
else
6548
stageBuiltins[EShLangFragment].append(", float");
6549
else {
6550
if (f16TexAddr)
6551
stageBuiltins[EShLangFragment].append(", f16vec");
6552
else
6553
stageBuiltins[EShLangFragment].append(", vec");
6554
stageBuiltins[EShLangFragment].append(postfixes[dimMap[sampler.dim]]);
6555
}
6556
stageBuiltins[EShLangFragment].append(");\n");
6557
}
6558
6559
stageBuiltins[EShLangCompute].append(funcName[i]);
6560
stageBuiltins[EShLangCompute].append(typeName);
6561
if (dimMap[sampler.dim] == 1)
6562
stageBuiltins[EShLangCompute].append(", float");
6563
else {
6564
stageBuiltins[EShLangCompute].append(", vec");
6565
stageBuiltins[EShLangCompute].append(postfixes[dimMap[sampler.dim]]);
6566
}
6567
stageBuiltins[EShLangCompute].append(");\n");
6568
}
6569
}
6570
6571
//
6572
// textureQueryLevels()
6573
//
6574
6575
if (profile != EEsProfile && version >= 430 && ! sampler.isImage() && sampler.dim != EsdRect &&
6576
! sampler.isMultiSample() && ! sampler.isBuffer()) {
6577
commonBuiltins.append("int textureQueryLevels(");
6578
commonBuiltins.append(typeName);
6579
commonBuiltins.append(");\n");
6580
}
6581
}
6582
6583
//
6584
// Helper function for add2ndGenerationSamplingImaging(),
6585
// when adding context-independent built-in functions.
6586
//
6587
// Add all the image access functions for the given type.
6588
//
6589
void TBuiltIns::addImageFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile)
6590
{
6591
int dims = dimMap[sampler.dim];
6592
// most things with an array add a dimension, except for cubemaps
6593
if (sampler.arrayed && sampler.dim != EsdCube)
6594
++dims;
6595
6596
TString imageParams = typeName;
6597
if (dims == 1)
6598
imageParams.append(", int");
6599
else {
6600
imageParams.append(", ivec");
6601
imageParams.append(postfixes[dims]);
6602
}
6603
if (sampler.isMultiSample())
6604
imageParams.append(", int");
6605
6606
if (profile == EEsProfile)
6607
commonBuiltins.append("highp ");
6608
commonBuiltins.append(prefixes[sampler.type]);
6609
commonBuiltins.append("vec4 imageLoad(readonly volatile coherent ");
6610
commonBuiltins.append(imageParams);
6611
commonBuiltins.append(");\n");
6612
6613
commonBuiltins.append("void imageStore(writeonly volatile coherent ");
6614
commonBuiltins.append(imageParams);
6615
commonBuiltins.append(", ");
6616
commonBuiltins.append(prefixes[sampler.type]);
6617
commonBuiltins.append("vec4);\n");
6618
6619
if (! sampler.is1D() && ! sampler.isBuffer() && profile != EEsProfile && version >= 450) {
6620
commonBuiltins.append("int sparseImageLoadARB(readonly volatile coherent ");
6621
commonBuiltins.append(imageParams);
6622
commonBuiltins.append(", out ");
6623
commonBuiltins.append(prefixes[sampler.type]);
6624
commonBuiltins.append("vec4");
6625
commonBuiltins.append(");\n");
6626
}
6627
6628
if ( profile != EEsProfile ||
6629
(profile == EEsProfile && version >= 310)) {
6630
if (sampler.type == EbtInt || sampler.type == EbtUint || sampler.type == EbtInt64 || sampler.type == EbtUint64 ) {
6631
6632
const char* dataType;
6633
switch (sampler.type) {
6634
case(EbtInt): dataType = "highp int"; break;
6635
case(EbtUint): dataType = "highp uint"; break;
6636
case(EbtInt64): dataType = "highp int64_t"; break;
6637
case(EbtUint64): dataType = "highp uint64_t"; break;
6638
default: dataType = "";
6639
}
6640
6641
const int numBuiltins = 7;
6642
6643
static const char* atomicFunc[numBuiltins] = {
6644
" imageAtomicAdd(volatile coherent ",
6645
" imageAtomicMin(volatile coherent ",
6646
" imageAtomicMax(volatile coherent ",
6647
" imageAtomicAnd(volatile coherent ",
6648
" imageAtomicOr(volatile coherent ",
6649
" imageAtomicXor(volatile coherent ",
6650
" imageAtomicExchange(volatile coherent "
6651
};
6652
6653
// Loop twice to add prototypes with/without scope/semantics
6654
for (int j = 0; j < 2; ++j) {
6655
for (size_t i = 0; i < numBuiltins; ++i) {
6656
commonBuiltins.append(dataType);
6657
commonBuiltins.append(atomicFunc[i]);
6658
commonBuiltins.append(imageParams);
6659
commonBuiltins.append(", ");
6660
commonBuiltins.append(dataType);
6661
if (j == 1) {
6662
commonBuiltins.append(", int, int, int");
6663
}
6664
commonBuiltins.append(");\n");
6665
}
6666
6667
commonBuiltins.append(dataType);
6668
commonBuiltins.append(" imageAtomicCompSwap(volatile coherent ");
6669
commonBuiltins.append(imageParams);
6670
commonBuiltins.append(", ");
6671
commonBuiltins.append(dataType);
6672
commonBuiltins.append(", ");
6673
commonBuiltins.append(dataType);
6674
if (j == 1) {
6675
commonBuiltins.append(", int, int, int, int, int");
6676
}
6677
commonBuiltins.append(");\n");
6678
}
6679
6680
commonBuiltins.append(dataType);
6681
commonBuiltins.append(" imageAtomicLoad(volatile coherent ");
6682
commonBuiltins.append(imageParams);
6683
commonBuiltins.append(", int, int, int);\n");
6684
6685
commonBuiltins.append("void imageAtomicStore(volatile coherent ");
6686
commonBuiltins.append(imageParams);
6687
commonBuiltins.append(", ");
6688
commonBuiltins.append(dataType);
6689
commonBuiltins.append(", int, int, int);\n");
6690
6691
} else {
6692
// not int or uint
6693
// GL_ARB_ES3_1_compatibility
6694
// TODO: spec issue: are there restrictions on the kind of layout() that can be used? what about dropping memory qualifiers?
6695
if (profile == EEsProfile && version >= 310) {
6696
commonBuiltins.append("float imageAtomicExchange(volatile coherent ");
6697
commonBuiltins.append(imageParams);
6698
commonBuiltins.append(", float);\n");
6699
}
6700
6701
// GL_NV_shader_atomic_fp16_vector
6702
if (profile != EEsProfile && version >= 430) {
6703
const int numFp16Builtins = 4;
6704
const char* atomicFp16Func[numFp16Builtins] = {
6705
" imageAtomicAdd(volatile coherent ",
6706
" imageAtomicMin(volatile coherent ",
6707
" imageAtomicMax(volatile coherent ",
6708
" imageAtomicExchange(volatile coherent "
6709
};
6710
const int numFp16DataTypes = 2;
6711
const char* atomicFp16DataTypes[numFp16DataTypes] = {
6712
"f16vec2",
6713
"f16vec4"
6714
};
6715
// Loop twice to add prototypes with/without scope/semantics
6716
for (int j = 0; j < numFp16DataTypes; ++j) {
6717
for (int i = 0; i < numFp16Builtins; ++i) {
6718
commonBuiltins.append(atomicFp16DataTypes[j]);
6719
commonBuiltins.append(atomicFp16Func[i]);
6720
commonBuiltins.append(imageParams);
6721
commonBuiltins.append(", ");
6722
commonBuiltins.append(atomicFp16DataTypes[j]);
6723
commonBuiltins.append(");\n");
6724
}
6725
}
6726
}
6727
6728
if (profile != EEsProfile && version >= 450) {
6729
commonBuiltins.append("float imageAtomicAdd(volatile coherent ");
6730
commonBuiltins.append(imageParams);
6731
commonBuiltins.append(", float);\n");
6732
6733
commonBuiltins.append("float imageAtomicAdd(volatile coherent ");
6734
commonBuiltins.append(imageParams);
6735
commonBuiltins.append(", float");
6736
commonBuiltins.append(", int, int, int);\n");
6737
6738
commonBuiltins.append("float imageAtomicExchange(volatile coherent ");
6739
commonBuiltins.append(imageParams);
6740
commonBuiltins.append(", float);\n");
6741
6742
commonBuiltins.append("float imageAtomicExchange(volatile coherent ");
6743
commonBuiltins.append(imageParams);
6744
commonBuiltins.append(", float");
6745
commonBuiltins.append(", int, int, int);\n");
6746
6747
commonBuiltins.append("float imageAtomicLoad(readonly volatile coherent ");
6748
commonBuiltins.append(imageParams);
6749
commonBuiltins.append(", int, int, int);\n");
6750
6751
commonBuiltins.append("void imageAtomicStore(writeonly volatile coherent ");
6752
commonBuiltins.append(imageParams);
6753
commonBuiltins.append(", float");
6754
commonBuiltins.append(", int, int, int);\n");
6755
6756
commonBuiltins.append("float imageAtomicMin(volatile coherent ");
6757
commonBuiltins.append(imageParams);
6758
commonBuiltins.append(", float);\n");
6759
6760
commonBuiltins.append("float imageAtomicMin(volatile coherent ");
6761
commonBuiltins.append(imageParams);
6762
commonBuiltins.append(", float");
6763
commonBuiltins.append(", int, int, int);\n");
6764
6765
commonBuiltins.append("float imageAtomicMax(volatile coherent ");
6766
commonBuiltins.append(imageParams);
6767
commonBuiltins.append(", float);\n");
6768
6769
commonBuiltins.append("float imageAtomicMax(volatile coherent ");
6770
commonBuiltins.append(imageParams);
6771
commonBuiltins.append(", float");
6772
commonBuiltins.append(", int, int, int);\n");
6773
}
6774
}
6775
}
6776
6777
if (sampler.dim == EsdRect || sampler.dim == EsdBuffer || sampler.shadow || sampler.isMultiSample())
6778
return;
6779
6780
if (profile == EEsProfile || version < 450)
6781
return;
6782
6783
TString imageLodParams = typeName;
6784
if (dims == 1)
6785
imageLodParams.append(", int");
6786
else {
6787
imageLodParams.append(", ivec");
6788
imageLodParams.append(postfixes[dims]);
6789
}
6790
imageLodParams.append(", int");
6791
6792
commonBuiltins.append(prefixes[sampler.type]);
6793
commonBuiltins.append("vec4 imageLoadLodAMD(readonly volatile coherent ");
6794
commonBuiltins.append(imageLodParams);
6795
commonBuiltins.append(");\n");
6796
6797
commonBuiltins.append("void imageStoreLodAMD(writeonly volatile coherent ");
6798
commonBuiltins.append(imageLodParams);
6799
commonBuiltins.append(", ");
6800
commonBuiltins.append(prefixes[sampler.type]);
6801
commonBuiltins.append("vec4);\n");
6802
6803
if (! sampler.is1D()) {
6804
commonBuiltins.append("int sparseImageLoadLodAMD(readonly volatile coherent ");
6805
commonBuiltins.append(imageLodParams);
6806
commonBuiltins.append(", out ");
6807
commonBuiltins.append(prefixes[sampler.type]);
6808
commonBuiltins.append("vec4");
6809
commonBuiltins.append(");\n");
6810
}
6811
}
6812
6813
//
6814
// Helper function for initialize(),
6815
// when adding context-independent built-in functions.
6816
//
6817
// Add all the subpass access functions for the given type.
6818
//
6819
void TBuiltIns::addSubpassSampling(TSampler sampler, const TString& typeName, int /*version*/, EProfile /*profile*/)
6820
{
6821
stageBuiltins[EShLangFragment].append(prefixes[sampler.type]);
6822
stageBuiltins[EShLangFragment].append("vec4 subpassLoad");
6823
stageBuiltins[EShLangFragment].append("(");
6824
stageBuiltins[EShLangFragment].append(typeName.c_str());
6825
if (sampler.isMultiSample())
6826
stageBuiltins[EShLangFragment].append(", int");
6827
stageBuiltins[EShLangFragment].append(");\n");
6828
}
6829
6830
//
6831
// Helper function for add2ndGenerationSamplingImaging(),
6832
// when adding context-independent built-in functions.
6833
//
6834
// Add all the texture lookup functions for the given type.
6835
//
6836
void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile)
6837
{
6838
//
6839
// texturing
6840
//
6841
for (int proj = 0; proj <= 1; ++proj) { // loop over "bool" projective or not
6842
6843
if (proj && (sampler.dim == EsdCube || sampler.isBuffer() || sampler.arrayed || sampler.isMultiSample()
6844
|| !sampler.isCombined()))
6845
continue;
6846
6847
for (int lod = 0; lod <= 1; ++lod) {
6848
6849
if (lod && (sampler.isBuffer() || sampler.isRect() || sampler.isMultiSample() || !sampler.isCombined()))
6850
continue;
6851
if (lod && sampler.dim == Esd2D && sampler.arrayed && sampler.shadow)
6852
continue;
6853
if (lod && sampler.dim == EsdCube && sampler.shadow)
6854
continue;
6855
6856
for (int bias = 0; bias <= 1; ++bias) {
6857
6858
if (bias && (lod || sampler.isMultiSample() || !sampler.isCombined()))
6859
continue;
6860
if (bias && (sampler.dim == Esd2D || sampler.dim == EsdCube) && sampler.shadow && sampler.arrayed)
6861
continue;
6862
if (bias && (sampler.isRect() || sampler.isBuffer()))
6863
continue;
6864
6865
for (int offset = 0; offset <= 1; ++offset) { // loop over "bool" offset or not
6866
6867
if (proj + offset + bias + lod > 3)
6868
continue;
6869
if (offset && (sampler.dim == EsdCube || sampler.isBuffer() || sampler.isMultiSample()))
6870
continue;
6871
6872
for (int fetch = 0; fetch <= 1; ++fetch) { // loop over "bool" fetch or not
6873
6874
if (proj + offset + fetch + bias + lod > 3)
6875
continue;
6876
if (fetch && (lod || bias))
6877
continue;
6878
if (fetch && (sampler.shadow || sampler.dim == EsdCube))
6879
continue;
6880
if (fetch == 0 && (sampler.isMultiSample() || sampler.isBuffer()
6881
|| !sampler.isCombined()))
6882
continue;
6883
6884
for (int grad = 0; grad <= 1; ++grad) { // loop over "bool" grad or not
6885
6886
if (grad && (lod || bias || sampler.isMultiSample() || !sampler.isCombined()))
6887
continue;
6888
if (grad && sampler.isBuffer())
6889
continue;
6890
if (proj + offset + fetch + grad + bias + lod > 3)
6891
continue;
6892
6893
for (int extraProj = 0; extraProj <= 1; ++extraProj) {
6894
bool compare = false;
6895
int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0);
6896
// skip dummy unused second component for 1D non-array shadows
6897
if (sampler.shadow && totalDims < 2)
6898
totalDims = 2;
6899
totalDims += (sampler.shadow ? 1 : 0) + proj;
6900
if (totalDims > 4 && sampler.shadow) {
6901
compare = true;
6902
totalDims = 4;
6903
}
6904
assert(totalDims <= 4);
6905
6906
if (extraProj && ! proj)
6907
continue;
6908
if (extraProj && (sampler.dim == Esd3D || sampler.shadow || !sampler.isCombined()))
6909
continue;
6910
6911
// loop over 16-bit floating-point texel addressing
6912
for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr)
6913
{
6914
if (f16TexAddr && sampler.type != EbtFloat16)
6915
continue;
6916
if (f16TexAddr && sampler.shadow && ! compare) {
6917
compare = true; // compare argument is always present
6918
totalDims--;
6919
}
6920
// loop over "bool" lod clamp
6921
for (int lodClamp = 0; lodClamp <= 1 ;++lodClamp)
6922
{
6923
if (lodClamp && (profile == EEsProfile || version < 450))
6924
continue;
6925
if (lodClamp && (proj || lod || fetch))
6926
continue;
6927
6928
// loop over "bool" sparse or not
6929
for (int sparse = 0; sparse <= 1; ++sparse)
6930
{
6931
if (sparse && (profile == EEsProfile || version < 450))
6932
continue;
6933
// Sparse sampling is not for 1D/1D array texture, buffer texture, and
6934
// projective texture
6935
if (sparse && (sampler.is1D() || sampler.isBuffer() || proj))
6936
continue;
6937
6938
TString s;
6939
6940
// return type
6941
if (sparse)
6942
s.append("int ");
6943
else {
6944
if (sampler.shadow)
6945
if (sampler.type == EbtFloat16)
6946
s.append("float16_t ");
6947
else
6948
s.append("float ");
6949
else {
6950
s.append(prefixes[sampler.type]);
6951
s.append("vec4 ");
6952
}
6953
}
6954
6955
// name
6956
if (sparse) {
6957
if (fetch)
6958
s.append("sparseTexel");
6959
else
6960
s.append("sparseTexture");
6961
}
6962
else {
6963
if (fetch)
6964
s.append("texel");
6965
else
6966
s.append("texture");
6967
}
6968
if (proj)
6969
s.append("Proj");
6970
if (lod)
6971
s.append("Lod");
6972
if (grad)
6973
s.append("Grad");
6974
if (fetch)
6975
s.append("Fetch");
6976
if (offset)
6977
s.append("Offset");
6978
if (lodClamp)
6979
s.append("Clamp");
6980
if (lodClamp != 0 || sparse)
6981
s.append("ARB");
6982
s.append("(");
6983
6984
// sampler type
6985
s.append(typeName);
6986
// P coordinate
6987
if (extraProj) {
6988
if (f16TexAddr)
6989
s.append(",f16vec4");
6990
else
6991
s.append(",vec4");
6992
} else {
6993
s.append(",");
6994
TBasicType t = fetch ? EbtInt : (f16TexAddr ? EbtFloat16 : EbtFloat);
6995
if (totalDims == 1)
6996
s.append(TType::getBasicString(t));
6997
else {
6998
s.append(prefixes[t]);
6999
s.append("vec");
7000
s.append(postfixes[totalDims]);
7001
}
7002
}
7003
// non-optional compare
7004
if (compare)
7005
s.append(",float");
7006
7007
// non-optional lod argument (lod that's not driven by lod loop) or sample
7008
if ((fetch && !sampler.isBuffer() &&
7009
!sampler.isRect() && !sampler.isMultiSample())
7010
|| (sampler.isMultiSample() && fetch))
7011
s.append(",int");
7012
// non-optional lod
7013
if (lod) {
7014
if (f16TexAddr)
7015
s.append(",float16_t");
7016
else
7017
s.append(",float");
7018
}
7019
7020
// gradient arguments
7021
if (grad) {
7022
if (dimMap[sampler.dim] == 1) {
7023
if (f16TexAddr)
7024
s.append(",float16_t,float16_t");
7025
else
7026
s.append(",float,float");
7027
} else {
7028
if (f16TexAddr)
7029
s.append(",f16vec");
7030
else
7031
s.append(",vec");
7032
s.append(postfixes[dimMap[sampler.dim]]);
7033
if (f16TexAddr)
7034
s.append(",f16vec");
7035
else
7036
s.append(",vec");
7037
s.append(postfixes[dimMap[sampler.dim]]);
7038
}
7039
}
7040
// offset
7041
if (offset) {
7042
if (dimMap[sampler.dim] == 1)
7043
s.append(",int");
7044
else {
7045
s.append(",ivec");
7046
s.append(postfixes[dimMap[sampler.dim]]);
7047
}
7048
}
7049
7050
// lod clamp
7051
if (lodClamp) {
7052
if (f16TexAddr)
7053
s.append(",float16_t");
7054
else
7055
s.append(",float");
7056
}
7057
// texel out (for sparse texture)
7058
if (sparse) {
7059
s.append(",out ");
7060
if (sampler.shadow)
7061
if (sampler.type == EbtFloat16)
7062
s.append("float16_t");
7063
else
7064
s.append("float");
7065
else {
7066
s.append(prefixes[sampler.type]);
7067
s.append("vec4");
7068
}
7069
}
7070
// optional bias
7071
if (bias) {
7072
if (f16TexAddr)
7073
s.append(",float16_t");
7074
else
7075
s.append(",float");
7076
}
7077
s.append(");\n");
7078
7079
// Add to the per-language set of built-ins
7080
if (!grad && (bias || lodClamp != 0)) {
7081
stageBuiltins[EShLangFragment].append(s);
7082
stageBuiltins[EShLangCompute].append(s);
7083
} else
7084
commonBuiltins.append(s);
7085
7086
}
7087
}
7088
}
7089
}
7090
}
7091
}
7092
}
7093
}
7094
}
7095
}
7096
}
7097
7098
//
7099
// Helper function for add2ndGenerationSamplingImaging(),
7100
// when adding context-independent built-in functions.
7101
//
7102
// Add all the texture gather functions for the given type.
7103
//
7104
void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile)
7105
{
7106
switch (sampler.dim) {
7107
case Esd2D:
7108
case EsdRect:
7109
case EsdCube:
7110
break;
7111
default:
7112
return;
7113
}
7114
7115
if (sampler.isMultiSample())
7116
return;
7117
7118
if (version < 140 && sampler.dim == EsdRect && sampler.type != EbtFloat)
7119
return;
7120
7121
for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) { // loop over 16-bit floating-point texel addressing
7122
7123
if (f16TexAddr && sampler.type != EbtFloat16)
7124
continue;
7125
for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets
7126
7127
for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument
7128
7129
if (comp > 0 && sampler.shadow)
7130
continue;
7131
7132
if (offset > 0 && sampler.dim == EsdCube)
7133
continue;
7134
7135
for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not
7136
if (sparse && (profile == EEsProfile || version < 450))
7137
continue;
7138
7139
TString s;
7140
7141
// return type
7142
if (sparse)
7143
s.append("int ");
7144
else {
7145
s.append(prefixes[sampler.type]);
7146
s.append("vec4 ");
7147
}
7148
7149
// name
7150
if (sparse)
7151
s.append("sparseTextureGather");
7152
else
7153
s.append("textureGather");
7154
switch (offset) {
7155
case 1:
7156
s.append("Offset");
7157
break;
7158
case 2:
7159
s.append("Offsets");
7160
break;
7161
default:
7162
break;
7163
}
7164
if (sparse)
7165
s.append("ARB");
7166
s.append("(");
7167
7168
// sampler type argument
7169
s.append(typeName);
7170
7171
// P coordinate argument
7172
if (f16TexAddr)
7173
s.append(",f16vec");
7174
else
7175
s.append(",vec");
7176
int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0);
7177
s.append(postfixes[totalDims]);
7178
7179
// refZ argument
7180
if (sampler.shadow)
7181
s.append(",float");
7182
7183
// offset argument
7184
if (offset > 0) {
7185
s.append(",ivec2");
7186
if (offset == 2)
7187
s.append("[4]");
7188
}
7189
7190
// texel out (for sparse texture)
7191
if (sparse) {
7192
s.append(",out ");
7193
s.append(prefixes[sampler.type]);
7194
s.append("vec4 ");
7195
}
7196
7197
// comp argument
7198
if (comp)
7199
s.append(",int");
7200
7201
s.append(");\n");
7202
commonBuiltins.append(s);
7203
}
7204
}
7205
}
7206
}
7207
7208
if (sampler.dim == EsdRect || sampler.shadow)
7209
return;
7210
7211
if (profile == EEsProfile || version < 450)
7212
return;
7213
7214
for (int bias = 0; bias < 2; ++bias) { // loop over presence of bias argument
7215
7216
for (int lod = 0; lod < 2; ++lod) { // loop over presence of lod argument
7217
7218
if ((lod && bias) || (lod == 0 && bias == 0))
7219
continue;
7220
7221
for (int f16TexAddr = 0; f16TexAddr <= 1; ++f16TexAddr) { // loop over 16-bit floating-point texel addressing
7222
7223
if (f16TexAddr && sampler.type != EbtFloat16)
7224
continue;
7225
7226
for (int offset = 0; offset < 3; ++offset) { // loop over three forms of offset in the call name: none, Offset, and Offsets
7227
7228
for (int comp = 0; comp < 2; ++comp) { // loop over presence of comp argument
7229
7230
if (comp == 0 && bias)
7231
continue;
7232
7233
if (offset > 0 && sampler.dim == EsdCube)
7234
continue;
7235
7236
for (int sparse = 0; sparse <= 1; ++sparse) { // loop over "bool" sparse or not
7237
if (sparse && (profile == EEsProfile || version < 450))
7238
continue;
7239
7240
TString s;
7241
7242
// return type
7243
if (sparse)
7244
s.append("int ");
7245
else {
7246
s.append(prefixes[sampler.type]);
7247
s.append("vec4 ");
7248
}
7249
7250
// name
7251
if (sparse)
7252
s.append("sparseTextureGather");
7253
else
7254
s.append("textureGather");
7255
7256
if (lod)
7257
s.append("Lod");
7258
7259
switch (offset) {
7260
case 1:
7261
s.append("Offset");
7262
break;
7263
case 2:
7264
s.append("Offsets");
7265
break;
7266
default:
7267
break;
7268
}
7269
7270
if (lod)
7271
s.append("AMD");
7272
else if (sparse)
7273
s.append("ARB");
7274
7275
s.append("(");
7276
7277
// sampler type argument
7278
s.append(typeName);
7279
7280
// P coordinate argument
7281
if (f16TexAddr)
7282
s.append(",f16vec");
7283
else
7284
s.append(",vec");
7285
int totalDims = dimMap[sampler.dim] + (sampler.arrayed ? 1 : 0);
7286
s.append(postfixes[totalDims]);
7287
7288
// lod argument
7289
if (lod) {
7290
if (f16TexAddr)
7291
s.append(",float16_t");
7292
else
7293
s.append(",float");
7294
}
7295
7296
// offset argument
7297
if (offset > 0) {
7298
s.append(",ivec2");
7299
if (offset == 2)
7300
s.append("[4]");
7301
}
7302
7303
// texel out (for sparse texture)
7304
if (sparse) {
7305
s.append(",out ");
7306
s.append(prefixes[sampler.type]);
7307
s.append("vec4 ");
7308
}
7309
7310
// comp argument
7311
if (comp)
7312
s.append(",int");
7313
7314
// bias argument
7315
if (bias) {
7316
if (f16TexAddr)
7317
s.append(",float16_t");
7318
else
7319
s.append(",float");
7320
}
7321
7322
s.append(");\n");
7323
if (bias)
7324
stageBuiltins[EShLangFragment].append(s);
7325
else
7326
commonBuiltins.append(s);
7327
}
7328
}
7329
}
7330
}
7331
}
7332
}
7333
}
7334
7335
//
7336
// Add context-dependent built-in functions and variables that are present
7337
// for the given version and profile. All the results are put into just the
7338
// commonBuiltins, because it is called for just a specific stage. So,
7339
// add stage-specific entries to the commonBuiltins, and only if that stage
7340
// was requested.
7341
//
7342
void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language)
7343
{
7344
//
7345
// Initialize the context-dependent (resource-dependent) built-in strings for parsing.
7346
//
7347
7348
//============================================================================
7349
//
7350
// Standard Uniforms
7351
//
7352
//============================================================================
7353
7354
TString& s = commonBuiltins;
7355
const int maxSize = 200;
7356
char builtInConstant[maxSize];
7357
7358
//
7359
// Build string of implementation dependent constants.
7360
//
7361
7362
if (profile == EEsProfile) {
7363
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVertexAttribs = %d;", resources.maxVertexAttribs);
7364
s.append(builtInConstant);
7365
7366
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVertexUniformVectors = %d;", resources.maxVertexUniformVectors);
7367
s.append(builtInConstant);
7368
7369
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVertexTextureImageUnits = %d;", resources.maxVertexTextureImageUnits);
7370
s.append(builtInConstant);
7371
7372
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxCombinedTextureImageUnits = %d;", resources.maxCombinedTextureImageUnits);
7373
s.append(builtInConstant);
7374
7375
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxTextureImageUnits = %d;", resources.maxTextureImageUnits);
7376
s.append(builtInConstant);
7377
7378
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxFragmentUniformVectors = %d;", resources.maxFragmentUniformVectors);
7379
s.append(builtInConstant);
7380
7381
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxDrawBuffers = %d;", resources.maxDrawBuffers);
7382
s.append(builtInConstant);
7383
7384
if (version == 100) {
7385
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVaryingVectors = %d;", resources.maxVaryingVectors);
7386
s.append(builtInConstant);
7387
} else {
7388
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxVertexOutputVectors = %d;", resources.maxVertexOutputVectors);
7389
s.append(builtInConstant);
7390
7391
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxFragmentInputVectors = %d;", resources.maxFragmentInputVectors);
7392
s.append(builtInConstant);
7393
7394
snprintf(builtInConstant, maxSize, "const mediump int gl_MinProgramTexelOffset = %d;", resources.minProgramTexelOffset);
7395
s.append(builtInConstant);
7396
7397
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxProgramTexelOffset = %d;", resources.maxProgramTexelOffset);
7398
s.append(builtInConstant);
7399
}
7400
7401
if (version >= 310) {
7402
// geometry
7403
7404
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryInputComponents = %d;", resources.maxGeometryInputComponents);
7405
s.append(builtInConstant);
7406
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputComponents = %d;", resources.maxGeometryOutputComponents);
7407
s.append(builtInConstant);
7408
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryImageUniforms = %d;", resources.maxGeometryImageUniforms);
7409
s.append(builtInConstant);
7410
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTextureImageUnits = %d;", resources.maxGeometryTextureImageUnits);
7411
s.append(builtInConstant);
7412
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputVertices = %d;", resources.maxGeometryOutputVertices);
7413
s.append(builtInConstant);
7414
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTotalOutputComponents = %d;", resources.maxGeometryTotalOutputComponents);
7415
s.append(builtInConstant);
7416
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryUniformComponents = %d;", resources.maxGeometryUniformComponents);
7417
s.append(builtInConstant);
7418
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounters = %d;", resources.maxGeometryAtomicCounters);
7419
s.append(builtInConstant);
7420
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounterBuffers = %d;", resources.maxGeometryAtomicCounterBuffers);
7421
s.append(builtInConstant);
7422
7423
// tessellation
7424
7425
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlInputComponents = %d;", resources.maxTessControlInputComponents);
7426
s.append(builtInConstant);
7427
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlOutputComponents = %d;", resources.maxTessControlOutputComponents);
7428
s.append(builtInConstant);
7429
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlTextureImageUnits = %d;", resources.maxTessControlTextureImageUnits);
7430
s.append(builtInConstant);
7431
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlUniformComponents = %d;", resources.maxTessControlUniformComponents);
7432
s.append(builtInConstant);
7433
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlTotalOutputComponents = %d;", resources.maxTessControlTotalOutputComponents);
7434
s.append(builtInConstant);
7435
7436
snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationInputComponents = %d;", resources.maxTessEvaluationInputComponents);
7437
s.append(builtInConstant);
7438
snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationOutputComponents = %d;", resources.maxTessEvaluationOutputComponents);
7439
s.append(builtInConstant);
7440
snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationTextureImageUnits = %d;", resources.maxTessEvaluationTextureImageUnits);
7441
s.append(builtInConstant);
7442
snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationUniformComponents = %d;", resources.maxTessEvaluationUniformComponents);
7443
s.append(builtInConstant);
7444
7445
snprintf(builtInConstant, maxSize, "const int gl_MaxTessPatchComponents = %d;", resources.maxTessPatchComponents);
7446
s.append(builtInConstant);
7447
7448
snprintf(builtInConstant, maxSize, "const int gl_MaxPatchVertices = %d;", resources.maxPatchVertices);
7449
s.append(builtInConstant);
7450
snprintf(builtInConstant, maxSize, "const int gl_MaxTessGenLevel = %d;", resources.maxTessGenLevel);
7451
s.append(builtInConstant);
7452
7453
// this is here instead of with the others in initialize(version, profile) due to the dependence on gl_MaxPatchVertices
7454
if (language == EShLangTessControl || language == EShLangTessEvaluation) {
7455
s.append(
7456
"in gl_PerVertex {"
7457
"highp vec4 gl_Position;"
7458
"highp float gl_PointSize;"
7459
"highp vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering
7460
"highp vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes
7461
"} gl_in[gl_MaxPatchVertices];"
7462
"\n");
7463
}
7464
}
7465
7466
if (version >= 320) {
7467
// tessellation
7468
7469
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlImageUniforms = %d;", resources.maxTessControlImageUniforms);
7470
s.append(builtInConstant);
7471
snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationImageUniforms = %d;", resources.maxTessEvaluationImageUniforms);
7472
s.append(builtInConstant);
7473
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlAtomicCounters = %d;", resources.maxTessControlAtomicCounters);
7474
s.append(builtInConstant);
7475
snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationAtomicCounters = %d;", resources.maxTessEvaluationAtomicCounters);
7476
s.append(builtInConstant);
7477
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlAtomicCounterBuffers = %d;", resources.maxTessControlAtomicCounterBuffers);
7478
s.append(builtInConstant);
7479
snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationAtomicCounterBuffers = %d;", resources.maxTessEvaluationAtomicCounterBuffers);
7480
s.append(builtInConstant);
7481
}
7482
7483
if (version >= 100) {
7484
// GL_EXT_blend_func_extended
7485
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxDualSourceDrawBuffersEXT = %d;", resources.maxDualSourceDrawBuffersEXT);
7486
s.append(builtInConstant);
7487
// this is here instead of with the others in initialize(version, profile) due to the dependence on gl_MaxDualSourceDrawBuffersEXT
7488
if (language == EShLangFragment) {
7489
s.append(
7490
"mediump vec4 gl_SecondaryFragColorEXT;"
7491
"mediump vec4 gl_SecondaryFragDataEXT[gl_MaxDualSourceDrawBuffersEXT];"
7492
"\n");
7493
}
7494
}
7495
} else {
7496
// non-ES profile
7497
7498
if (version > 400) {
7499
snprintf(builtInConstant, maxSize, "const int gl_MaxVertexUniformVectors = %d;", resources.maxVertexUniformVectors);
7500
s.append(builtInConstant);
7501
7502
snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentUniformVectors = %d;", resources.maxFragmentUniformVectors);
7503
s.append(builtInConstant);
7504
7505
snprintf(builtInConstant, maxSize, "const int gl_MaxVaryingVectors = %d;", resources.maxVaryingVectors);
7506
s.append(builtInConstant);
7507
}
7508
7509
snprintf(builtInConstant, maxSize, "const int gl_MaxVertexAttribs = %d;", resources.maxVertexAttribs);
7510
s.append(builtInConstant);
7511
7512
snprintf(builtInConstant, maxSize, "const int gl_MaxVertexTextureImageUnits = %d;", resources.maxVertexTextureImageUnits);
7513
s.append(builtInConstant);
7514
7515
snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedTextureImageUnits = %d;", resources.maxCombinedTextureImageUnits);
7516
s.append(builtInConstant);
7517
7518
snprintf(builtInConstant, maxSize, "const int gl_MaxTextureImageUnits = %d;", resources.maxTextureImageUnits);
7519
s.append(builtInConstant);
7520
7521
snprintf(builtInConstant, maxSize, "const int gl_MaxDrawBuffers = %d;", resources.maxDrawBuffers);
7522
s.append(builtInConstant);
7523
7524
snprintf(builtInConstant, maxSize, "const int gl_MaxLights = %d;", resources.maxLights);
7525
s.append(builtInConstant);
7526
7527
snprintf(builtInConstant, maxSize, "const int gl_MaxClipPlanes = %d;", resources.maxClipPlanes);
7528
s.append(builtInConstant);
7529
7530
snprintf(builtInConstant, maxSize, "const int gl_MaxTextureUnits = %d;", resources.maxTextureUnits);
7531
s.append(builtInConstant);
7532
7533
snprintf(builtInConstant, maxSize, "const int gl_MaxTextureCoords = %d;", resources.maxTextureCoords);
7534
s.append(builtInConstant);
7535
7536
snprintf(builtInConstant, maxSize, "const int gl_MaxVertexUniformComponents = %d;", resources.maxVertexUniformComponents);
7537
s.append(builtInConstant);
7538
7539
// Moved from just being deprecated into compatibility profile only as of 4.20
7540
if (version < 420 || profile == ECompatibilityProfile) {
7541
snprintf(builtInConstant, maxSize, "const int gl_MaxVaryingFloats = %d;", resources.maxVaryingFloats);
7542
s.append(builtInConstant);
7543
}
7544
7545
snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentUniformComponents = %d;", resources.maxFragmentUniformComponents);
7546
s.append(builtInConstant);
7547
7548
if (spvVersion.spv == 0 && IncludeLegacy(version, profile, spvVersion)) {
7549
//
7550
// OpenGL'uniform' state. Page numbers are in reference to version
7551
// 1.4 of the OpenGL specification.
7552
//
7553
7554
//
7555
// Matrix state. p. 31, 32, 37, 39, 40.
7556
//
7557
s.append("uniform mat4 gl_TextureMatrix[gl_MaxTextureCoords];"
7558
7559
//
7560
// Derived matrix state that provides inverse and transposed versions
7561
// of the matrices above.
7562
//
7563
"uniform mat4 gl_TextureMatrixInverse[gl_MaxTextureCoords];"
7564
7565
"uniform mat4 gl_TextureMatrixTranspose[gl_MaxTextureCoords];"
7566
7567
"uniform mat4 gl_TextureMatrixInverseTranspose[gl_MaxTextureCoords];"
7568
7569
//
7570
// Clip planes p. 42.
7571
//
7572
"uniform vec4 gl_ClipPlane[gl_MaxClipPlanes];"
7573
7574
//
7575
// Light State p 50, 53, 55.
7576
//
7577
"uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights];"
7578
7579
//
7580
// Derived state from products of light.
7581
//
7582
"uniform gl_LightProducts gl_FrontLightProduct[gl_MaxLights];"
7583
"uniform gl_LightProducts gl_BackLightProduct[gl_MaxLights];"
7584
7585
//
7586
// Texture Environment and Generation, p. 152, p. 40-42.
7587
//
7588
"uniform vec4 gl_TextureEnvColor[gl_MaxTextureImageUnits];"
7589
"uniform vec4 gl_EyePlaneS[gl_MaxTextureCoords];"
7590
"uniform vec4 gl_EyePlaneT[gl_MaxTextureCoords];"
7591
"uniform vec4 gl_EyePlaneR[gl_MaxTextureCoords];"
7592
"uniform vec4 gl_EyePlaneQ[gl_MaxTextureCoords];"
7593
"uniform vec4 gl_ObjectPlaneS[gl_MaxTextureCoords];"
7594
"uniform vec4 gl_ObjectPlaneT[gl_MaxTextureCoords];"
7595
"uniform vec4 gl_ObjectPlaneR[gl_MaxTextureCoords];"
7596
"uniform vec4 gl_ObjectPlaneQ[gl_MaxTextureCoords];");
7597
}
7598
7599
if (version >= 130) {
7600
snprintf(builtInConstant, maxSize, "const int gl_MaxClipDistances = %d;", resources.maxClipDistances);
7601
s.append(builtInConstant);
7602
snprintf(builtInConstant, maxSize, "const int gl_MaxVaryingComponents = %d;", resources.maxVaryingComponents);
7603
s.append(builtInConstant);
7604
7605
// GL_ARB_shading_language_420pack
7606
snprintf(builtInConstant, maxSize, "const mediump int gl_MinProgramTexelOffset = %d;", resources.minProgramTexelOffset);
7607
s.append(builtInConstant);
7608
snprintf(builtInConstant, maxSize, "const mediump int gl_MaxProgramTexelOffset = %d;", resources.maxProgramTexelOffset);
7609
s.append(builtInConstant);
7610
}
7611
7612
// geometry
7613
if (version >= 150) {
7614
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryInputComponents = %d;", resources.maxGeometryInputComponents);
7615
s.append(builtInConstant);
7616
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputComponents = %d;", resources.maxGeometryOutputComponents);
7617
s.append(builtInConstant);
7618
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTextureImageUnits = %d;", resources.maxGeometryTextureImageUnits);
7619
s.append(builtInConstant);
7620
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryOutputVertices = %d;", resources.maxGeometryOutputVertices);
7621
s.append(builtInConstant);
7622
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryTotalOutputComponents = %d;", resources.maxGeometryTotalOutputComponents);
7623
s.append(builtInConstant);
7624
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryUniformComponents = %d;", resources.maxGeometryUniformComponents);
7625
s.append(builtInConstant);
7626
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryVaryingComponents = %d;", resources.maxGeometryVaryingComponents);
7627
s.append(builtInConstant);
7628
7629
}
7630
7631
if (version >= 150) {
7632
snprintf(builtInConstant, maxSize, "const int gl_MaxVertexOutputComponents = %d;", resources.maxVertexOutputComponents);
7633
s.append(builtInConstant);
7634
snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentInputComponents = %d;", resources.maxFragmentInputComponents);
7635
s.append(builtInConstant);
7636
}
7637
7638
// tessellation
7639
if (version >= 150) {
7640
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlInputComponents = %d;", resources.maxTessControlInputComponents);
7641
s.append(builtInConstant);
7642
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlOutputComponents = %d;", resources.maxTessControlOutputComponents);
7643
s.append(builtInConstant);
7644
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlTextureImageUnits = %d;", resources.maxTessControlTextureImageUnits);
7645
s.append(builtInConstant);
7646
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlUniformComponents = %d;", resources.maxTessControlUniformComponents);
7647
s.append(builtInConstant);
7648
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlTotalOutputComponents = %d;", resources.maxTessControlTotalOutputComponents);
7649
s.append(builtInConstant);
7650
7651
snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationInputComponents = %d;", resources.maxTessEvaluationInputComponents);
7652
s.append(builtInConstant);
7653
snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationOutputComponents = %d;", resources.maxTessEvaluationOutputComponents);
7654
s.append(builtInConstant);
7655
snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationTextureImageUnits = %d;", resources.maxTessEvaluationTextureImageUnits);
7656
s.append(builtInConstant);
7657
snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationUniformComponents = %d;", resources.maxTessEvaluationUniformComponents);
7658
s.append(builtInConstant);
7659
7660
snprintf(builtInConstant, maxSize, "const int gl_MaxTessPatchComponents = %d;", resources.maxTessPatchComponents);
7661
s.append(builtInConstant);
7662
snprintf(builtInConstant, maxSize, "const int gl_MaxTessGenLevel = %d;", resources.maxTessGenLevel);
7663
s.append(builtInConstant);
7664
snprintf(builtInConstant, maxSize, "const int gl_MaxPatchVertices = %d;", resources.maxPatchVertices);
7665
s.append(builtInConstant);
7666
7667
// this is here instead of with the others in initialize(version, profile) due to the dependence on gl_MaxPatchVertices
7668
if (language == EShLangTessControl || language == EShLangTessEvaluation) {
7669
s.append(
7670
"in gl_PerVertex {"
7671
"vec4 gl_Position;"
7672
"float gl_PointSize;"
7673
"float gl_ClipDistance[];"
7674
);
7675
if (profile == ECompatibilityProfile)
7676
s.append(
7677
"vec4 gl_ClipVertex;"
7678
"vec4 gl_FrontColor;"
7679
"vec4 gl_BackColor;"
7680
"vec4 gl_FrontSecondaryColor;"
7681
"vec4 gl_BackSecondaryColor;"
7682
"vec4 gl_TexCoord[];"
7683
"float gl_FogFragCoord;"
7684
);
7685
if (profile != EEsProfile && version >= 450)
7686
s.append(
7687
"float gl_CullDistance[];"
7688
"vec4 gl_SecondaryPositionNV;" // GL_NV_stereo_view_rendering
7689
"vec4 gl_PositionPerViewNV[];" // GL_NVX_multiview_per_view_attributes
7690
);
7691
s.append(
7692
"} gl_in[gl_MaxPatchVertices];"
7693
"\n");
7694
}
7695
}
7696
7697
if (version >= 150) {
7698
snprintf(builtInConstant, maxSize, "const int gl_MaxViewports = %d;", resources.maxViewports);
7699
s.append(builtInConstant);
7700
}
7701
7702
// images
7703
if (version >= 130) {
7704
snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedImageUnitsAndFragmentOutputs = %d;", resources.maxCombinedImageUnitsAndFragmentOutputs);
7705
s.append(builtInConstant);
7706
snprintf(builtInConstant, maxSize, "const int gl_MaxImageSamples = %d;", resources.maxImageSamples);
7707
s.append(builtInConstant);
7708
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlImageUniforms = %d;", resources.maxTessControlImageUniforms);
7709
s.append(builtInConstant);
7710
snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationImageUniforms = %d;", resources.maxTessEvaluationImageUniforms);
7711
s.append(builtInConstant);
7712
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryImageUniforms = %d;", resources.maxGeometryImageUniforms);
7713
s.append(builtInConstant);
7714
}
7715
7716
// enhanced layouts
7717
if (version >= 430) {
7718
snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackBuffers = %d;", resources.maxTransformFeedbackBuffers);
7719
s.append(builtInConstant);
7720
snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackInterleavedComponents = %d;", resources.maxTransformFeedbackInterleavedComponents);
7721
s.append(builtInConstant);
7722
}
7723
}
7724
7725
// compute
7726
if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) {
7727
snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupCount = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupCountX,
7728
resources.maxComputeWorkGroupCountY,
7729
resources.maxComputeWorkGroupCountZ);
7730
s.append(builtInConstant);
7731
snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupSize = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupSizeX,
7732
resources.maxComputeWorkGroupSizeY,
7733
resources.maxComputeWorkGroupSizeZ);
7734
s.append(builtInConstant);
7735
7736
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeUniformComponents = %d;", resources.maxComputeUniformComponents);
7737
s.append(builtInConstant);
7738
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeTextureImageUnits = %d;", resources.maxComputeTextureImageUnits);
7739
s.append(builtInConstant);
7740
7741
s.append("\n");
7742
}
7743
7744
// images (some in compute below)
7745
if ((profile == EEsProfile && version >= 310) ||
7746
(profile != EEsProfile && version >= 130)) {
7747
snprintf(builtInConstant, maxSize, "const int gl_MaxImageUnits = %d;", resources.maxImageUnits);
7748
s.append(builtInConstant);
7749
snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedShaderOutputResources = %d;", resources.maxCombinedShaderOutputResources);
7750
s.append(builtInConstant);
7751
snprintf(builtInConstant, maxSize, "const int gl_MaxVertexImageUniforms = %d;", resources.maxVertexImageUniforms);
7752
s.append(builtInConstant);
7753
snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentImageUniforms = %d;", resources.maxFragmentImageUniforms);
7754
s.append(builtInConstant);
7755
snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedImageUniforms = %d;", resources.maxCombinedImageUniforms);
7756
s.append(builtInConstant);
7757
}
7758
7759
// compute
7760
if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) {
7761
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeImageUniforms = %d;", resources.maxComputeImageUniforms);
7762
s.append(builtInConstant);
7763
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounters = %d;", resources.maxComputeAtomicCounters);
7764
s.append(builtInConstant);
7765
snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounterBuffers = %d;", resources.maxComputeAtomicCounterBuffers);
7766
s.append(builtInConstant);
7767
7768
s.append("\n");
7769
}
7770
7771
// atomic counters (some in compute below)
7772
if ((profile == EEsProfile && version >= 310) ||
7773
(profile != EEsProfile && version >= 420)) {
7774
snprintf(builtInConstant, maxSize, "const int gl_MaxVertexAtomicCounters = %d;", resources. maxVertexAtomicCounters);
7775
s.append(builtInConstant);
7776
snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentAtomicCounters = %d;", resources. maxFragmentAtomicCounters);
7777
s.append(builtInConstant);
7778
snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedAtomicCounters = %d;", resources. maxCombinedAtomicCounters);
7779
s.append(builtInConstant);
7780
snprintf(builtInConstant, maxSize, "const int gl_MaxAtomicCounterBindings = %d;", resources. maxAtomicCounterBindings);
7781
s.append(builtInConstant);
7782
snprintf(builtInConstant, maxSize, "const int gl_MaxVertexAtomicCounterBuffers = %d;", resources. maxVertexAtomicCounterBuffers);
7783
s.append(builtInConstant);
7784
snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentAtomicCounterBuffers = %d;", resources. maxFragmentAtomicCounterBuffers);
7785
s.append(builtInConstant);
7786
snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedAtomicCounterBuffers = %d;", resources. maxCombinedAtomicCounterBuffers);
7787
s.append(builtInConstant);
7788
snprintf(builtInConstant, maxSize, "const int gl_MaxAtomicCounterBufferSize = %d;", resources. maxAtomicCounterBufferSize);
7789
s.append(builtInConstant);
7790
}
7791
if (profile != EEsProfile && version >= 420) {
7792
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlAtomicCounters = %d;", resources. maxTessControlAtomicCounters);
7793
s.append(builtInConstant);
7794
snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationAtomicCounters = %d;", resources. maxTessEvaluationAtomicCounters);
7795
s.append(builtInConstant);
7796
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounters = %d;", resources. maxGeometryAtomicCounters);
7797
s.append(builtInConstant);
7798
snprintf(builtInConstant, maxSize, "const int gl_MaxTessControlAtomicCounterBuffers = %d;", resources. maxTessControlAtomicCounterBuffers);
7799
s.append(builtInConstant);
7800
snprintf(builtInConstant, maxSize, "const int gl_MaxTessEvaluationAtomicCounterBuffers = %d;", resources. maxTessEvaluationAtomicCounterBuffers);
7801
s.append(builtInConstant);
7802
snprintf(builtInConstant, maxSize, "const int gl_MaxGeometryAtomicCounterBuffers = %d;", resources. maxGeometryAtomicCounterBuffers);
7803
s.append(builtInConstant);
7804
7805
s.append("\n");
7806
}
7807
7808
// GL_ARB_cull_distance
7809
if (profile != EEsProfile && version >= 450) {
7810
snprintf(builtInConstant, maxSize, "const int gl_MaxCullDistances = %d;", resources.maxCullDistances);
7811
s.append(builtInConstant);
7812
snprintf(builtInConstant, maxSize, "const int gl_MaxCombinedClipAndCullDistances = %d;", resources.maxCombinedClipAndCullDistances);
7813
s.append(builtInConstant);
7814
}
7815
7816
// GL_ARB_ES3_1_compatibility
7817
if ((profile != EEsProfile && version >= 450) ||
7818
(profile == EEsProfile && version >= 310)) {
7819
snprintf(builtInConstant, maxSize, "const int gl_MaxSamples = %d;", resources.maxSamples);
7820
s.append(builtInConstant);
7821
}
7822
7823
// SPV_NV_mesh_shader
7824
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
7825
snprintf(builtInConstant, maxSize, "const int gl_MaxMeshOutputVerticesNV = %d;", resources.maxMeshOutputVerticesNV);
7826
s.append(builtInConstant);
7827
7828
snprintf(builtInConstant, maxSize, "const int gl_MaxMeshOutputPrimitivesNV = %d;", resources.maxMeshOutputPrimitivesNV);
7829
s.append(builtInConstant);
7830
7831
snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxMeshWorkGroupSizeNV = ivec3(%d,%d,%d);", resources.maxMeshWorkGroupSizeX_NV,
7832
resources.maxMeshWorkGroupSizeY_NV,
7833
resources.maxMeshWorkGroupSizeZ_NV);
7834
s.append(builtInConstant);
7835
snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxTaskWorkGroupSizeNV = ivec3(%d,%d,%d);", resources.maxTaskWorkGroupSizeX_NV,
7836
resources.maxTaskWorkGroupSizeY_NV,
7837
resources.maxTaskWorkGroupSizeZ_NV);
7838
s.append(builtInConstant);
7839
7840
snprintf(builtInConstant, maxSize, "const int gl_MaxMeshViewCountNV = %d;", resources.maxMeshViewCountNV);
7841
s.append(builtInConstant);
7842
7843
s.append("\n");
7844
}
7845
7846
s.append("\n");
7847
}
7848
7849
//
7850
// To support special built-ins that have a special qualifier that cannot be declared textually
7851
// in a shader, like gl_Position.
7852
//
7853
// This lets the type of the built-in be declared textually, and then have just its qualifier be
7854
// updated afterward.
7855
//
7856
// Safe to call even if name is not present.
7857
//
7858
// Only use this for built-in variables that have a special qualifier in TStorageQualifier.
7859
// New built-in variables should use a generic (textually declarable) qualifier in
7860
// TStoraregQualifier and only call BuiltInVariable().
7861
//
7862
static void SpecialQualifier(const char* name, TStorageQualifier qualifier, TBuiltInVariable builtIn, TSymbolTable& symbolTable)
7863
{
7864
TSymbol* symbol = symbolTable.find(name);
7865
if (symbol == nullptr)
7866
return;
7867
7868
TQualifier& symQualifier = symbol->getWritableType().getQualifier();
7869
symQualifier.storage = qualifier;
7870
symQualifier.builtIn = builtIn;
7871
}
7872
7873
//
7874
// Modify the symbol's flat decoration.
7875
//
7876
// Safe to call even if name is not present.
7877
//
7878
// Originally written to transform gl_SubGroupSizeARB from uniform to fragment input in Vulkan.
7879
//
7880
static void ModifyFlatDecoration(const char* name, bool flat, TSymbolTable& symbolTable)
7881
{
7882
TSymbol* symbol = symbolTable.find(name);
7883
if (symbol == nullptr)
7884
return;
7885
7886
TQualifier& symQualifier = symbol->getWritableType().getQualifier();
7887
symQualifier.flat = flat;
7888
}
7889
7890
//
7891
// To tag built-in variables with their TBuiltInVariable enum. Use this when the
7892
// normal declaration text already gets the qualifier right, and all that's needed
7893
// is setting the builtIn field. This should be the normal way for all new
7894
// built-in variables.
7895
//
7896
// If SpecialQualifier() was called, this does not need to be called.
7897
//
7898
// Safe to call even if name is not present.
7899
//
7900
static void BuiltInVariable(const char* name, TBuiltInVariable builtIn, TSymbolTable& symbolTable)
7901
{
7902
TSymbol* symbol = symbolTable.find(name);
7903
if (symbol == nullptr)
7904
return;
7905
7906
TQualifier& symQualifier = symbol->getWritableType().getQualifier();
7907
symQualifier.builtIn = builtIn;
7908
}
7909
7910
static void RetargetVariable(const char* from, const char* to, TSymbolTable& symbolTable)
7911
{
7912
symbolTable.retargetSymbol(from, to);
7913
}
7914
7915
//
7916
// For built-in variables inside a named block.
7917
// SpecialQualifier() won't ever go inside a block; their member's qualifier come
7918
// from the qualification of the block.
7919
//
7920
// See comments above for other detail.
7921
//
7922
static void BuiltInVariable(const char* blockName, const char* name, TBuiltInVariable builtIn, TSymbolTable& symbolTable)
7923
{
7924
TSymbol* symbol = symbolTable.find(blockName);
7925
if (symbol == nullptr)
7926
return;
7927
7928
TTypeList& structure = *symbol->getWritableType().getWritableStruct();
7929
for (int i = 0; i < (int)structure.size(); ++i) {
7930
if (structure[i].type->getFieldName().compare(name) == 0) {
7931
structure[i].type->getQualifier().builtIn = builtIn;
7932
return;
7933
}
7934
}
7935
}
7936
7937
//
7938
// Finish adding/processing context-independent built-in symbols.
7939
// 1) Programmatically add symbols that could not be added by simple text strings above.
7940
// 2) Map built-in functions to operators, for those that will turn into an operation node
7941
// instead of remaining a function call.
7942
// 3) Tag extension-related symbols added to their base version with their extensions, so
7943
// that if an early version has the extension turned off, there is an error reported on use.
7944
//
7945
void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable)
7946
{
7947
//
7948
// Tag built-in variables and functions with additional qualifier and extension information
7949
// that cannot be declared with the text strings.
7950
//
7951
7952
// N.B.: a symbol should only be tagged once, and this function is called multiple times, once
7953
// per stage that's used for this profile. So
7954
// - generally, stick common ones in the fragment stage to ensure they are tagged exactly once
7955
// - for ES, which has different precisions for different stages, the coarsest-grained tagging
7956
// for a built-in used in many stages needs to be once for the fragment stage and once for
7957
// the vertex stage
7958
7959
switch(language) {
7960
case EShLangVertex:
7961
if (spvVersion.vulkan > 0) {
7962
BuiltInVariable("gl_VertexIndex", EbvVertexIndex, symbolTable);
7963
BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable);
7964
}
7965
7966
if (spvVersion.vulkan == 0) {
7967
SpecialQualifier("gl_VertexID", EvqVertexId, EbvVertexId, symbolTable);
7968
SpecialQualifier("gl_InstanceID", EvqInstanceId, EbvInstanceId, symbolTable);
7969
if (version < 140)
7970
symbolTable.setVariableExtensions("gl_InstanceID", 1, &E_GL_EXT_draw_instanced);
7971
}
7972
7973
if (spvVersion.vulkan > 0 && spvVersion.vulkanRelaxed) {
7974
// treat these built-ins as aliases of VertexIndex and InstanceIndex
7975
RetargetVariable("gl_InstanceID", "gl_InstanceIndex", symbolTable);
7976
RetargetVariable("gl_VertexID", "gl_VertexIndex", symbolTable);
7977
}
7978
7979
if (profile != EEsProfile) {
7980
if (version >= 440) {
7981
symbolTable.setVariableExtensions("gl_BaseVertexARB", 1, &E_GL_ARB_shader_draw_parameters);
7982
symbolTable.setVariableExtensions("gl_BaseInstanceARB", 1, &E_GL_ARB_shader_draw_parameters);
7983
symbolTable.setVariableExtensions("gl_DrawIDARB", 1, &E_GL_ARB_shader_draw_parameters);
7984
BuiltInVariable("gl_BaseVertexARB", EbvBaseVertex, symbolTable);
7985
BuiltInVariable("gl_BaseInstanceARB", EbvBaseInstance, symbolTable);
7986
BuiltInVariable("gl_DrawIDARB", EbvDrawId, symbolTable);
7987
}
7988
if (version >= 460) {
7989
BuiltInVariable("gl_BaseVertex", EbvBaseVertex, symbolTable);
7990
BuiltInVariable("gl_BaseInstance", EbvBaseInstance, symbolTable);
7991
BuiltInVariable("gl_DrawID", EbvDrawId, symbolTable);
7992
}
7993
symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);
7994
symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot);
7995
symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot);
7996
symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot);
7997
symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot);
7998
symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot);
7999
symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot);
8000
8001
symbolTable.setFunctionExtensions("ballotARB", 1, &E_GL_ARB_shader_ballot);
8002
symbolTable.setFunctionExtensions("readInvocationARB", 1, &E_GL_ARB_shader_ballot);
8003
symbolTable.setFunctionExtensions("readFirstInvocationARB", 1, &E_GL_ARB_shader_ballot);
8004
8005
if (version >= 430) {
8006
symbolTable.setFunctionExtensions("anyInvocationARB", 1, &E_GL_ARB_shader_group_vote);
8007
symbolTable.setFunctionExtensions("allInvocationsARB", 1, &E_GL_ARB_shader_group_vote);
8008
symbolTable.setFunctionExtensions("allInvocationsEqualARB", 1, &E_GL_ARB_shader_group_vote);
8009
}
8010
}
8011
8012
8013
if (profile != EEsProfile) {
8014
symbolTable.setFunctionExtensions("minInvocationsAMD", 1, &E_GL_AMD_shader_ballot);
8015
symbolTable.setFunctionExtensions("maxInvocationsAMD", 1, &E_GL_AMD_shader_ballot);
8016
symbolTable.setFunctionExtensions("addInvocationsAMD", 1, &E_GL_AMD_shader_ballot);
8017
symbolTable.setFunctionExtensions("minInvocationsNonUniformAMD", 1, &E_GL_AMD_shader_ballot);
8018
symbolTable.setFunctionExtensions("maxInvocationsNonUniformAMD", 1, &E_GL_AMD_shader_ballot);
8019
symbolTable.setFunctionExtensions("addInvocationsNonUniformAMD", 1, &E_GL_AMD_shader_ballot);
8020
symbolTable.setFunctionExtensions("swizzleInvocationsAMD", 1, &E_GL_AMD_shader_ballot);
8021
symbolTable.setFunctionExtensions("swizzleInvocationsWithPatternAMD", 1, &E_GL_AMD_shader_ballot);
8022
symbolTable.setFunctionExtensions("writeInvocationAMD", 1, &E_GL_AMD_shader_ballot);
8023
symbolTable.setFunctionExtensions("mbcntAMD", 1, &E_GL_AMD_shader_ballot);
8024
8025
symbolTable.setFunctionExtensions("minInvocationsInclusiveScanAMD", 1, &E_GL_AMD_shader_ballot);
8026
symbolTable.setFunctionExtensions("maxInvocationsInclusiveScanAMD", 1, &E_GL_AMD_shader_ballot);
8027
symbolTable.setFunctionExtensions("addInvocationsInclusiveScanAMD", 1, &E_GL_AMD_shader_ballot);
8028
symbolTable.setFunctionExtensions("minInvocationsInclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot);
8029
symbolTable.setFunctionExtensions("maxInvocationsInclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot);
8030
symbolTable.setFunctionExtensions("addInvocationsInclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot);
8031
symbolTable.setFunctionExtensions("minInvocationsExclusiveScanAMD", 1, &E_GL_AMD_shader_ballot);
8032
symbolTable.setFunctionExtensions("maxInvocationsExclusiveScanAMD", 1, &E_GL_AMD_shader_ballot);
8033
symbolTable.setFunctionExtensions("addInvocationsExclusiveScanAMD", 1, &E_GL_AMD_shader_ballot);
8034
symbolTable.setFunctionExtensions("minInvocationsExclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot);
8035
symbolTable.setFunctionExtensions("maxInvocationsExclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot);
8036
symbolTable.setFunctionExtensions("addInvocationsExclusiveScanNonUniformAMD", 1, &E_GL_AMD_shader_ballot);
8037
}
8038
8039
if (profile != EEsProfile) {
8040
symbolTable.setFunctionExtensions("min3", 1, &E_GL_AMD_shader_trinary_minmax);
8041
symbolTable.setFunctionExtensions("max3", 1, &E_GL_AMD_shader_trinary_minmax);
8042
symbolTable.setFunctionExtensions("mid3", 1, &E_GL_AMD_shader_trinary_minmax);
8043
}
8044
8045
if (profile != EEsProfile) {
8046
symbolTable.setVariableExtensions("gl_SIMDGroupSizeAMD", 1, &E_GL_AMD_gcn_shader);
8047
SpecialQualifier("gl_SIMDGroupSizeAMD", EvqVaryingIn, EbvSubGroupSize, symbolTable);
8048
8049
symbolTable.setFunctionExtensions("cubeFaceIndexAMD", 1, &E_GL_AMD_gcn_shader);
8050
symbolTable.setFunctionExtensions("cubeFaceCoordAMD", 1, &E_GL_AMD_gcn_shader);
8051
symbolTable.setFunctionExtensions("timeAMD", 1, &E_GL_AMD_gcn_shader);
8052
}
8053
8054
if (profile != EEsProfile) {
8055
symbolTable.setFunctionExtensions("fragmentMaskFetchAMD", 1, &E_GL_AMD_shader_fragment_mask);
8056
symbolTable.setFunctionExtensions("fragmentFetchAMD", 1, &E_GL_AMD_shader_fragment_mask);
8057
}
8058
8059
symbolTable.setFunctionExtensions("countLeadingZeros", 1, &E_GL_INTEL_shader_integer_functions2);
8060
symbolTable.setFunctionExtensions("countTrailingZeros", 1, &E_GL_INTEL_shader_integer_functions2);
8061
symbolTable.setFunctionExtensions("absoluteDifference", 1, &E_GL_INTEL_shader_integer_functions2);
8062
symbolTable.setFunctionExtensions("addSaturate", 1, &E_GL_INTEL_shader_integer_functions2);
8063
symbolTable.setFunctionExtensions("subtractSaturate", 1, &E_GL_INTEL_shader_integer_functions2);
8064
symbolTable.setFunctionExtensions("average", 1, &E_GL_INTEL_shader_integer_functions2);
8065
symbolTable.setFunctionExtensions("averageRounded", 1, &E_GL_INTEL_shader_integer_functions2);
8066
symbolTable.setFunctionExtensions("multiply32x16", 1, &E_GL_INTEL_shader_integer_functions2);
8067
8068
symbolTable.setFunctionExtensions("textureFootprintNV", 1, &E_GL_NV_shader_texture_footprint);
8069
symbolTable.setFunctionExtensions("textureFootprintClampNV", 1, &E_GL_NV_shader_texture_footprint);
8070
symbolTable.setFunctionExtensions("textureFootprintLodNV", 1, &E_GL_NV_shader_texture_footprint);
8071
symbolTable.setFunctionExtensions("textureFootprintGradNV", 1, &E_GL_NV_shader_texture_footprint);
8072
symbolTable.setFunctionExtensions("textureFootprintGradClampNV", 1, &E_GL_NV_shader_texture_footprint);
8073
// Compatibility variables, vertex only
8074
if (spvVersion.spv == 0) {
8075
BuiltInVariable("gl_Color", EbvColor, symbolTable);
8076
BuiltInVariable("gl_SecondaryColor", EbvSecondaryColor, symbolTable);
8077
BuiltInVariable("gl_Normal", EbvNormal, symbolTable);
8078
BuiltInVariable("gl_Vertex", EbvVertex, symbolTable);
8079
BuiltInVariable("gl_MultiTexCoord0", EbvMultiTexCoord0, symbolTable);
8080
BuiltInVariable("gl_MultiTexCoord1", EbvMultiTexCoord1, symbolTable);
8081
BuiltInVariable("gl_MultiTexCoord2", EbvMultiTexCoord2, symbolTable);
8082
BuiltInVariable("gl_MultiTexCoord3", EbvMultiTexCoord3, symbolTable);
8083
BuiltInVariable("gl_MultiTexCoord4", EbvMultiTexCoord4, symbolTable);
8084
BuiltInVariable("gl_MultiTexCoord5", EbvMultiTexCoord5, symbolTable);
8085
BuiltInVariable("gl_MultiTexCoord6", EbvMultiTexCoord6, symbolTable);
8086
BuiltInVariable("gl_MultiTexCoord7", EbvMultiTexCoord7, symbolTable);
8087
BuiltInVariable("gl_FogCoord", EbvFogFragCoord, symbolTable);
8088
}
8089
8090
if (profile == EEsProfile) {
8091
if (spvVersion.spv == 0) {
8092
symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod);
8093
symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod);
8094
symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod);
8095
if (version == 310)
8096
symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5);
8097
}
8098
if (version == 310)
8099
symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5);
8100
}
8101
8102
if (profile == EEsProfile && version < 320) {
8103
symbolTable.setFunctionExtensions("imageAtomicAdd", 1, &E_GL_OES_shader_image_atomic);
8104
symbolTable.setFunctionExtensions("imageAtomicMin", 1, &E_GL_OES_shader_image_atomic);
8105
symbolTable.setFunctionExtensions("imageAtomicMax", 1, &E_GL_OES_shader_image_atomic);
8106
symbolTable.setFunctionExtensions("imageAtomicAnd", 1, &E_GL_OES_shader_image_atomic);
8107
symbolTable.setFunctionExtensions("imageAtomicOr", 1, &E_GL_OES_shader_image_atomic);
8108
symbolTable.setFunctionExtensions("imageAtomicXor", 1, &E_GL_OES_shader_image_atomic);
8109
symbolTable.setFunctionExtensions("imageAtomicExchange", 1, &E_GL_OES_shader_image_atomic);
8110
symbolTable.setFunctionExtensions("imageAtomicCompSwap", 1, &E_GL_OES_shader_image_atomic);
8111
}
8112
8113
if (version >= 300 /* both ES and non-ES */) {
8114
symbolTable.setVariableExtensions("gl_ViewID_OVR", Num_OVR_multiview_EXTs, OVR_multiview_EXTs);
8115
BuiltInVariable("gl_ViewID_OVR", EbvViewIndex, symbolTable);
8116
}
8117
8118
if (profile == EEsProfile) {
8119
symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers);
8120
symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers);
8121
}
8122
8123
// E_GL_EXT_texture_array
8124
if (profile != EEsProfile && spvVersion.spv == 0) {
8125
symbolTable.setFunctionExtensions("texture1DArray", 1, &E_GL_EXT_texture_array);
8126
symbolTable.setFunctionExtensions("texture2DArray", 1, &E_GL_EXT_texture_array);
8127
symbolTable.setFunctionExtensions("shadow1DArray", 1, &E_GL_EXT_texture_array);
8128
symbolTable.setFunctionExtensions("shadow2DArray", 1, &E_GL_EXT_texture_array);
8129
8130
symbolTable.setFunctionExtensions("texture1DArrayLod", 1, &E_GL_EXT_texture_array);
8131
symbolTable.setFunctionExtensions("texture2DArrayLod", 1, &E_GL_EXT_texture_array);
8132
symbolTable.setFunctionExtensions("shadow1DArrayLod", 1, &E_GL_EXT_texture_array);
8133
}
8134
[[fallthrough]];
8135
8136
case EShLangTessControl:
8137
if (profile == EEsProfile && version >= 310) {
8138
BuiltInVariable("gl_BoundingBoxEXT", EbvBoundingBox, symbolTable);
8139
symbolTable.setVariableExtensions("gl_BoundingBoxEXT", 1,
8140
&E_GL_EXT_primitive_bounding_box);
8141
BuiltInVariable("gl_BoundingBoxOES", EbvBoundingBox, symbolTable);
8142
symbolTable.setVariableExtensions("gl_BoundingBoxOES", 1,
8143
&E_GL_OES_primitive_bounding_box);
8144
8145
if (version >= 320) {
8146
BuiltInVariable("gl_BoundingBox", EbvBoundingBox, symbolTable);
8147
}
8148
}
8149
[[fallthrough]];
8150
8151
case EShLangTessEvaluation:
8152
case EShLangGeometry:
8153
SpecialQualifier("gl_Position", EvqPosition, EbvPosition, symbolTable);
8154
SpecialQualifier("gl_PointSize", EvqPointSize, EbvPointSize, symbolTable);
8155
8156
BuiltInVariable("gl_in", "gl_Position", EbvPosition, symbolTable);
8157
BuiltInVariable("gl_in", "gl_PointSize", EbvPointSize, symbolTable);
8158
8159
BuiltInVariable("gl_out", "gl_Position", EbvPosition, symbolTable);
8160
BuiltInVariable("gl_out", "gl_PointSize", EbvPointSize, symbolTable);
8161
8162
SpecialQualifier("gl_ClipVertex", EvqClipVertex, EbvClipVertex, symbolTable);
8163
8164
BuiltInVariable("gl_in", "gl_ClipDistance", EbvClipDistance, symbolTable);
8165
BuiltInVariable("gl_in", "gl_CullDistance", EbvCullDistance, symbolTable);
8166
8167
BuiltInVariable("gl_out", "gl_ClipDistance", EbvClipDistance, symbolTable);
8168
BuiltInVariable("gl_out", "gl_CullDistance", EbvCullDistance, symbolTable);
8169
8170
BuiltInVariable("gl_ClipDistance", EbvClipDistance, symbolTable);
8171
BuiltInVariable("gl_CullDistance", EbvCullDistance, symbolTable);
8172
BuiltInVariable("gl_PrimitiveIDIn", EbvPrimitiveId, symbolTable);
8173
BuiltInVariable("gl_PrimitiveID", EbvPrimitiveId, symbolTable);
8174
BuiltInVariable("gl_InvocationID", EbvInvocationId, symbolTable);
8175
BuiltInVariable("gl_Layer", EbvLayer, symbolTable);
8176
BuiltInVariable("gl_ViewportIndex", EbvViewportIndex, symbolTable);
8177
8178
if (language != EShLangGeometry) {
8179
symbolTable.setVariableExtensions("gl_Layer", Num_viewportEXTs, viewportEXTs);
8180
symbolTable.setVariableExtensions("gl_ViewportIndex", Num_viewportEXTs, viewportEXTs);
8181
}
8182
symbolTable.setVariableExtensions("gl_ViewportMask", 1, &E_GL_NV_viewport_array2);
8183
symbolTable.setVariableExtensions("gl_SecondaryPositionNV", 1, &E_GL_NV_stereo_view_rendering);
8184
symbolTable.setVariableExtensions("gl_SecondaryViewportMaskNV", 1, &E_GL_NV_stereo_view_rendering);
8185
symbolTable.setVariableExtensions("gl_PositionPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes);
8186
symbolTable.setVariableExtensions("gl_ViewportMaskPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes);
8187
8188
BuiltInVariable("gl_ViewportMask", EbvViewportMaskNV, symbolTable);
8189
BuiltInVariable("gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable);
8190
BuiltInVariable("gl_SecondaryViewportMaskNV", EbvSecondaryViewportMaskNV, symbolTable);
8191
BuiltInVariable("gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable);
8192
BuiltInVariable("gl_ViewportMaskPerViewNV", EbvViewportMaskPerViewNV, symbolTable);
8193
8194
if (language == EShLangVertex || language == EShLangGeometry) {
8195
symbolTable.setVariableExtensions("gl_in", "gl_SecondaryPositionNV", 1, &E_GL_NV_stereo_view_rendering);
8196
symbolTable.setVariableExtensions("gl_in", "gl_PositionPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes);
8197
8198
BuiltInVariable("gl_in", "gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable);
8199
BuiltInVariable("gl_in", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable);
8200
}
8201
symbolTable.setVariableExtensions("gl_out", "gl_ViewportMask", 1, &E_GL_NV_viewport_array2);
8202
symbolTable.setVariableExtensions("gl_out", "gl_SecondaryPositionNV", 1, &E_GL_NV_stereo_view_rendering);
8203
symbolTable.setVariableExtensions("gl_out", "gl_SecondaryViewportMaskNV", 1, &E_GL_NV_stereo_view_rendering);
8204
symbolTable.setVariableExtensions("gl_out", "gl_PositionPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes);
8205
symbolTable.setVariableExtensions("gl_out", "gl_ViewportMaskPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes);
8206
8207
BuiltInVariable("gl_out", "gl_ViewportMask", EbvViewportMaskNV, symbolTable);
8208
BuiltInVariable("gl_out", "gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable);
8209
BuiltInVariable("gl_out", "gl_SecondaryViewportMaskNV", EbvSecondaryViewportMaskNV, symbolTable);
8210
BuiltInVariable("gl_out", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable);
8211
BuiltInVariable("gl_out", "gl_ViewportMaskPerViewNV", EbvViewportMaskPerViewNV, symbolTable);
8212
8213
BuiltInVariable("gl_PatchVerticesIn", EbvPatchVertices, symbolTable);
8214
BuiltInVariable("gl_TessLevelOuter", EbvTessLevelOuter, symbolTable);
8215
BuiltInVariable("gl_TessLevelInner", EbvTessLevelInner, symbolTable);
8216
BuiltInVariable("gl_TessCoord", EbvTessCoord, symbolTable);
8217
8218
if (version < 410)
8219
symbolTable.setVariableExtensions("gl_ViewportIndex", 1, &E_GL_ARB_viewport_array);
8220
8221
// Compatibility variables
8222
8223
BuiltInVariable("gl_in", "gl_ClipVertex", EbvClipVertex, symbolTable);
8224
BuiltInVariable("gl_in", "gl_FrontColor", EbvFrontColor, symbolTable);
8225
BuiltInVariable("gl_in", "gl_BackColor", EbvBackColor, symbolTable);
8226
BuiltInVariable("gl_in", "gl_FrontSecondaryColor", EbvFrontSecondaryColor, symbolTable);
8227
BuiltInVariable("gl_in", "gl_BackSecondaryColor", EbvBackSecondaryColor, symbolTable);
8228
BuiltInVariable("gl_in", "gl_TexCoord", EbvTexCoord, symbolTable);
8229
BuiltInVariable("gl_in", "gl_FogFragCoord", EbvFogFragCoord, symbolTable);
8230
8231
BuiltInVariable("gl_out", "gl_ClipVertex", EbvClipVertex, symbolTable);
8232
BuiltInVariable("gl_out", "gl_FrontColor", EbvFrontColor, symbolTable);
8233
BuiltInVariable("gl_out", "gl_BackColor", EbvBackColor, symbolTable);
8234
BuiltInVariable("gl_out", "gl_FrontSecondaryColor", EbvFrontSecondaryColor, symbolTable);
8235
BuiltInVariable("gl_out", "gl_BackSecondaryColor", EbvBackSecondaryColor, symbolTable);
8236
BuiltInVariable("gl_out", "gl_TexCoord", EbvTexCoord, symbolTable);
8237
BuiltInVariable("gl_out", "gl_FogFragCoord", EbvFogFragCoord, symbolTable);
8238
8239
BuiltInVariable("gl_ClipVertex", EbvClipVertex, symbolTable);
8240
BuiltInVariable("gl_FrontColor", EbvFrontColor, symbolTable);
8241
BuiltInVariable("gl_BackColor", EbvBackColor, symbolTable);
8242
BuiltInVariable("gl_FrontSecondaryColor", EbvFrontSecondaryColor, symbolTable);
8243
BuiltInVariable("gl_BackSecondaryColor", EbvBackSecondaryColor, symbolTable);
8244
BuiltInVariable("gl_TexCoord", EbvTexCoord, symbolTable);
8245
BuiltInVariable("gl_FogFragCoord", EbvFogFragCoord, symbolTable);
8246
8247
// gl_PointSize, when it needs to be tied to an extension, is always a member of a block.
8248
// (Sometimes with an instance name, sometimes anonymous).
8249
if (profile == EEsProfile) {
8250
if (language == EShLangGeometry) {
8251
symbolTable.setVariableExtensions("gl_PointSize", Num_AEP_geometry_point_size, AEP_geometry_point_size);
8252
symbolTable.setVariableExtensions("gl_in", "gl_PointSize", Num_AEP_geometry_point_size, AEP_geometry_point_size);
8253
} else if (language == EShLangTessEvaluation || language == EShLangTessControl) {
8254
// gl_in tessellation settings of gl_PointSize are in the context-dependent paths
8255
symbolTable.setVariableExtensions("gl_PointSize", Num_AEP_tessellation_point_size, AEP_tessellation_point_size);
8256
symbolTable.setVariableExtensions("gl_out", "gl_PointSize", Num_AEP_tessellation_point_size, AEP_tessellation_point_size);
8257
}
8258
}
8259
8260
if ((profile != EEsProfile && version >= 140) ||
8261
(profile == EEsProfile && version >= 310)) {
8262
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
8263
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
8264
symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
8265
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
8266
}
8267
8268
if (profile != EEsProfile) {
8269
BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable);
8270
BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable);
8271
BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable);
8272
BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable);
8273
BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);
8274
BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable);
8275
8276
if (spvVersion.vulkan > 0) {
8277
// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan
8278
SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);
8279
if (language == EShLangFragment)
8280
ModifyFlatDecoration("gl_SubGroupSizeARB", true, symbolTable);
8281
}
8282
else
8283
BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable);
8284
}
8285
8286
// GL_KHR_shader_subgroup
8287
if ((profile == EEsProfile && version >= 310) ||
8288
(profile != EEsProfile && version >= 140)) {
8289
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
8290
symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);
8291
symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);
8292
symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
8293
symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
8294
symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
8295
symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
8296
8297
BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);
8298
BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);
8299
BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);
8300
BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);
8301
BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);
8302
BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);
8303
BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);
8304
8305
// GL_NV_shader_sm_builtins
8306
symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins);
8307
symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins);
8308
symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins);
8309
symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins);
8310
BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable);
8311
BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);
8312
BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);
8313
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
8314
8315
// GL_ARM_shader_core_builtins
8316
symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);
8317
symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);
8318
symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
8319
symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);
8320
symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
8321
8322
BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);
8323
BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);
8324
BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);
8325
BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);
8326
BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);
8327
}
8328
8329
if (language == EShLangGeometry || language == EShLangVertex) {
8330
if ((profile == EEsProfile && version >= 310) ||
8331
(profile != EEsProfile && version >= 450)) {
8332
symbolTable.setVariableExtensions("gl_PrimitiveShadingRateEXT", 1, &E_GL_EXT_fragment_shading_rate);
8333
BuiltInVariable("gl_PrimitiveShadingRateEXT", EbvPrimitiveShadingRateKHR, symbolTable);
8334
8335
symbolTable.setVariableExtensions("gl_ShadingRateFlag2VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
8336
symbolTable.setVariableExtensions("gl_ShadingRateFlag4VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
8337
symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
8338
symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
8339
}
8340
}
8341
break;
8342
8343
case EShLangFragment:
8344
SpecialQualifier("gl_FrontFacing", EvqFace, EbvFace, symbolTable);
8345
SpecialQualifier("gl_FragCoord", EvqFragCoord, EbvFragCoord, symbolTable);
8346
SpecialQualifier("gl_PointCoord", EvqPointCoord, EbvPointCoord, symbolTable);
8347
if (spvVersion.spv == 0)
8348
SpecialQualifier("gl_FragColor", EvqFragColor, EbvFragColor, symbolTable);
8349
else {
8350
TSymbol* symbol = symbolTable.find("gl_FragColor");
8351
if (symbol) {
8352
symbol->getWritableType().getQualifier().storage = EvqVaryingOut;
8353
symbol->getWritableType().getQualifier().layoutLocation = 0;
8354
}
8355
}
8356
SpecialQualifier("gl_FragDepth", EvqFragDepth, EbvFragDepth, symbolTable);
8357
SpecialQualifier("gl_FragDepthEXT", EvqFragDepth, EbvFragDepth, symbolTable);
8358
SpecialQualifier("gl_FragStencilRefARB", EvqFragStencil, EbvFragStencilRef, symbolTable);
8359
SpecialQualifier("gl_HelperInvocation", EvqVaryingIn, EbvHelperInvocation, symbolTable);
8360
8361
BuiltInVariable("gl_ClipDistance", EbvClipDistance, symbolTable);
8362
BuiltInVariable("gl_CullDistance", EbvCullDistance, symbolTable);
8363
BuiltInVariable("gl_PrimitiveID", EbvPrimitiveId, symbolTable);
8364
8365
if (profile != EEsProfile && version >= 140) {
8366
symbolTable.setVariableExtensions("gl_FragStencilRefARB", 1, &E_GL_ARB_shader_stencil_export);
8367
BuiltInVariable("gl_FragStencilRefARB", EbvFragStencilRef, symbolTable);
8368
}
8369
8370
if (profile != EEsProfile && version < 400) {
8371
symbolTable.setFunctionExtensions("textureQueryLOD", 1, &E_GL_ARB_texture_query_lod);
8372
}
8373
8374
if (profile != EEsProfile && version >= 460) {
8375
symbolTable.setFunctionExtensions("rayQueryInitializeEXT", 1, &E_GL_EXT_ray_query);
8376
symbolTable.setFunctionExtensions("rayQueryTerminateEXT", 1, &E_GL_EXT_ray_query);
8377
symbolTable.setFunctionExtensions("rayQueryGenerateIntersectionEXT", 1, &E_GL_EXT_ray_query);
8378
symbolTable.setFunctionExtensions("rayQueryConfirmIntersectionEXT", 1, &E_GL_EXT_ray_query);
8379
symbolTable.setFunctionExtensions("rayQueryProceedEXT", 1, &E_GL_EXT_ray_query);
8380
symbolTable.setFunctionExtensions("rayQueryGetIntersectionTypeEXT", 1, &E_GL_EXT_ray_query);
8381
symbolTable.setFunctionExtensions("rayQueryGetIntersectionTEXT", 1, &E_GL_EXT_ray_query);
8382
symbolTable.setFunctionExtensions("rayQueryGetRayFlagsEXT", 1, &E_GL_EXT_ray_query);
8383
symbolTable.setFunctionExtensions("rayQueryGetRayTMinEXT", 1, &E_GL_EXT_ray_query);
8384
symbolTable.setFunctionExtensions("rayQueryGetIntersectionInstanceCustomIndexEXT", 1, &E_GL_EXT_ray_query);
8385
symbolTable.setFunctionExtensions("rayQueryGetIntersectionInstanceIdEXT", 1, &E_GL_EXT_ray_query);
8386
symbolTable.setFunctionExtensions("rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT", 1, &E_GL_EXT_ray_query);
8387
symbolTable.setFunctionExtensions("rayQueryGetIntersectionGeometryIndexEXT", 1, &E_GL_EXT_ray_query);
8388
symbolTable.setFunctionExtensions("rayQueryGetIntersectionPrimitiveIndexEXT", 1, &E_GL_EXT_ray_query);
8389
symbolTable.setFunctionExtensions("rayQueryGetIntersectionBarycentricsEXT", 1, &E_GL_EXT_ray_query);
8390
symbolTable.setFunctionExtensions("rayQueryGetIntersectionFrontFaceEXT", 1, &E_GL_EXT_ray_query);
8391
symbolTable.setFunctionExtensions("rayQueryGetIntersectionCandidateAABBOpaqueEXT", 1, &E_GL_EXT_ray_query);
8392
symbolTable.setFunctionExtensions("rayQueryGetIntersectionObjectRayDirectionEXT", 1, &E_GL_EXT_ray_query);
8393
symbolTable.setFunctionExtensions("rayQueryGetIntersectionObjectRayOriginEXT", 1, &E_GL_EXT_ray_query);
8394
symbolTable.setFunctionExtensions("rayQueryGetIntersectionObjectToWorldEXT", 1, &E_GL_EXT_ray_query);
8395
symbolTable.setFunctionExtensions("rayQueryGetIntersectionWorldToObjectEXT", 1, &E_GL_EXT_ray_query);
8396
symbolTable.setFunctionExtensions("rayQueryGetWorldRayOriginEXT", 1, &E_GL_EXT_ray_query);
8397
symbolTable.setFunctionExtensions("rayQueryGetWorldRayDirectionEXT", 1, &E_GL_EXT_ray_query);
8398
symbolTable.setFunctionExtensions("rayQueryGetIntersectionTriangleVertexPositionsEXT", 1, &E_GL_EXT_ray_tracing_position_fetch);
8399
symbolTable.setVariableExtensions("gl_RayFlagsSkipAABBEXT", 1, &E_GL_EXT_ray_flags_primitive_culling);
8400
symbolTable.setVariableExtensions("gl_RayFlagsSkipTrianglesEXT", 1, &E_GL_EXT_ray_flags_primitive_culling);
8401
symbolTable.setVariableExtensions("gl_RayFlagsForceOpacityMicromap2StateEXT", 1, &E_GL_EXT_opacity_micromap);
8402
}
8403
8404
if ((profile != EEsProfile && version >= 130) ||
8405
(profile == EEsProfile && version >= 310)) {
8406
BuiltInVariable("gl_SampleID", EbvSampleId, symbolTable);
8407
BuiltInVariable("gl_SamplePosition", EbvSamplePosition, symbolTable);
8408
BuiltInVariable("gl_SampleMask", EbvSampleMask, symbolTable);
8409
8410
if (profile != EEsProfile && version < 400) {
8411
BuiltInVariable("gl_NumSamples", EbvSampleMask, symbolTable);
8412
8413
symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_ARB_sample_shading);
8414
symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_ARB_sample_shading);
8415
symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_ARB_sample_shading);
8416
symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_ARB_sample_shading);
8417
} else {
8418
BuiltInVariable("gl_SampleMaskIn", EbvSampleMask, symbolTable);
8419
8420
if (profile == EEsProfile && version < 320) {
8421
symbolTable.setVariableExtensions("gl_SampleID", 1, &E_GL_OES_sample_variables);
8422
symbolTable.setVariableExtensions("gl_SamplePosition", 1, &E_GL_OES_sample_variables);
8423
symbolTable.setVariableExtensions("gl_SampleMaskIn", 1, &E_GL_OES_sample_variables);
8424
symbolTable.setVariableExtensions("gl_SampleMask", 1, &E_GL_OES_sample_variables);
8425
symbolTable.setVariableExtensions("gl_NumSamples", 1, &E_GL_OES_sample_variables);
8426
}
8427
}
8428
}
8429
8430
BuiltInVariable("gl_Layer", EbvLayer, symbolTable);
8431
BuiltInVariable("gl_ViewportIndex", EbvViewportIndex, symbolTable);
8432
8433
// Compatibility variables
8434
8435
BuiltInVariable("gl_in", "gl_FogFragCoord", EbvFogFragCoord, symbolTable);
8436
BuiltInVariable("gl_in", "gl_TexCoord", EbvTexCoord, symbolTable);
8437
BuiltInVariable("gl_in", "gl_Color", EbvColor, symbolTable);
8438
BuiltInVariable("gl_in", "gl_SecondaryColor", EbvSecondaryColor, symbolTable);
8439
8440
BuiltInVariable("gl_FogFragCoord", EbvFogFragCoord, symbolTable);
8441
BuiltInVariable("gl_TexCoord", EbvTexCoord, symbolTable);
8442
BuiltInVariable("gl_Color", EbvColor, symbolTable);
8443
BuiltInVariable("gl_SecondaryColor", EbvSecondaryColor, symbolTable);
8444
8445
// built-in functions
8446
8447
if (profile == EEsProfile) {
8448
if (spvVersion.spv == 0) {
8449
symbolTable.setFunctionExtensions("texture2DLodEXT", 1, &E_GL_EXT_shader_texture_lod);
8450
symbolTable.setFunctionExtensions("texture2DProjLodEXT", 1, &E_GL_EXT_shader_texture_lod);
8451
symbolTable.setFunctionExtensions("textureCubeLodEXT", 1, &E_GL_EXT_shader_texture_lod);
8452
symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod);
8453
symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod);
8454
symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod);
8455
if (version < 320)
8456
symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5);
8457
}
8458
if (version == 100) {
8459
symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_OES_standard_derivatives);
8460
symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_OES_standard_derivatives);
8461
symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_OES_standard_derivatives);
8462
}
8463
if (version == 310) {
8464
symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5);
8465
symbolTable.setFunctionExtensions("interpolateAtCentroid", 1, &E_GL_OES_shader_multisample_interpolation);
8466
symbolTable.setFunctionExtensions("interpolateAtSample", 1, &E_GL_OES_shader_multisample_interpolation);
8467
symbolTable.setFunctionExtensions("interpolateAtOffset", 1, &E_GL_OES_shader_multisample_interpolation);
8468
}
8469
} else if (version < 130) {
8470
if (spvVersion.spv == 0) {
8471
symbolTable.setFunctionExtensions("texture1DLod", 1, &E_GL_ARB_shader_texture_lod);
8472
symbolTable.setFunctionExtensions("texture2DLod", 1, &E_GL_ARB_shader_texture_lod);
8473
symbolTable.setFunctionExtensions("texture3DLod", 1, &E_GL_ARB_shader_texture_lod);
8474
symbolTable.setFunctionExtensions("textureCubeLod", 1, &E_GL_ARB_shader_texture_lod);
8475
symbolTable.setFunctionExtensions("texture1DProjLod", 1, &E_GL_ARB_shader_texture_lod);
8476
symbolTable.setFunctionExtensions("texture2DProjLod", 1, &E_GL_ARB_shader_texture_lod);
8477
symbolTable.setFunctionExtensions("texture3DProjLod", 1, &E_GL_ARB_shader_texture_lod);
8478
symbolTable.setFunctionExtensions("shadow1DLod", 1, &E_GL_ARB_shader_texture_lod);
8479
symbolTable.setFunctionExtensions("shadow2DLod", 1, &E_GL_ARB_shader_texture_lod);
8480
symbolTable.setFunctionExtensions("shadow1DProjLod", 1, &E_GL_ARB_shader_texture_lod);
8481
symbolTable.setFunctionExtensions("shadow2DProjLod", 1, &E_GL_ARB_shader_texture_lod);
8482
}
8483
}
8484
8485
// E_GL_ARB_shader_texture_lod functions usable only with the extension enabled
8486
if (profile != EEsProfile && spvVersion.spv == 0) {
8487
symbolTable.setFunctionExtensions("texture1DGradARB", 1, &E_GL_ARB_shader_texture_lod);
8488
symbolTable.setFunctionExtensions("texture1DProjGradARB", 1, &E_GL_ARB_shader_texture_lod);
8489
symbolTable.setFunctionExtensions("texture2DGradARB", 1, &E_GL_ARB_shader_texture_lod);
8490
symbolTable.setFunctionExtensions("texture2DProjGradARB", 1, &E_GL_ARB_shader_texture_lod);
8491
symbolTable.setFunctionExtensions("texture3DGradARB", 1, &E_GL_ARB_shader_texture_lod);
8492
symbolTable.setFunctionExtensions("texture3DProjGradARB", 1, &E_GL_ARB_shader_texture_lod);
8493
symbolTable.setFunctionExtensions("textureCubeGradARB", 1, &E_GL_ARB_shader_texture_lod);
8494
symbolTable.setFunctionExtensions("shadow1DGradARB", 1, &E_GL_ARB_shader_texture_lod);
8495
symbolTable.setFunctionExtensions("shadow1DProjGradARB", 1, &E_GL_ARB_shader_texture_lod);
8496
symbolTable.setFunctionExtensions("shadow2DGradARB", 1, &E_GL_ARB_shader_texture_lod);
8497
symbolTable.setFunctionExtensions("shadow2DProjGradARB", 1, &E_GL_ARB_shader_texture_lod);
8498
symbolTable.setFunctionExtensions("texture2DRectGradARB", 1, &E_GL_ARB_shader_texture_lod);
8499
symbolTable.setFunctionExtensions("texture2DRectProjGradARB", 1, &E_GL_ARB_shader_texture_lod);
8500
symbolTable.setFunctionExtensions("shadow2DRectGradARB", 1, &E_GL_ARB_shader_texture_lod);
8501
symbolTable.setFunctionExtensions("shadow2DRectProjGradARB", 1, &E_GL_ARB_shader_texture_lod);
8502
}
8503
8504
// E_GL_ARB_shader_image_load_store
8505
if (profile != EEsProfile && version < 420)
8506
symbolTable.setFunctionExtensions("memoryBarrier", 1, &E_GL_ARB_shader_image_load_store);
8507
// All the image access functions are protected by checks on the type of the first argument.
8508
8509
// E_GL_ARB_shader_atomic_counters
8510
if (profile != EEsProfile && version < 420) {
8511
symbolTable.setFunctionExtensions("atomicCounterIncrement", 1, &E_GL_ARB_shader_atomic_counters);
8512
symbolTable.setFunctionExtensions("atomicCounterDecrement", 1, &E_GL_ARB_shader_atomic_counters);
8513
symbolTable.setFunctionExtensions("atomicCounter" , 1, &E_GL_ARB_shader_atomic_counters);
8514
}
8515
8516
// E_GL_ARB_shader_atomic_counter_ops
8517
if (profile != EEsProfile && version == 450) {
8518
symbolTable.setFunctionExtensions("atomicCounterAddARB" , 1, &E_GL_ARB_shader_atomic_counter_ops);
8519
symbolTable.setFunctionExtensions("atomicCounterSubtractARB", 1, &E_GL_ARB_shader_atomic_counter_ops);
8520
symbolTable.setFunctionExtensions("atomicCounterMinARB" , 1, &E_GL_ARB_shader_atomic_counter_ops);
8521
symbolTable.setFunctionExtensions("atomicCounterMaxARB" , 1, &E_GL_ARB_shader_atomic_counter_ops);
8522
symbolTable.setFunctionExtensions("atomicCounterAndARB" , 1, &E_GL_ARB_shader_atomic_counter_ops);
8523
symbolTable.setFunctionExtensions("atomicCounterOrARB" , 1, &E_GL_ARB_shader_atomic_counter_ops);
8524
symbolTable.setFunctionExtensions("atomicCounterXorARB" , 1, &E_GL_ARB_shader_atomic_counter_ops);
8525
symbolTable.setFunctionExtensions("atomicCounterExchangeARB", 1, &E_GL_ARB_shader_atomic_counter_ops);
8526
symbolTable.setFunctionExtensions("atomicCounterCompSwapARB", 1, &E_GL_ARB_shader_atomic_counter_ops);
8527
}
8528
8529
// E_GL_ARB_derivative_control
8530
if (profile != EEsProfile && version < 450) {
8531
symbolTable.setFunctionExtensions("dFdxFine", 1, &E_GL_ARB_derivative_control);
8532
symbolTable.setFunctionExtensions("dFdyFine", 1, &E_GL_ARB_derivative_control);
8533
symbolTable.setFunctionExtensions("fwidthFine", 1, &E_GL_ARB_derivative_control);
8534
symbolTable.setFunctionExtensions("dFdxCoarse", 1, &E_GL_ARB_derivative_control);
8535
symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_ARB_derivative_control);
8536
symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_ARB_derivative_control);
8537
}
8538
8539
// E_GL_ARB_sparse_texture2
8540
if (profile != EEsProfile)
8541
{
8542
symbolTable.setFunctionExtensions("sparseTextureARB", 1, &E_GL_ARB_sparse_texture2);
8543
symbolTable.setFunctionExtensions("sparseTextureLodARB", 1, &E_GL_ARB_sparse_texture2);
8544
symbolTable.setFunctionExtensions("sparseTextureOffsetARB", 1, &E_GL_ARB_sparse_texture2);
8545
symbolTable.setFunctionExtensions("sparseTexelFetchARB", 1, &E_GL_ARB_sparse_texture2);
8546
symbolTable.setFunctionExtensions("sparseTexelFetchOffsetARB", 1, &E_GL_ARB_sparse_texture2);
8547
symbolTable.setFunctionExtensions("sparseTextureLodOffsetARB", 1, &E_GL_ARB_sparse_texture2);
8548
symbolTable.setFunctionExtensions("sparseTextureGradARB", 1, &E_GL_ARB_sparse_texture2);
8549
symbolTable.setFunctionExtensions("sparseTextureGradOffsetARB", 1, &E_GL_ARB_sparse_texture2);
8550
symbolTable.setFunctionExtensions("sparseTextureGatherARB", 1, &E_GL_ARB_sparse_texture2);
8551
symbolTable.setFunctionExtensions("sparseTextureGatherOffsetARB", 1, &E_GL_ARB_sparse_texture2);
8552
symbolTable.setFunctionExtensions("sparseTextureGatherOffsetsARB", 1, &E_GL_ARB_sparse_texture2);
8553
symbolTable.setFunctionExtensions("sparseImageLoadARB", 1, &E_GL_ARB_sparse_texture2);
8554
symbolTable.setFunctionExtensions("sparseTexelsResident", 1, &E_GL_ARB_sparse_texture2);
8555
}
8556
8557
// E_GL_ARB_sparse_texture_clamp
8558
if (profile != EEsProfile)
8559
{
8560
symbolTable.setFunctionExtensions("sparseTextureClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
8561
symbolTable.setFunctionExtensions("sparseTextureOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
8562
symbolTable.setFunctionExtensions("sparseTextureGradClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
8563
symbolTable.setFunctionExtensions("sparseTextureGradOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
8564
symbolTable.setFunctionExtensions("textureClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
8565
symbolTable.setFunctionExtensions("textureOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
8566
symbolTable.setFunctionExtensions("textureGradClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
8567
symbolTable.setFunctionExtensions("textureGradOffsetClampARB", 1, &E_GL_ARB_sparse_texture_clamp);
8568
}
8569
8570
// E_GL_AMD_shader_explicit_vertex_parameter
8571
if (profile != EEsProfile) {
8572
symbolTable.setVariableExtensions("gl_BaryCoordNoPerspAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
8573
symbolTable.setVariableExtensions("gl_BaryCoordNoPerspCentroidAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
8574
symbolTable.setVariableExtensions("gl_BaryCoordNoPerspSampleAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
8575
symbolTable.setVariableExtensions("gl_BaryCoordSmoothAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
8576
symbolTable.setVariableExtensions("gl_BaryCoordSmoothCentroidAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
8577
symbolTable.setVariableExtensions("gl_BaryCoordSmoothSampleAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
8578
symbolTable.setVariableExtensions("gl_BaryCoordPullModelAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
8579
8580
symbolTable.setFunctionExtensions("interpolateAtVertexAMD", 1, &E_GL_AMD_shader_explicit_vertex_parameter);
8581
8582
BuiltInVariable("gl_BaryCoordNoPerspAMD", EbvBaryCoordNoPersp, symbolTable);
8583
BuiltInVariable("gl_BaryCoordNoPerspCentroidAMD", EbvBaryCoordNoPerspCentroid, symbolTable);
8584
BuiltInVariable("gl_BaryCoordNoPerspSampleAMD", EbvBaryCoordNoPerspSample, symbolTable);
8585
BuiltInVariable("gl_BaryCoordSmoothAMD", EbvBaryCoordSmooth, symbolTable);
8586
BuiltInVariable("gl_BaryCoordSmoothCentroidAMD", EbvBaryCoordSmoothCentroid, symbolTable);
8587
BuiltInVariable("gl_BaryCoordSmoothSampleAMD", EbvBaryCoordSmoothSample, symbolTable);
8588
BuiltInVariable("gl_BaryCoordPullModelAMD", EbvBaryCoordPullModel, symbolTable);
8589
}
8590
8591
// E_GL_AMD_texture_gather_bias_lod
8592
if (profile != EEsProfile) {
8593
symbolTable.setFunctionExtensions("textureGatherLodAMD", 1, &E_GL_AMD_texture_gather_bias_lod);
8594
symbolTable.setFunctionExtensions("textureGatherLodOffsetAMD", 1, &E_GL_AMD_texture_gather_bias_lod);
8595
symbolTable.setFunctionExtensions("textureGatherLodOffsetsAMD", 1, &E_GL_AMD_texture_gather_bias_lod);
8596
symbolTable.setFunctionExtensions("sparseTextureGatherLodAMD", 1, &E_GL_AMD_texture_gather_bias_lod);
8597
symbolTable.setFunctionExtensions("sparseTextureGatherLodOffsetAMD", 1, &E_GL_AMD_texture_gather_bias_lod);
8598
symbolTable.setFunctionExtensions("sparseTextureGatherLodOffsetsAMD", 1, &E_GL_AMD_texture_gather_bias_lod);
8599
}
8600
8601
// E_GL_AMD_shader_image_load_store_lod
8602
if (profile != EEsProfile) {
8603
symbolTable.setFunctionExtensions("imageLoadLodAMD", 1, &E_GL_AMD_shader_image_load_store_lod);
8604
symbolTable.setFunctionExtensions("imageStoreLodAMD", 1, &E_GL_AMD_shader_image_load_store_lod);
8605
symbolTable.setFunctionExtensions("sparseImageLoadLodAMD", 1, &E_GL_AMD_shader_image_load_store_lod);
8606
}
8607
if (profile != EEsProfile && version >= 430) {
8608
symbolTable.setVariableExtensions("gl_FragFullyCoveredNV", 1, &E_GL_NV_conservative_raster_underestimation);
8609
BuiltInVariable("gl_FragFullyCoveredNV", EbvFragFullyCoveredNV, symbolTable);
8610
}
8611
if ((profile != EEsProfile && version >= 450) ||
8612
(profile == EEsProfile && version >= 320)) {
8613
symbolTable.setVariableExtensions("gl_FragmentSizeNV", 1, &E_GL_NV_shading_rate_image);
8614
symbolTable.setVariableExtensions("gl_InvocationsPerPixelNV", 1, &E_GL_NV_shading_rate_image);
8615
BuiltInVariable("gl_FragmentSizeNV", EbvFragmentSizeNV, symbolTable);
8616
BuiltInVariable("gl_InvocationsPerPixelNV", EbvInvocationsPerPixelNV, symbolTable);
8617
symbolTable.setVariableExtensions("gl_BaryCoordNV", 1, &E_GL_NV_fragment_shader_barycentric);
8618
symbolTable.setVariableExtensions("gl_BaryCoordNoPerspNV", 1, &E_GL_NV_fragment_shader_barycentric);
8619
BuiltInVariable("gl_BaryCoordNV", EbvBaryCoordNV, symbolTable);
8620
BuiltInVariable("gl_BaryCoordNoPerspNV", EbvBaryCoordNoPerspNV, symbolTable);
8621
symbolTable.setVariableExtensions("gl_BaryCoordEXT", 1, &E_GL_EXT_fragment_shader_barycentric);
8622
symbolTable.setVariableExtensions("gl_BaryCoordNoPerspEXT", 1, &E_GL_EXT_fragment_shader_barycentric);
8623
BuiltInVariable("gl_BaryCoordEXT", EbvBaryCoordEXT, symbolTable);
8624
BuiltInVariable("gl_BaryCoordNoPerspEXT", EbvBaryCoordNoPerspEXT, symbolTable);
8625
}
8626
8627
if ((profile != EEsProfile && version >= 450) ||
8628
(profile == EEsProfile && version >= 310)) {
8629
symbolTable.setVariableExtensions("gl_FragSizeEXT", 1, &E_GL_EXT_fragment_invocation_density);
8630
symbolTable.setVariableExtensions("gl_FragInvocationCountEXT", 1, &E_GL_EXT_fragment_invocation_density);
8631
BuiltInVariable("gl_FragSizeEXT", EbvFragSizeEXT, symbolTable);
8632
BuiltInVariable("gl_FragInvocationCountEXT", EbvFragInvocationCountEXT, symbolTable);
8633
}
8634
8635
symbolTable.setVariableExtensions("gl_FragDepthEXT", 1, &E_GL_EXT_frag_depth);
8636
8637
symbolTable.setFunctionExtensions("clockARB", 1, &E_GL_ARB_shader_clock);
8638
symbolTable.setFunctionExtensions("clock2x32ARB", 1, &E_GL_ARB_shader_clock);
8639
8640
symbolTable.setFunctionExtensions("clockRealtimeEXT", 1, &E_GL_EXT_shader_realtime_clock);
8641
symbolTable.setFunctionExtensions("clockRealtime2x32EXT", 1, &E_GL_EXT_shader_realtime_clock);
8642
8643
if (profile == EEsProfile && version < 320) {
8644
symbolTable.setVariableExtensions("gl_PrimitiveID", Num_AEP_geometry_shader, AEP_geometry_shader);
8645
symbolTable.setVariableExtensions("gl_Layer", Num_AEP_geometry_shader, AEP_geometry_shader);
8646
}
8647
8648
if (profile == EEsProfile && version < 320) {
8649
symbolTable.setFunctionExtensions("imageAtomicAdd", 1, &E_GL_OES_shader_image_atomic);
8650
symbolTable.setFunctionExtensions("imageAtomicMin", 1, &E_GL_OES_shader_image_atomic);
8651
symbolTable.setFunctionExtensions("imageAtomicMax", 1, &E_GL_OES_shader_image_atomic);
8652
symbolTable.setFunctionExtensions("imageAtomicAnd", 1, &E_GL_OES_shader_image_atomic);
8653
symbolTable.setFunctionExtensions("imageAtomicOr", 1, &E_GL_OES_shader_image_atomic);
8654
symbolTable.setFunctionExtensions("imageAtomicXor", 1, &E_GL_OES_shader_image_atomic);
8655
symbolTable.setFunctionExtensions("imageAtomicExchange", 1, &E_GL_OES_shader_image_atomic);
8656
symbolTable.setFunctionExtensions("imageAtomicCompSwap", 1, &E_GL_OES_shader_image_atomic);
8657
}
8658
8659
if (profile != EEsProfile && version < 330 ) {
8660
const char* bitsConvertExt[2] = {E_GL_ARB_shader_bit_encoding, E_GL_ARB_gpu_shader5};
8661
symbolTable.setFunctionExtensions("floatBitsToInt", 2, bitsConvertExt);
8662
symbolTable.setFunctionExtensions("floatBitsToUint", 2, bitsConvertExt);
8663
symbolTable.setFunctionExtensions("intBitsToFloat", 2, bitsConvertExt);
8664
symbolTable.setFunctionExtensions("uintBitsToFloat", 2, bitsConvertExt);
8665
}
8666
8667
if (profile != EEsProfile && version < 430 ) {
8668
symbolTable.setFunctionExtensions("imageSize", 1, &E_GL_ARB_shader_image_size);
8669
}
8670
8671
// GL_ARB_shader_storage_buffer_object
8672
if (profile != EEsProfile && version < 430 ) {
8673
symbolTable.setFunctionExtensions("atomicAdd", 1, &E_GL_ARB_shader_storage_buffer_object);
8674
symbolTable.setFunctionExtensions("atomicMin", 1, &E_GL_ARB_shader_storage_buffer_object);
8675
symbolTable.setFunctionExtensions("atomicMax", 1, &E_GL_ARB_shader_storage_buffer_object);
8676
symbolTable.setFunctionExtensions("atomicAnd", 1, &E_GL_ARB_shader_storage_buffer_object);
8677
symbolTable.setFunctionExtensions("atomicOr", 1, &E_GL_ARB_shader_storage_buffer_object);
8678
symbolTable.setFunctionExtensions("atomicXor", 1, &E_GL_ARB_shader_storage_buffer_object);
8679
symbolTable.setFunctionExtensions("atomicExchange", 1, &E_GL_ARB_shader_storage_buffer_object);
8680
symbolTable.setFunctionExtensions("atomicCompSwap", 1, &E_GL_ARB_shader_storage_buffer_object);
8681
}
8682
8683
// GL_ARB_shading_language_packing
8684
if (profile != EEsProfile && version < 400 ) {
8685
symbolTable.setFunctionExtensions("packUnorm2x16", 1, &E_GL_ARB_shading_language_packing);
8686
symbolTable.setFunctionExtensions("unpackUnorm2x16", 1, &E_GL_ARB_shading_language_packing);
8687
symbolTable.setFunctionExtensions("packSnorm4x8", 1, &E_GL_ARB_shading_language_packing);
8688
symbolTable.setFunctionExtensions("packUnorm4x8", 1, &E_GL_ARB_shading_language_packing);
8689
symbolTable.setFunctionExtensions("unpackSnorm4x8", 1, &E_GL_ARB_shading_language_packing);
8690
symbolTable.setFunctionExtensions("unpackUnorm4x8", 1, &E_GL_ARB_shading_language_packing);
8691
}
8692
if (profile != EEsProfile && version < 420 ) {
8693
symbolTable.setFunctionExtensions("packSnorm2x16", 1, &E_GL_ARB_shading_language_packing);
8694
symbolTable.setFunctionExtensions("unpackSnorm2x16", 1, &E_GL_ARB_shading_language_packing);
8695
symbolTable.setFunctionExtensions("unpackHalf2x16", 1, &E_GL_ARB_shading_language_packing);
8696
symbolTable.setFunctionExtensions("packHalf2x16", 1, &E_GL_ARB_shading_language_packing);
8697
}
8698
8699
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
8700
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
8701
symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
8702
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
8703
if (version >= 300 /* both ES and non-ES */) {
8704
symbolTable.setVariableExtensions("gl_ViewID_OVR", Num_OVR_multiview_EXTs, OVR_multiview_EXTs);
8705
BuiltInVariable("gl_ViewID_OVR", EbvViewIndex, symbolTable);
8706
}
8707
8708
// GL_ARB_shader_ballot
8709
if (profile != EEsProfile) {
8710
symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);
8711
symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot);
8712
symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot);
8713
symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot);
8714
symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot);
8715
symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot);
8716
symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot);
8717
8718
BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable);
8719
BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable);
8720
BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable);
8721
BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable);
8722
BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);
8723
BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable);
8724
8725
if (spvVersion.vulkan > 0) {
8726
// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan
8727
SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);
8728
if (language == EShLangFragment)
8729
ModifyFlatDecoration("gl_SubGroupSizeARB", true, symbolTable);
8730
}
8731
else
8732
BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable);
8733
}
8734
8735
// GL_EXT_expect_assume
8736
if ((profile == EEsProfile && version >= 310) ||
8737
(profile != EEsProfile && version >= 140)) {
8738
symbolTable.setFunctionExtensions("assumeEXT", 1, &E_GL_EXT_expect_assume);
8739
symbolTable.setFunctionExtensions("expectEXT", 1, &E_GL_EXT_expect_assume);
8740
}
8741
8742
// GL_KHR_shader_subgroup
8743
if ((profile == EEsProfile && version >= 310) ||
8744
(profile != EEsProfile && version >= 140)) {
8745
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
8746
symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);
8747
symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);
8748
symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
8749
symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
8750
symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
8751
symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
8752
8753
BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);
8754
BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);
8755
BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);
8756
BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);
8757
BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);
8758
BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);
8759
BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);
8760
8761
symbolTable.setFunctionExtensions("subgroupBarrier", 1, &E_GL_KHR_shader_subgroup_basic);
8762
symbolTable.setFunctionExtensions("subgroupMemoryBarrier", 1, &E_GL_KHR_shader_subgroup_basic);
8763
symbolTable.setFunctionExtensions("subgroupMemoryBarrierBuffer", 1, &E_GL_KHR_shader_subgroup_basic);
8764
symbolTable.setFunctionExtensions("subgroupMemoryBarrierImage", 1, &E_GL_KHR_shader_subgroup_basic);
8765
symbolTable.setFunctionExtensions("subgroupElect", 1, &E_GL_KHR_shader_subgroup_basic);
8766
symbolTable.setFunctionExtensions("subgroupAll", 1, &E_GL_KHR_shader_subgroup_vote);
8767
symbolTable.setFunctionExtensions("subgroupAny", 1, &E_GL_KHR_shader_subgroup_vote);
8768
symbolTable.setFunctionExtensions("subgroupAllEqual", 1, &E_GL_KHR_shader_subgroup_vote);
8769
symbolTable.setFunctionExtensions("subgroupBroadcast", 1, &E_GL_KHR_shader_subgroup_ballot);
8770
symbolTable.setFunctionExtensions("subgroupBroadcastFirst", 1, &E_GL_KHR_shader_subgroup_ballot);
8771
symbolTable.setFunctionExtensions("subgroupBallot", 1, &E_GL_KHR_shader_subgroup_ballot);
8772
symbolTable.setFunctionExtensions("subgroupInverseBallot", 1, &E_GL_KHR_shader_subgroup_ballot);
8773
symbolTable.setFunctionExtensions("subgroupBallotBitExtract", 1, &E_GL_KHR_shader_subgroup_ballot);
8774
symbolTable.setFunctionExtensions("subgroupBallotBitCount", 1, &E_GL_KHR_shader_subgroup_ballot);
8775
symbolTable.setFunctionExtensions("subgroupBallotInclusiveBitCount", 1, &E_GL_KHR_shader_subgroup_ballot);
8776
symbolTable.setFunctionExtensions("subgroupBallotExclusiveBitCount", 1, &E_GL_KHR_shader_subgroup_ballot);
8777
symbolTable.setFunctionExtensions("subgroupBallotFindLSB", 1, &E_GL_KHR_shader_subgroup_ballot);
8778
symbolTable.setFunctionExtensions("subgroupBallotFindMSB", 1, &E_GL_KHR_shader_subgroup_ballot);
8779
symbolTable.setFunctionExtensions("subgroupShuffle", 1, &E_GL_KHR_shader_subgroup_shuffle);
8780
symbolTable.setFunctionExtensions("subgroupShuffleXor", 1, &E_GL_KHR_shader_subgroup_shuffle);
8781
symbolTable.setFunctionExtensions("subgroupShuffleUp", 1, &E_GL_KHR_shader_subgroup_shuffle_relative);
8782
symbolTable.setFunctionExtensions("subgroupShuffleDown", 1, &E_GL_KHR_shader_subgroup_shuffle_relative);
8783
symbolTable.setFunctionExtensions("subgroupRotate", 1, &E_GL_KHR_shader_subgroup_rotate);
8784
symbolTable.setFunctionExtensions("subgroupClusteredRotate", 1, &E_GL_KHR_shader_subgroup_rotate);
8785
symbolTable.setFunctionExtensions("subgroupAdd", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8786
symbolTable.setFunctionExtensions("subgroupMul", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8787
symbolTable.setFunctionExtensions("subgroupMin", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8788
symbolTable.setFunctionExtensions("subgroupMax", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8789
symbolTable.setFunctionExtensions("subgroupAnd", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8790
symbolTable.setFunctionExtensions("subgroupOr", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8791
symbolTable.setFunctionExtensions("subgroupXor", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8792
symbolTable.setFunctionExtensions("subgroupInclusiveAdd", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8793
symbolTable.setFunctionExtensions("subgroupInclusiveMul", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8794
symbolTable.setFunctionExtensions("subgroupInclusiveMin", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8795
symbolTable.setFunctionExtensions("subgroupInclusiveMax", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8796
symbolTable.setFunctionExtensions("subgroupInclusiveAnd", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8797
symbolTable.setFunctionExtensions("subgroupInclusiveOr", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8798
symbolTable.setFunctionExtensions("subgroupInclusiveXor", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8799
symbolTable.setFunctionExtensions("subgroupExclusiveAdd", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8800
symbolTable.setFunctionExtensions("subgroupExclusiveMul", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8801
symbolTable.setFunctionExtensions("subgroupExclusiveMin", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8802
symbolTable.setFunctionExtensions("subgroupExclusiveMax", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8803
symbolTable.setFunctionExtensions("subgroupExclusiveAnd", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8804
symbolTable.setFunctionExtensions("subgroupExclusiveOr", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8805
symbolTable.setFunctionExtensions("subgroupExclusiveXor", 1, &E_GL_KHR_shader_subgroup_arithmetic);
8806
symbolTable.setFunctionExtensions("subgroupClusteredAdd", 1, &E_GL_KHR_shader_subgroup_clustered);
8807
symbolTable.setFunctionExtensions("subgroupClusteredMul", 1, &E_GL_KHR_shader_subgroup_clustered);
8808
symbolTable.setFunctionExtensions("subgroupClusteredMin", 1, &E_GL_KHR_shader_subgroup_clustered);
8809
symbolTable.setFunctionExtensions("subgroupClusteredMax", 1, &E_GL_KHR_shader_subgroup_clustered);
8810
symbolTable.setFunctionExtensions("subgroupClusteredAnd", 1, &E_GL_KHR_shader_subgroup_clustered);
8811
symbolTable.setFunctionExtensions("subgroupClusteredOr", 1, &E_GL_KHR_shader_subgroup_clustered);
8812
symbolTable.setFunctionExtensions("subgroupClusteredXor", 1, &E_GL_KHR_shader_subgroup_clustered);
8813
symbolTable.setFunctionExtensions("subgroupQuadBroadcast", 1, &E_GL_KHR_shader_subgroup_quad);
8814
symbolTable.setFunctionExtensions("subgroupQuadSwapHorizontal", 1, &E_GL_KHR_shader_subgroup_quad);
8815
symbolTable.setFunctionExtensions("subgroupQuadSwapVertical", 1, &E_GL_KHR_shader_subgroup_quad);
8816
symbolTable.setFunctionExtensions("subgroupQuadSwapDiagonal", 1, &E_GL_KHR_shader_subgroup_quad);
8817
symbolTable.setFunctionExtensions("subgroupPartitionNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8818
symbolTable.setFunctionExtensions("subgroupPartitionedAddNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8819
symbolTable.setFunctionExtensions("subgroupPartitionedMulNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8820
symbolTable.setFunctionExtensions("subgroupPartitionedMinNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8821
symbolTable.setFunctionExtensions("subgroupPartitionedMaxNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8822
symbolTable.setFunctionExtensions("subgroupPartitionedAndNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8823
symbolTable.setFunctionExtensions("subgroupPartitionedOrNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8824
symbolTable.setFunctionExtensions("subgroupPartitionedXorNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8825
symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveAddNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8826
symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveMulNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8827
symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveMinNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8828
symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveMaxNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8829
symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveAndNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8830
symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveOrNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8831
symbolTable.setFunctionExtensions("subgroupPartitionedInclusiveXorNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8832
symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveAddNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8833
symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveMulNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8834
symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveMinNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8835
symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveMaxNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8836
symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveAndNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8837
symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveOrNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8838
symbolTable.setFunctionExtensions("subgroupPartitionedExclusiveXorNV", 1, &E_GL_NV_shader_subgroup_partitioned);
8839
8840
// GL_NV_shader_sm_builtins
8841
symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins);
8842
symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins);
8843
symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins);
8844
symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins);
8845
BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable);
8846
BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);
8847
BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);
8848
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
8849
8850
// GL_ARM_shader_core_builtins
8851
symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);
8852
symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);
8853
symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
8854
symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);
8855
symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
8856
8857
BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);
8858
BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);
8859
BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);
8860
BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);
8861
BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);
8862
}
8863
8864
if (profile == EEsProfile) {
8865
symbolTable.setFunctionExtensions("shadow2DEXT", 1, &E_GL_EXT_shadow_samplers);
8866
symbolTable.setFunctionExtensions("shadow2DProjEXT", 1, &E_GL_EXT_shadow_samplers);
8867
}
8868
8869
if (spvVersion.vulkan > 0) {
8870
symbolTable.setVariableExtensions("gl_ScopeDevice", 1, &E_GL_KHR_memory_scope_semantics);
8871
symbolTable.setVariableExtensions("gl_ScopeWorkgroup", 1, &E_GL_KHR_memory_scope_semantics);
8872
symbolTable.setVariableExtensions("gl_ScopeSubgroup", 1, &E_GL_KHR_memory_scope_semantics);
8873
symbolTable.setVariableExtensions("gl_ScopeInvocation", 1, &E_GL_KHR_memory_scope_semantics);
8874
8875
symbolTable.setVariableExtensions("gl_SemanticsRelaxed", 1, &E_GL_KHR_memory_scope_semantics);
8876
symbolTable.setVariableExtensions("gl_SemanticsAcquire", 1, &E_GL_KHR_memory_scope_semantics);
8877
symbolTable.setVariableExtensions("gl_SemanticsRelease", 1, &E_GL_KHR_memory_scope_semantics);
8878
symbolTable.setVariableExtensions("gl_SemanticsAcquireRelease", 1, &E_GL_KHR_memory_scope_semantics);
8879
symbolTable.setVariableExtensions("gl_SemanticsMakeAvailable", 1, &E_GL_KHR_memory_scope_semantics);
8880
symbolTable.setVariableExtensions("gl_SemanticsMakeVisible", 1, &E_GL_KHR_memory_scope_semantics);
8881
symbolTable.setVariableExtensions("gl_SemanticsVolatile", 1, &E_GL_KHR_memory_scope_semantics);
8882
8883
symbolTable.setVariableExtensions("gl_StorageSemanticsNone", 1, &E_GL_KHR_memory_scope_semantics);
8884
symbolTable.setVariableExtensions("gl_StorageSemanticsBuffer", 1, &E_GL_KHR_memory_scope_semantics);
8885
symbolTable.setVariableExtensions("gl_StorageSemanticsShared", 1, &E_GL_KHR_memory_scope_semantics);
8886
symbolTable.setVariableExtensions("gl_StorageSemanticsImage", 1, &E_GL_KHR_memory_scope_semantics);
8887
symbolTable.setVariableExtensions("gl_StorageSemanticsOutput", 1, &E_GL_KHR_memory_scope_semantics);
8888
}
8889
8890
symbolTable.setFunctionExtensions("helperInvocationEXT", 1, &E_GL_EXT_demote_to_helper_invocation);
8891
8892
if ((profile == EEsProfile && version >= 310) ||
8893
(profile != EEsProfile && version >= 450)) {
8894
symbolTable.setVariableExtensions("gl_ShadingRateEXT", 1, &E_GL_EXT_fragment_shading_rate);
8895
BuiltInVariable("gl_ShadingRateEXT", EbvShadingRateKHR, symbolTable);
8896
8897
symbolTable.setVariableExtensions("gl_ShadingRateFlag2VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
8898
symbolTable.setVariableExtensions("gl_ShadingRateFlag4VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
8899
symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
8900
symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
8901
}
8902
8903
// GL_EXT_shader_quad_control
8904
if ((profile != EEsProfile && version >= 140) ||
8905
(profile == EEsProfile && version >= 310)) {
8906
symbolTable.setFunctionExtensions("subgroupQuadAll", 1, &E_GL_KHR_shader_subgroup_vote);
8907
symbolTable.setFunctionExtensions("subgroupQuadAny", 1, &E_GL_KHR_shader_subgroup_vote);
8908
}
8909
8910
// GL_EXT_shader_tile_image
8911
symbolTable.setFunctionExtensions("stencilAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);
8912
symbolTable.setFunctionExtensions("depthAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);
8913
symbolTable.setFunctionExtensions("colorAttachmentReadEXT", 1, &E_GL_EXT_shader_tile_image);
8914
8915
if ((profile == EEsProfile && version >= 310) ||
8916
(profile != EEsProfile && version >= 140)) {
8917
8918
symbolTable.setFunctionExtensions("textureWeightedQCOM", 1, &E_GL_QCOM_image_processing);
8919
symbolTable.setFunctionExtensions("textureBoxFilterQCOM", 1, &E_GL_QCOM_image_processing);
8920
symbolTable.setFunctionExtensions("textureBlockMatchSADQCOM", 1, &E_GL_QCOM_image_processing);
8921
symbolTable.setFunctionExtensions("textureBlockMatchSSDQCOM", 1, &E_GL_QCOM_image_processing);
8922
8923
symbolTable.setFunctionExtensions("textureBlockMatchWindowSSDQCOM", 1, &E_GL_QCOM_image_processing2);
8924
symbolTable.setFunctionExtensions("textureBlockMatchWindowSADQCOM", 1, &E_GL_QCOM_image_processing2);
8925
symbolTable.setFunctionExtensions("textureBlockMatchGatherSSDQCOM", 1, &E_GL_QCOM_image_processing2);
8926
symbolTable.setFunctionExtensions("textureBlockMatchGatherSADQCOM", 1, &E_GL_QCOM_image_processing2);
8927
}
8928
break;
8929
8930
case EShLangCompute:
8931
BuiltInVariable("gl_NumWorkGroups", EbvNumWorkGroups, symbolTable);
8932
BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable);
8933
BuiltInVariable("gl_WorkGroupID", EbvWorkGroupId, symbolTable);
8934
BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable);
8935
BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable);
8936
BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable);
8937
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
8938
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
8939
8940
if ((profile != EEsProfile && version >= 140) ||
8941
(profile == EEsProfile && version >= 310)) {
8942
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
8943
symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
8944
}
8945
8946
if (profile != EEsProfile && version < 430) {
8947
symbolTable.setVariableExtensions("gl_NumWorkGroups", 1, &E_GL_ARB_compute_shader);
8948
symbolTable.setVariableExtensions("gl_WorkGroupSize", 1, &E_GL_ARB_compute_shader);
8949
symbolTable.setVariableExtensions("gl_WorkGroupID", 1, &E_GL_ARB_compute_shader);
8950
symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_ARB_compute_shader);
8951
symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_ARB_compute_shader);
8952
symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_ARB_compute_shader);
8953
8954
symbolTable.setVariableExtensions("gl_MaxComputeWorkGroupCount", 1, &E_GL_ARB_compute_shader);
8955
symbolTable.setVariableExtensions("gl_MaxComputeWorkGroupSize", 1, &E_GL_ARB_compute_shader);
8956
symbolTable.setVariableExtensions("gl_MaxComputeUniformComponents", 1, &E_GL_ARB_compute_shader);
8957
symbolTable.setVariableExtensions("gl_MaxComputeTextureImageUnits", 1, &E_GL_ARB_compute_shader);
8958
symbolTable.setVariableExtensions("gl_MaxComputeImageUniforms", 1, &E_GL_ARB_compute_shader);
8959
symbolTable.setVariableExtensions("gl_MaxComputeAtomicCounters", 1, &E_GL_ARB_compute_shader);
8960
symbolTable.setVariableExtensions("gl_MaxComputeAtomicCounterBuffers", 1, &E_GL_ARB_compute_shader);
8961
8962
symbolTable.setFunctionExtensions("barrier", 1, &E_GL_ARB_compute_shader);
8963
symbolTable.setFunctionExtensions("memoryBarrierAtomicCounter", 1, &E_GL_ARB_compute_shader);
8964
symbolTable.setFunctionExtensions("memoryBarrierBuffer", 1, &E_GL_ARB_compute_shader);
8965
symbolTable.setFunctionExtensions("memoryBarrierImage", 1, &E_GL_ARB_compute_shader);
8966
symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_ARB_compute_shader);
8967
symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_ARB_compute_shader);
8968
}
8969
8970
8971
symbolTable.setFunctionExtensions("controlBarrier", 1, &E_GL_KHR_memory_scope_semantics);
8972
symbolTable.setFunctionExtensions("debugPrintfEXT", 1, &E_GL_EXT_debug_printf);
8973
8974
// GL_ARB_shader_ballot
8975
if (profile != EEsProfile) {
8976
symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);
8977
symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot);
8978
symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot);
8979
symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot);
8980
symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot);
8981
symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot);
8982
symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot);
8983
8984
BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable);
8985
BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable);
8986
BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable);
8987
BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable);
8988
BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);
8989
BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable);
8990
8991
if (spvVersion.vulkan > 0) {
8992
// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan
8993
SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);
8994
if (language == EShLangFragment)
8995
ModifyFlatDecoration("gl_SubGroupSizeARB", true, symbolTable);
8996
}
8997
else
8998
BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable);
8999
}
9000
9001
// GL_KHR_shader_subgroup
9002
if ((profile == EEsProfile && version >= 310) ||
9003
(profile != EEsProfile && version >= 140)) {
9004
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
9005
symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);
9006
symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9007
symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9008
symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9009
symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9010
symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9011
9012
BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);
9013
BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);
9014
BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);
9015
BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);
9016
BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);
9017
BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);
9018
BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);
9019
9020
// GL_NV_shader_sm_builtins
9021
symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins);
9022
symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins);
9023
symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins);
9024
symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins);
9025
BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable);
9026
BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);
9027
BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);
9028
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
9029
9030
// GL_ARM_shader_core_builtins
9031
symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);
9032
symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);
9033
symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
9034
symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);
9035
symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
9036
9037
BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);
9038
BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);
9039
BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);
9040
BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);
9041
BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);
9042
}
9043
9044
// GL_KHR_shader_subgroup
9045
if ((profile == EEsProfile && version >= 310) ||
9046
(profile != EEsProfile && version >= 140)) {
9047
symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic);
9048
symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic);
9049
9050
BuiltInVariable("gl_NumSubgroups", EbvNumSubgroups, symbolTable);
9051
BuiltInVariable("gl_SubgroupID", EbvSubgroupID, symbolTable);
9052
9053
symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic);
9054
}
9055
9056
{
9057
const char *coopExt[2] = { E_GL_NV_cooperative_matrix, E_GL_NV_integer_cooperative_matrix };
9058
symbolTable.setFunctionExtensions("coopMatLoadNV", 2, coopExt);
9059
symbolTable.setFunctionExtensions("coopMatStoreNV", 2, coopExt);
9060
symbolTable.setFunctionExtensions("coopMatMulAddNV", 2, coopExt);
9061
}
9062
9063
{
9064
symbolTable.setFunctionExtensions("coopMatLoad", 1, &E_GL_KHR_cooperative_matrix);
9065
symbolTable.setFunctionExtensions("coopMatStore", 1, &E_GL_KHR_cooperative_matrix);
9066
symbolTable.setFunctionExtensions("coopMatMulAdd", 1, &E_GL_KHR_cooperative_matrix);
9067
}
9068
9069
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
9070
symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_NV_compute_shader_derivatives);
9071
symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_NV_compute_shader_derivatives);
9072
symbolTable.setFunctionExtensions("fwidth", 1, &E_GL_NV_compute_shader_derivatives);
9073
symbolTable.setFunctionExtensions("dFdxFine", 1, &E_GL_NV_compute_shader_derivatives);
9074
symbolTable.setFunctionExtensions("dFdyFine", 1, &E_GL_NV_compute_shader_derivatives);
9075
symbolTable.setFunctionExtensions("fwidthFine", 1, &E_GL_NV_compute_shader_derivatives);
9076
symbolTable.setFunctionExtensions("dFdxCoarse", 1, &E_GL_NV_compute_shader_derivatives);
9077
symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_NV_compute_shader_derivatives);
9078
symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_NV_compute_shader_derivatives);
9079
}
9080
9081
if ((profile == EEsProfile && version >= 310) ||
9082
(profile != EEsProfile && version >= 450)) {
9083
symbolTable.setVariableExtensions("gl_ShadingRateFlag2VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9084
symbolTable.setVariableExtensions("gl_ShadingRateFlag4VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9085
symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9086
symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9087
}
9088
9089
if ((profile != EEsProfile && version >= 460)) {
9090
symbolTable.setFunctionExtensions("fetchMicroTriangleVertexPositionNV", 1, &E_GL_NV_displacement_micromap);
9091
symbolTable.setFunctionExtensions("fetchMicroTriangleVertexBarycentricNV", 1, &E_GL_NV_displacement_micromap);
9092
}
9093
break;
9094
9095
case EShLangRayGen:
9096
case EShLangIntersect:
9097
case EShLangAnyHit:
9098
case EShLangClosestHit:
9099
case EShLangMiss:
9100
case EShLangCallable:
9101
if (profile != EEsProfile && version >= 460) {
9102
const char *rtexts[] = { E_GL_NV_ray_tracing, E_GL_EXT_ray_tracing };
9103
symbolTable.setVariableExtensions("gl_LaunchIDNV", 1, &E_GL_NV_ray_tracing);
9104
symbolTable.setVariableExtensions("gl_LaunchIDEXT", 1, &E_GL_EXT_ray_tracing);
9105
symbolTable.setVariableExtensions("gl_LaunchSizeNV", 1, &E_GL_NV_ray_tracing);
9106
symbolTable.setVariableExtensions("gl_LaunchSizeEXT", 1, &E_GL_EXT_ray_tracing);
9107
symbolTable.setVariableExtensions("gl_PrimitiveID", 2, rtexts);
9108
symbolTable.setVariableExtensions("gl_InstanceID", 2, rtexts);
9109
symbolTable.setVariableExtensions("gl_InstanceCustomIndexNV", 1, &E_GL_NV_ray_tracing);
9110
symbolTable.setVariableExtensions("gl_InstanceCustomIndexEXT", 1, &E_GL_EXT_ray_tracing);
9111
symbolTable.setVariableExtensions("gl_GeometryIndexEXT", 1, &E_GL_EXT_ray_tracing);
9112
symbolTable.setVariableExtensions("gl_WorldRayOriginNV", 1, &E_GL_NV_ray_tracing);
9113
symbolTable.setVariableExtensions("gl_WorldRayOriginEXT", 1, &E_GL_EXT_ray_tracing);
9114
symbolTable.setVariableExtensions("gl_WorldRayDirectionNV", 1, &E_GL_NV_ray_tracing);
9115
symbolTable.setVariableExtensions("gl_WorldRayDirectionEXT", 1, &E_GL_EXT_ray_tracing);
9116
symbolTable.setVariableExtensions("gl_ObjectRayOriginNV", 1, &E_GL_NV_ray_tracing);
9117
symbolTable.setVariableExtensions("gl_ObjectRayOriginEXT", 1, &E_GL_EXT_ray_tracing);
9118
symbolTable.setVariableExtensions("gl_ObjectRayDirectionNV", 1, &E_GL_NV_ray_tracing);
9119
symbolTable.setVariableExtensions("gl_ObjectRayDirectionEXT", 1, &E_GL_EXT_ray_tracing);
9120
symbolTable.setVariableExtensions("gl_RayTminNV", 1, &E_GL_NV_ray_tracing);
9121
symbolTable.setVariableExtensions("gl_RayTminEXT", 1, &E_GL_EXT_ray_tracing);
9122
symbolTable.setVariableExtensions("gl_RayTmaxNV", 1, &E_GL_NV_ray_tracing);
9123
symbolTable.setVariableExtensions("gl_RayTmaxEXT", 1, &E_GL_EXT_ray_tracing);
9124
symbolTable.setVariableExtensions("gl_CullMaskEXT", 1, &E_GL_EXT_ray_cull_mask);
9125
symbolTable.setVariableExtensions("gl_HitTNV", 1, &E_GL_NV_ray_tracing);
9126
symbolTable.setVariableExtensions("gl_HitTEXT", 1, &E_GL_EXT_ray_tracing);
9127
symbolTable.setVariableExtensions("gl_HitKindNV", 1, &E_GL_NV_ray_tracing);
9128
symbolTable.setVariableExtensions("gl_HitKindEXT", 1, &E_GL_EXT_ray_tracing);
9129
symbolTable.setVariableExtensions("gl_ObjectToWorldNV", 1, &E_GL_NV_ray_tracing);
9130
symbolTable.setVariableExtensions("gl_ObjectToWorldEXT", 1, &E_GL_EXT_ray_tracing);
9131
symbolTable.setVariableExtensions("gl_ObjectToWorld3x4EXT", 1, &E_GL_EXT_ray_tracing);
9132
symbolTable.setVariableExtensions("gl_WorldToObjectNV", 1, &E_GL_NV_ray_tracing);
9133
symbolTable.setVariableExtensions("gl_WorldToObjectEXT", 1, &E_GL_EXT_ray_tracing);
9134
symbolTable.setVariableExtensions("gl_WorldToObject3x4EXT", 1, &E_GL_EXT_ray_tracing);
9135
symbolTable.setVariableExtensions("gl_IncomingRayFlagsNV", 1, &E_GL_NV_ray_tracing);
9136
symbolTable.setVariableExtensions("gl_IncomingRayFlagsEXT", 1, &E_GL_EXT_ray_tracing);
9137
symbolTable.setVariableExtensions("gl_CurrentRayTimeNV", 1, &E_GL_NV_ray_tracing_motion_blur);
9138
symbolTable.setVariableExtensions("gl_HitTriangleVertexPositionsEXT", 1, &E_GL_EXT_ray_tracing_position_fetch);
9139
symbolTable.setVariableExtensions("gl_HitMicroTriangleVertexPositionsNV", 1, &E_GL_NV_displacement_micromap);
9140
symbolTable.setVariableExtensions("gl_HitMicroTriangleVertexBarycentricsNV", 1, &E_GL_NV_displacement_micromap);
9141
9142
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
9143
9144
9145
symbolTable.setFunctionExtensions("traceNV", 1, &E_GL_NV_ray_tracing);
9146
symbolTable.setFunctionExtensions("traceRayMotionNV", 1, &E_GL_NV_ray_tracing_motion_blur);
9147
symbolTable.setFunctionExtensions("traceRayEXT", 1, &E_GL_EXT_ray_tracing);
9148
symbolTable.setFunctionExtensions("reportIntersectionNV", 1, &E_GL_NV_ray_tracing);
9149
symbolTable.setFunctionExtensions("reportIntersectionEXT", 1, &E_GL_EXT_ray_tracing);
9150
symbolTable.setFunctionExtensions("ignoreIntersectionNV", 1, &E_GL_NV_ray_tracing);
9151
symbolTable.setFunctionExtensions("terminateRayNV", 1, &E_GL_NV_ray_tracing);
9152
symbolTable.setFunctionExtensions("executeCallableNV", 1, &E_GL_NV_ray_tracing);
9153
symbolTable.setFunctionExtensions("executeCallableEXT", 1, &E_GL_EXT_ray_tracing);
9154
9155
symbolTable.setFunctionExtensions("hitObjectTraceRayNV", 1, &E_GL_NV_shader_invocation_reorder);
9156
symbolTable.setFunctionExtensions("hitObjectTraceRayMotionNV", 1, &E_GL_NV_shader_invocation_reorder);
9157
symbolTable.setFunctionExtensions("hitObjectRecordHitNV", 1, &E_GL_NV_shader_invocation_reorder);
9158
symbolTable.setFunctionExtensions("hitObjectRecordHitMotionNV", 1, &E_GL_NV_shader_invocation_reorder);
9159
symbolTable.setFunctionExtensions("hitObjectRecordHitWithIndexNV", 1, &E_GL_NV_shader_invocation_reorder);
9160
symbolTable.setFunctionExtensions("hitObjectRecordHitWithIndexMotionNV", 1, &E_GL_NV_shader_invocation_reorder);
9161
symbolTable.setFunctionExtensions("hitObjectRecordMissNV", 1, &E_GL_NV_shader_invocation_reorder);
9162
symbolTable.setFunctionExtensions("hitObjectRecordMissMotionNV", 1, &E_GL_NV_shader_invocation_reorder);
9163
symbolTable.setFunctionExtensions("hitObjectRecordEmptyNV", 1, &E_GL_NV_shader_invocation_reorder);
9164
symbolTable.setFunctionExtensions("hitObjectExecuteShaderNV", 1, &E_GL_NV_shader_invocation_reorder);
9165
symbolTable.setFunctionExtensions("hitObjectIsEmptyNV", 1, &E_GL_NV_shader_invocation_reorder);
9166
symbolTable.setFunctionExtensions("hitObjectIsMissNV", 1, &E_GL_NV_shader_invocation_reorder);
9167
symbolTable.setFunctionExtensions("hitObjectIsHitNV", 1, &E_GL_NV_shader_invocation_reorder);
9168
symbolTable.setFunctionExtensions("hitObjectGetRayTMinNV", 1, &E_GL_NV_shader_invocation_reorder);
9169
symbolTable.setFunctionExtensions("hitObjectGetRayTMaxNV", 1, &E_GL_NV_shader_invocation_reorder);
9170
symbolTable.setFunctionExtensions("hitObjectGetObjectRayOriginNV", 1, &E_GL_NV_shader_invocation_reorder);
9171
symbolTable.setFunctionExtensions("hitObjectGetObjectRayDirectionNV", 1, &E_GL_NV_shader_invocation_reorder);
9172
symbolTable.setFunctionExtensions("hitObjectGetWorldRayOriginNV", 1, &E_GL_NV_shader_invocation_reorder);
9173
symbolTable.setFunctionExtensions("hitObjectGetWorldRayDirectionNV", 1, &E_GL_NV_shader_invocation_reorder);
9174
symbolTable.setFunctionExtensions("hitObjectGetWorldToObjectNV", 1, &E_GL_NV_shader_invocation_reorder);
9175
symbolTable.setFunctionExtensions("hitObjectGetbjectToWorldNV", 1, &E_GL_NV_shader_invocation_reorder);
9176
symbolTable.setFunctionExtensions("hitObjectGetInstanceCustomIndexNV", 1, &E_GL_NV_shader_invocation_reorder);
9177
symbolTable.setFunctionExtensions("hitObjectGetInstanceIdNV", 1, &E_GL_NV_shader_invocation_reorder);
9178
symbolTable.setFunctionExtensions("hitObjectGetGeometryIndexNV", 1, &E_GL_NV_shader_invocation_reorder);
9179
symbolTable.setFunctionExtensions("hitObjectGetPrimitiveIndexNV", 1, &E_GL_NV_shader_invocation_reorder);
9180
symbolTable.setFunctionExtensions("hitObjectGetHitKindNV", 1, &E_GL_NV_shader_invocation_reorder);
9181
symbolTable.setFunctionExtensions("hitObjectGetAttributesNV", 1, &E_GL_NV_shader_invocation_reorder);
9182
symbolTable.setFunctionExtensions("hitObjectGetCurrentTimeNV", 1, &E_GL_NV_shader_invocation_reorder);
9183
symbolTable.setFunctionExtensions("hitObjectGetShaderBindingTableRecordIndexNV", 1, &E_GL_NV_shader_invocation_reorder);
9184
symbolTable.setFunctionExtensions("hitObjectGetShaderRecordBufferHandleNV", 1, &E_GL_NV_shader_invocation_reorder);
9185
symbolTable.setFunctionExtensions("reorderThreadNV", 1, &E_GL_NV_shader_invocation_reorder);
9186
symbolTable.setFunctionExtensions("fetchMicroTriangleVertexPositionNV", 1, &E_GL_NV_displacement_micromap);
9187
symbolTable.setFunctionExtensions("fetchMicroTriangleVertexBarycentricNV", 1, &E_GL_NV_displacement_micromap);
9188
9189
9190
BuiltInVariable("gl_LaunchIDNV", EbvLaunchId, symbolTable);
9191
BuiltInVariable("gl_LaunchIDEXT", EbvLaunchId, symbolTable);
9192
BuiltInVariable("gl_LaunchSizeNV", EbvLaunchSize, symbolTable);
9193
BuiltInVariable("gl_LaunchSizeEXT", EbvLaunchSize, symbolTable);
9194
BuiltInVariable("gl_PrimitiveID", EbvPrimitiveId, symbolTable);
9195
BuiltInVariable("gl_InstanceID", EbvInstanceId, symbolTable);
9196
BuiltInVariable("gl_InstanceCustomIndexNV", EbvInstanceCustomIndex,symbolTable);
9197
BuiltInVariable("gl_InstanceCustomIndexEXT", EbvInstanceCustomIndex,symbolTable);
9198
BuiltInVariable("gl_GeometryIndexEXT", EbvGeometryIndex, symbolTable);
9199
BuiltInVariable("gl_WorldRayOriginNV", EbvWorldRayOrigin, symbolTable);
9200
BuiltInVariable("gl_WorldRayOriginEXT", EbvWorldRayOrigin, symbolTable);
9201
BuiltInVariable("gl_WorldRayDirectionNV", EbvWorldRayDirection, symbolTable);
9202
BuiltInVariable("gl_WorldRayDirectionEXT", EbvWorldRayDirection, symbolTable);
9203
BuiltInVariable("gl_ObjectRayOriginNV", EbvObjectRayOrigin, symbolTable);
9204
BuiltInVariable("gl_ObjectRayOriginEXT", EbvObjectRayOrigin, symbolTable);
9205
BuiltInVariable("gl_ObjectRayDirectionNV", EbvObjectRayDirection, symbolTable);
9206
BuiltInVariable("gl_ObjectRayDirectionEXT", EbvObjectRayDirection, symbolTable);
9207
BuiltInVariable("gl_RayTminNV", EbvRayTmin, symbolTable);
9208
BuiltInVariable("gl_RayTminEXT", EbvRayTmin, symbolTable);
9209
BuiltInVariable("gl_RayTmaxNV", EbvRayTmax, symbolTable);
9210
BuiltInVariable("gl_RayTmaxEXT", EbvRayTmax, symbolTable);
9211
BuiltInVariable("gl_CullMaskEXT", EbvCullMask, symbolTable);
9212
BuiltInVariable("gl_HitTNV", EbvHitT, symbolTable);
9213
BuiltInVariable("gl_HitTEXT", EbvHitT, symbolTable);
9214
BuiltInVariable("gl_HitKindNV", EbvHitKind, symbolTable);
9215
BuiltInVariable("gl_HitKindEXT", EbvHitKind, symbolTable);
9216
BuiltInVariable("gl_ObjectToWorldNV", EbvObjectToWorld, symbolTable);
9217
BuiltInVariable("gl_ObjectToWorldEXT", EbvObjectToWorld, symbolTable);
9218
BuiltInVariable("gl_ObjectToWorld3x4EXT", EbvObjectToWorld3x4, symbolTable);
9219
BuiltInVariable("gl_WorldToObjectNV", EbvWorldToObject, symbolTable);
9220
BuiltInVariable("gl_WorldToObjectEXT", EbvWorldToObject, symbolTable);
9221
BuiltInVariable("gl_WorldToObject3x4EXT", EbvWorldToObject3x4, symbolTable);
9222
BuiltInVariable("gl_IncomingRayFlagsNV", EbvIncomingRayFlags, symbolTable);
9223
BuiltInVariable("gl_IncomingRayFlagsEXT", EbvIncomingRayFlags, symbolTable);
9224
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
9225
BuiltInVariable("gl_CurrentRayTimeNV", EbvCurrentRayTimeNV, symbolTable);
9226
BuiltInVariable("gl_HitTriangleVertexPositionsEXT", EbvPositionFetch, symbolTable);
9227
BuiltInVariable("gl_HitMicroTriangleVertexPositionsNV", EbvMicroTrianglePositionNV, symbolTable);
9228
BuiltInVariable("gl_HitMicroTriangleVertexBarycentricsNV", EbvMicroTriangleBaryNV, symbolTable);
9229
BuiltInVariable("gl_HitKindFrontFacingMicroTriangleNV", EbvHitKindFrontFacingMicroTriangleNV, symbolTable);
9230
BuiltInVariable("gl_HitKindBackFacingMicroTriangleNV", EbvHitKindBackFacingMicroTriangleNV, symbolTable);
9231
9232
// GL_ARB_shader_ballot
9233
symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);
9234
symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot);
9235
symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot);
9236
symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot);
9237
symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot);
9238
symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot);
9239
symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot);
9240
9241
BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable);
9242
BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable);
9243
BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable);
9244
BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable);
9245
BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);
9246
BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable);
9247
9248
if (spvVersion.vulkan > 0) {
9249
// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan
9250
SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);
9251
if (language == EShLangFragment)
9252
ModifyFlatDecoration("gl_SubGroupSizeARB", true, symbolTable);
9253
}
9254
else
9255
BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable);
9256
9257
// GL_KHR_shader_subgroup
9258
symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic);
9259
symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic);
9260
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
9261
symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);
9262
symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9263
symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9264
symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9265
symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9266
symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9267
9268
BuiltInVariable("gl_NumSubgroups", EbvNumSubgroups, symbolTable);
9269
BuiltInVariable("gl_SubgroupID", EbvSubgroupID, symbolTable);
9270
BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);
9271
BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);
9272
BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);
9273
BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);
9274
BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);
9275
BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);
9276
BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);
9277
9278
// GL_NV_shader_sm_builtins
9279
symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins);
9280
symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins);
9281
symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins);
9282
symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins);
9283
BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable);
9284
BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);
9285
BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);
9286
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
9287
9288
// GL_ARM_shader_core_builtins
9289
symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);
9290
symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);
9291
symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
9292
symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);
9293
symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
9294
9295
BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);
9296
BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);
9297
BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);
9298
BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);
9299
BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);
9300
}
9301
if ((profile == EEsProfile && version >= 310) ||
9302
(profile != EEsProfile && version >= 450)) {
9303
symbolTable.setVariableExtensions("gl_ShadingRateFlag2VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9304
symbolTable.setVariableExtensions("gl_ShadingRateFlag4VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9305
symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9306
symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9307
}
9308
break;
9309
9310
case EShLangMesh:
9311
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
9312
// per-vertex builtins
9313
symbolTable.setVariableExtensions("gl_MeshVerticesNV", "gl_Position", 1, &E_GL_NV_mesh_shader);
9314
symbolTable.setVariableExtensions("gl_MeshVerticesNV", "gl_PointSize", 1, &E_GL_NV_mesh_shader);
9315
symbolTable.setVariableExtensions("gl_MeshVerticesNV", "gl_ClipDistance", 1, &E_GL_NV_mesh_shader);
9316
symbolTable.setVariableExtensions("gl_MeshVerticesNV", "gl_CullDistance", 1, &E_GL_NV_mesh_shader);
9317
9318
BuiltInVariable("gl_MeshVerticesNV", "gl_Position", EbvPosition, symbolTable);
9319
BuiltInVariable("gl_MeshVerticesNV", "gl_PointSize", EbvPointSize, symbolTable);
9320
BuiltInVariable("gl_MeshVerticesNV", "gl_ClipDistance", EbvClipDistance, symbolTable);
9321
BuiltInVariable("gl_MeshVerticesNV", "gl_CullDistance", EbvCullDistance, symbolTable);
9322
9323
symbolTable.setVariableExtensions("gl_MeshVerticesNV", "gl_PositionPerViewNV", 1, &E_GL_NV_mesh_shader);
9324
symbolTable.setVariableExtensions("gl_MeshVerticesNV", "gl_ClipDistancePerViewNV", 1, &E_GL_NV_mesh_shader);
9325
symbolTable.setVariableExtensions("gl_MeshVerticesNV", "gl_CullDistancePerViewNV", 1, &E_GL_NV_mesh_shader);
9326
9327
BuiltInVariable("gl_MeshVerticesNV", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable);
9328
BuiltInVariable("gl_MeshVerticesNV", "gl_ClipDistancePerViewNV", EbvClipDistancePerViewNV, symbolTable);
9329
BuiltInVariable("gl_MeshVerticesNV", "gl_CullDistancePerViewNV", EbvCullDistancePerViewNV, symbolTable);
9330
9331
// per-primitive builtins
9332
symbolTable.setVariableExtensions("gl_MeshPrimitivesNV", "gl_PrimitiveID", 1, &E_GL_NV_mesh_shader);
9333
symbolTable.setVariableExtensions("gl_MeshPrimitivesNV", "gl_Layer", 1, &E_GL_NV_mesh_shader);
9334
symbolTable.setVariableExtensions("gl_MeshPrimitivesNV", "gl_ViewportIndex", 1, &E_GL_NV_mesh_shader);
9335
symbolTable.setVariableExtensions("gl_MeshPrimitivesNV", "gl_ViewportMask", 1, &E_GL_NV_mesh_shader);
9336
9337
BuiltInVariable("gl_MeshPrimitivesNV", "gl_PrimitiveID", EbvPrimitiveId, symbolTable);
9338
BuiltInVariable("gl_MeshPrimitivesNV", "gl_Layer", EbvLayer, symbolTable);
9339
BuiltInVariable("gl_MeshPrimitivesNV", "gl_ViewportIndex", EbvViewportIndex, symbolTable);
9340
BuiltInVariable("gl_MeshPrimitivesNV", "gl_ViewportMask", EbvViewportMaskNV, symbolTable);
9341
9342
// per-view per-primitive builtins
9343
symbolTable.setVariableExtensions("gl_MeshPrimitivesNV", "gl_LayerPerViewNV", 1, &E_GL_NV_mesh_shader);
9344
symbolTable.setVariableExtensions("gl_MeshPrimitivesNV", "gl_ViewportMaskPerViewNV", 1, &E_GL_NV_mesh_shader);
9345
9346
BuiltInVariable("gl_MeshPrimitivesNV", "gl_LayerPerViewNV", EbvLayerPerViewNV, symbolTable);
9347
BuiltInVariable("gl_MeshPrimitivesNV", "gl_ViewportMaskPerViewNV", EbvViewportMaskPerViewNV, symbolTable);
9348
9349
// other builtins
9350
symbolTable.setVariableExtensions("gl_PrimitiveCountNV", 1, &E_GL_NV_mesh_shader);
9351
symbolTable.setVariableExtensions("gl_PrimitiveIndicesNV", 1, &E_GL_NV_mesh_shader);
9352
symbolTable.setVariableExtensions("gl_MeshViewCountNV", 1, &E_GL_NV_mesh_shader);
9353
symbolTable.setVariableExtensions("gl_MeshViewIndicesNV", 1, &E_GL_NV_mesh_shader);
9354
if (profile != EEsProfile) {
9355
symbolTable.setVariableExtensions("gl_WorkGroupSize", Num_AEP_mesh_shader, AEP_mesh_shader);
9356
symbolTable.setVariableExtensions("gl_WorkGroupID", Num_AEP_mesh_shader, AEP_mesh_shader);
9357
symbolTable.setVariableExtensions("gl_LocalInvocationID", Num_AEP_mesh_shader, AEP_mesh_shader);
9358
symbolTable.setVariableExtensions("gl_GlobalInvocationID", Num_AEP_mesh_shader, AEP_mesh_shader);
9359
symbolTable.setVariableExtensions("gl_LocalInvocationIndex", Num_AEP_mesh_shader, AEP_mesh_shader);
9360
} else {
9361
symbolTable.setVariableExtensions("gl_WorkGroupSize", 1, &E_GL_NV_mesh_shader);
9362
symbolTable.setVariableExtensions("gl_WorkGroupID", 1, &E_GL_NV_mesh_shader);
9363
symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_NV_mesh_shader);
9364
symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_NV_mesh_shader);
9365
symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_NV_mesh_shader);
9366
}
9367
BuiltInVariable("gl_PrimitiveCountNV", EbvPrimitiveCountNV, symbolTable);
9368
BuiltInVariable("gl_PrimitiveIndicesNV", EbvPrimitiveIndicesNV, symbolTable);
9369
BuiltInVariable("gl_MeshViewCountNV", EbvMeshViewCountNV, symbolTable);
9370
BuiltInVariable("gl_MeshViewIndicesNV", EbvMeshViewIndicesNV, symbolTable);
9371
BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable);
9372
BuiltInVariable("gl_WorkGroupID", EbvWorkGroupId, symbolTable);
9373
BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable);
9374
BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable);
9375
BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable);
9376
9377
// builtin constants
9378
symbolTable.setVariableExtensions("gl_MaxMeshOutputVerticesNV", 1, &E_GL_NV_mesh_shader);
9379
symbolTable.setVariableExtensions("gl_MaxMeshOutputPrimitivesNV", 1, &E_GL_NV_mesh_shader);
9380
symbolTable.setVariableExtensions("gl_MaxMeshWorkGroupSizeNV", 1, &E_GL_NV_mesh_shader);
9381
symbolTable.setVariableExtensions("gl_MaxMeshViewCountNV", 1, &E_GL_NV_mesh_shader);
9382
9383
// builtin functions
9384
if (profile != EEsProfile) {
9385
symbolTable.setFunctionExtensions("barrier", Num_AEP_mesh_shader, AEP_mesh_shader);
9386
symbolTable.setFunctionExtensions("memoryBarrierShared", Num_AEP_mesh_shader, AEP_mesh_shader);
9387
symbolTable.setFunctionExtensions("groupMemoryBarrier", Num_AEP_mesh_shader, AEP_mesh_shader);
9388
} else {
9389
symbolTable.setFunctionExtensions("barrier", 1, &E_GL_NV_mesh_shader);
9390
symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_NV_mesh_shader);
9391
symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_NV_mesh_shader);
9392
}
9393
symbolTable.setFunctionExtensions("writePackedPrimitiveIndices4x8NV", 1, &E_GL_NV_mesh_shader);
9394
}
9395
9396
if (profile != EEsProfile && version >= 450) {
9397
// GL_EXT_Mesh_shader
9398
symbolTable.setVariableExtensions("gl_PrimitivePointIndicesEXT", 1, &E_GL_EXT_mesh_shader);
9399
symbolTable.setVariableExtensions("gl_PrimitiveLineIndicesEXT", 1, &E_GL_EXT_mesh_shader);
9400
symbolTable.setVariableExtensions("gl_PrimitiveTriangleIndicesEXT", 1, &E_GL_EXT_mesh_shader);
9401
symbolTable.setVariableExtensions("gl_NumWorkGroups", 1, &E_GL_EXT_mesh_shader);
9402
9403
BuiltInVariable("gl_PrimitivePointIndicesEXT", EbvPrimitivePointIndicesEXT, symbolTable);
9404
BuiltInVariable("gl_PrimitiveLineIndicesEXT", EbvPrimitiveLineIndicesEXT, symbolTable);
9405
BuiltInVariable("gl_PrimitiveTriangleIndicesEXT", EbvPrimitiveTriangleIndicesEXT, symbolTable);
9406
BuiltInVariable("gl_NumWorkGroups", EbvNumWorkGroups, symbolTable);
9407
9408
symbolTable.setVariableExtensions("gl_MeshVerticesEXT", "gl_Position", 1, &E_GL_EXT_mesh_shader);
9409
symbolTable.setVariableExtensions("gl_MeshVerticesEXT", "gl_PointSize", 1, &E_GL_EXT_mesh_shader);
9410
symbolTable.setVariableExtensions("gl_MeshVerticesEXT", "gl_ClipDistance", 1, &E_GL_EXT_mesh_shader);
9411
symbolTable.setVariableExtensions("gl_MeshVerticesEXT", "gl_CullDistance", 1, &E_GL_EXT_mesh_shader);
9412
9413
BuiltInVariable("gl_MeshVerticesEXT", "gl_Position", EbvPosition, symbolTable);
9414
BuiltInVariable("gl_MeshVerticesEXT", "gl_PointSize", EbvPointSize, symbolTable);
9415
BuiltInVariable("gl_MeshVerticesEXT", "gl_ClipDistance", EbvClipDistance, symbolTable);
9416
BuiltInVariable("gl_MeshVerticesEXT", "gl_CullDistance", EbvCullDistance, symbolTable);
9417
9418
symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_PrimitiveID", 1, &E_GL_EXT_mesh_shader);
9419
symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_Layer", 1, &E_GL_EXT_mesh_shader);
9420
symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_ViewportIndex", 1, &E_GL_EXT_mesh_shader);
9421
symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_CullPrimitiveEXT", 1, &E_GL_EXT_mesh_shader);
9422
9423
// note: technically this member requires both GL_EXT_mesh_shader and GL_EXT_fragment_shading_rate
9424
// since setVariableExtensions only needs *one of* the extensions to validate, it's more useful to specify EXT_fragment_shading_rate
9425
// GL_EXT_mesh_shader will be required in practice by use of other fields of gl_MeshPrimitivesEXT
9426
symbolTable.setVariableExtensions("gl_MeshPrimitivesEXT", "gl_PrimitiveShadingRateEXT", 1, &E_GL_EXT_fragment_shading_rate);
9427
9428
BuiltInVariable("gl_MeshPrimitivesEXT", "gl_PrimitiveID", EbvPrimitiveId, symbolTable);
9429
BuiltInVariable("gl_MeshPrimitivesEXT", "gl_Layer", EbvLayer, symbolTable);
9430
BuiltInVariable("gl_MeshPrimitivesEXT", "gl_ViewportIndex", EbvViewportIndex, symbolTable);
9431
BuiltInVariable("gl_MeshPrimitivesEXT", "gl_CullPrimitiveEXT", EbvCullPrimitiveEXT, symbolTable);
9432
BuiltInVariable("gl_MeshPrimitivesEXT", "gl_PrimitiveShadingRateEXT", EbvPrimitiveShadingRateKHR, symbolTable);
9433
9434
symbolTable.setFunctionExtensions("SetMeshOutputsEXT", 1, &E_GL_EXT_mesh_shader);
9435
9436
// GL_EXT_device_group
9437
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
9438
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
9439
9440
// GL_ARB_shader_draw_parameters
9441
symbolTable.setVariableExtensions("gl_DrawIDARB", 1, &E_GL_ARB_shader_draw_parameters);
9442
BuiltInVariable("gl_DrawIDARB", EbvDrawId, symbolTable);
9443
if (version >= 460) {
9444
BuiltInVariable("gl_DrawID", EbvDrawId, symbolTable);
9445
}
9446
// GL_EXT_multiview
9447
BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
9448
symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
9449
9450
// GL_ARB_shader_ballot
9451
symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);
9452
symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot);
9453
symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot);
9454
symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot);
9455
symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot);
9456
symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot);
9457
symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot);
9458
9459
BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable);
9460
BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable);
9461
BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable);
9462
BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable);
9463
BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);
9464
BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable);
9465
9466
if (spvVersion.vulkan > 0) {
9467
// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan
9468
SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);
9469
if (language == EShLangFragment)
9470
ModifyFlatDecoration("gl_SubGroupSizeARB", true, symbolTable);
9471
}
9472
else
9473
BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable);
9474
}
9475
9476
// GL_KHR_shader_subgroup
9477
if ((profile == EEsProfile && version >= 310) ||
9478
(profile != EEsProfile && version >= 140)) {
9479
symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic);
9480
symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic);
9481
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
9482
symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);
9483
symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9484
symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9485
symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9486
symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9487
symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9488
9489
BuiltInVariable("gl_NumSubgroups", EbvNumSubgroups, symbolTable);
9490
BuiltInVariable("gl_SubgroupID", EbvSubgroupID, symbolTable);
9491
BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);
9492
BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);
9493
BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);
9494
BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);
9495
BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);
9496
BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);
9497
BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);
9498
9499
symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic);
9500
9501
// GL_NV_shader_sm_builtins
9502
symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins);
9503
symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins);
9504
symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins);
9505
symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins);
9506
BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable);
9507
BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);
9508
BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);
9509
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
9510
9511
// GL_ARM_shader_core_builtins
9512
symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);
9513
symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);
9514
symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
9515
symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);
9516
symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
9517
9518
BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);
9519
BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);
9520
BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);
9521
BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);
9522
BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);
9523
}
9524
9525
if ((profile == EEsProfile && version >= 310) ||
9526
(profile != EEsProfile && version >= 450)) {
9527
symbolTable.setVariableExtensions("gl_ShadingRateFlag2VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9528
symbolTable.setVariableExtensions("gl_ShadingRateFlag4VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9529
symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9530
symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9531
}
9532
9533
// Builtins for GL_NV_displacment_micromap
9534
if ((profile != EEsProfile && version >= 460)) {
9535
symbolTable.setFunctionExtensions("fetchMicroTriangleVertexPositionNV", 1, &E_GL_NV_displacement_micromap);
9536
symbolTable.setFunctionExtensions("fetchMicroTriangleVertexBarycentricNV", 1, &E_GL_NV_displacement_micromap);
9537
}
9538
9539
break;
9540
9541
case EShLangTask:
9542
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
9543
symbolTable.setVariableExtensions("gl_TaskCountNV", 1, &E_GL_NV_mesh_shader);
9544
symbolTable.setVariableExtensions("gl_MeshViewCountNV", 1, &E_GL_NV_mesh_shader);
9545
symbolTable.setVariableExtensions("gl_MeshViewIndicesNV", 1, &E_GL_NV_mesh_shader);
9546
if (profile != EEsProfile) {
9547
symbolTable.setVariableExtensions("gl_WorkGroupSize", Num_AEP_mesh_shader, AEP_mesh_shader);
9548
symbolTable.setVariableExtensions("gl_WorkGroupID", Num_AEP_mesh_shader, AEP_mesh_shader);
9549
symbolTable.setVariableExtensions("gl_LocalInvocationID", Num_AEP_mesh_shader, AEP_mesh_shader);
9550
symbolTable.setVariableExtensions("gl_GlobalInvocationID", Num_AEP_mesh_shader, AEP_mesh_shader);
9551
symbolTable.setVariableExtensions("gl_LocalInvocationIndex", Num_AEP_mesh_shader, AEP_mesh_shader);
9552
} else {
9553
symbolTable.setVariableExtensions("gl_WorkGroupSize", 1, &E_GL_NV_mesh_shader);
9554
symbolTable.setVariableExtensions("gl_WorkGroupID", 1, &E_GL_NV_mesh_shader);
9555
symbolTable.setVariableExtensions("gl_LocalInvocationID", 1, &E_GL_NV_mesh_shader);
9556
symbolTable.setVariableExtensions("gl_GlobalInvocationID", 1, &E_GL_NV_mesh_shader);
9557
symbolTable.setVariableExtensions("gl_LocalInvocationIndex", 1, &E_GL_NV_mesh_shader);
9558
}
9559
9560
BuiltInVariable("gl_TaskCountNV", EbvTaskCountNV, symbolTable);
9561
BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable);
9562
BuiltInVariable("gl_WorkGroupID", EbvWorkGroupId, symbolTable);
9563
BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable);
9564
BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable);
9565
BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable);
9566
BuiltInVariable("gl_MeshViewCountNV", EbvMeshViewCountNV, symbolTable);
9567
BuiltInVariable("gl_MeshViewIndicesNV", EbvMeshViewIndicesNV, symbolTable);
9568
9569
symbolTable.setVariableExtensions("gl_MaxTaskWorkGroupSizeNV", 1, &E_GL_NV_mesh_shader);
9570
symbolTable.setVariableExtensions("gl_MaxMeshViewCountNV", 1, &E_GL_NV_mesh_shader);
9571
9572
if (profile != EEsProfile) {
9573
symbolTable.setFunctionExtensions("barrier", Num_AEP_mesh_shader, AEP_mesh_shader);
9574
symbolTable.setFunctionExtensions("memoryBarrierShared", Num_AEP_mesh_shader, AEP_mesh_shader);
9575
symbolTable.setFunctionExtensions("groupMemoryBarrier", Num_AEP_mesh_shader, AEP_mesh_shader);
9576
} else {
9577
symbolTable.setFunctionExtensions("barrier", 1, &E_GL_NV_mesh_shader);
9578
symbolTable.setFunctionExtensions("memoryBarrierShared", 1, &E_GL_NV_mesh_shader);
9579
symbolTable.setFunctionExtensions("groupMemoryBarrier", 1, &E_GL_NV_mesh_shader);
9580
}
9581
}
9582
9583
if (profile != EEsProfile && version >= 450) {
9584
// GL_EXT_mesh_shader
9585
symbolTable.setFunctionExtensions("EmitMeshTasksEXT", 1, &E_GL_EXT_mesh_shader);
9586
symbolTable.setVariableExtensions("gl_NumWorkGroups", 1, &E_GL_EXT_mesh_shader);
9587
BuiltInVariable("gl_NumWorkGroups", EbvNumWorkGroups, symbolTable);
9588
9589
// GL_EXT_device_group
9590
symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
9591
BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
9592
9593
// GL_ARB_shader_draw_parameters
9594
symbolTable.setVariableExtensions("gl_DrawIDARB", 1, &E_GL_ARB_shader_draw_parameters);
9595
BuiltInVariable("gl_DrawIDARB", EbvDrawId, symbolTable);
9596
if (version >= 460) {
9597
BuiltInVariable("gl_DrawID", EbvDrawId, symbolTable);
9598
}
9599
9600
// GL_ARB_shader_ballot
9601
symbolTable.setVariableExtensions("gl_SubGroupSizeARB", 1, &E_GL_ARB_shader_ballot);
9602
symbolTable.setVariableExtensions("gl_SubGroupInvocationARB", 1, &E_GL_ARB_shader_ballot);
9603
symbolTable.setVariableExtensions("gl_SubGroupEqMaskARB", 1, &E_GL_ARB_shader_ballot);
9604
symbolTable.setVariableExtensions("gl_SubGroupGeMaskARB", 1, &E_GL_ARB_shader_ballot);
9605
symbolTable.setVariableExtensions("gl_SubGroupGtMaskARB", 1, &E_GL_ARB_shader_ballot);
9606
symbolTable.setVariableExtensions("gl_SubGroupLeMaskARB", 1, &E_GL_ARB_shader_ballot);
9607
symbolTable.setVariableExtensions("gl_SubGroupLtMaskARB", 1, &E_GL_ARB_shader_ballot);
9608
9609
BuiltInVariable("gl_SubGroupInvocationARB", EbvSubGroupInvocation, symbolTable);
9610
BuiltInVariable("gl_SubGroupEqMaskARB", EbvSubGroupEqMask, symbolTable);
9611
BuiltInVariable("gl_SubGroupGeMaskARB", EbvSubGroupGeMask, symbolTable);
9612
BuiltInVariable("gl_SubGroupGtMaskARB", EbvSubGroupGtMask, symbolTable);
9613
BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);
9614
BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable);
9615
9616
if (spvVersion.vulkan > 0) {
9617
// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan
9618
SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);
9619
if (language == EShLangFragment)
9620
ModifyFlatDecoration("gl_SubGroupSizeARB", true, symbolTable);
9621
}
9622
else
9623
BuiltInVariable("gl_SubGroupSizeARB", EbvSubGroupSize, symbolTable);
9624
}
9625
9626
// GL_KHR_shader_subgroup
9627
if ((profile == EEsProfile && version >= 310) ||
9628
(profile != EEsProfile && version >= 140)) {
9629
symbolTable.setVariableExtensions("gl_NumSubgroups", 1, &E_GL_KHR_shader_subgroup_basic);
9630
symbolTable.setVariableExtensions("gl_SubgroupID", 1, &E_GL_KHR_shader_subgroup_basic);
9631
symbolTable.setVariableExtensions("gl_SubgroupSize", 1, &E_GL_KHR_shader_subgroup_basic);
9632
symbolTable.setVariableExtensions("gl_SubgroupInvocationID", 1, &E_GL_KHR_shader_subgroup_basic);
9633
symbolTable.setVariableExtensions("gl_SubgroupEqMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9634
symbolTable.setVariableExtensions("gl_SubgroupGeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9635
symbolTable.setVariableExtensions("gl_SubgroupGtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9636
symbolTable.setVariableExtensions("gl_SubgroupLeMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9637
symbolTable.setVariableExtensions("gl_SubgroupLtMask", 1, &E_GL_KHR_shader_subgroup_ballot);
9638
9639
BuiltInVariable("gl_NumSubgroups", EbvNumSubgroups, symbolTable);
9640
BuiltInVariable("gl_SubgroupID", EbvSubgroupID, symbolTable);
9641
BuiltInVariable("gl_SubgroupSize", EbvSubgroupSize2, symbolTable);
9642
BuiltInVariable("gl_SubgroupInvocationID", EbvSubgroupInvocation2, symbolTable);
9643
BuiltInVariable("gl_SubgroupEqMask", EbvSubgroupEqMask2, symbolTable);
9644
BuiltInVariable("gl_SubgroupGeMask", EbvSubgroupGeMask2, symbolTable);
9645
BuiltInVariable("gl_SubgroupGtMask", EbvSubgroupGtMask2, symbolTable);
9646
BuiltInVariable("gl_SubgroupLeMask", EbvSubgroupLeMask2, symbolTable);
9647
BuiltInVariable("gl_SubgroupLtMask", EbvSubgroupLtMask2, symbolTable);
9648
9649
symbolTable.setFunctionExtensions("subgroupMemoryBarrierShared", 1, &E_GL_KHR_shader_subgroup_basic);
9650
9651
// GL_NV_shader_sm_builtins
9652
symbolTable.setVariableExtensions("gl_WarpsPerSMNV", 1, &E_GL_NV_shader_sm_builtins);
9653
symbolTable.setVariableExtensions("gl_SMCountNV", 1, &E_GL_NV_shader_sm_builtins);
9654
symbolTable.setVariableExtensions("gl_WarpIDNV", 1, &E_GL_NV_shader_sm_builtins);
9655
symbolTable.setVariableExtensions("gl_SMIDNV", 1, &E_GL_NV_shader_sm_builtins);
9656
BuiltInVariable("gl_WarpsPerSMNV", EbvWarpsPerSM, symbolTable);
9657
BuiltInVariable("gl_SMCountNV", EbvSMCount, symbolTable);
9658
BuiltInVariable("gl_WarpIDNV", EbvWarpID, symbolTable);
9659
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
9660
9661
// GL_ARM_shader_core_builtins
9662
symbolTable.setVariableExtensions("gl_CoreCountARM", 1, &E_GL_ARM_shader_core_builtins);
9663
symbolTable.setVariableExtensions("gl_CoreIDARM", 1, &E_GL_ARM_shader_core_builtins);
9664
symbolTable.setVariableExtensions("gl_CoreMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
9665
symbolTable.setVariableExtensions("gl_WarpIDARM", 1, &E_GL_ARM_shader_core_builtins);
9666
symbolTable.setVariableExtensions("gl_WarpMaxIDARM", 1, &E_GL_ARM_shader_core_builtins);
9667
9668
BuiltInVariable("gl_CoreCountARM", EbvCoreCountARM, symbolTable);
9669
BuiltInVariable("gl_CoreIDARM", EbvCoreIDARM, symbolTable);
9670
BuiltInVariable("gl_CoreMaxIDARM", EbvCoreMaxIDARM, symbolTable);
9671
BuiltInVariable("gl_WarpIDARM", EbvWarpIDARM, symbolTable);
9672
BuiltInVariable("gl_WarpMaxIDARM", EbvWarpMaxIDARM, symbolTable);
9673
}
9674
if ((profile == EEsProfile && version >= 310) ||
9675
(profile != EEsProfile && version >= 450)) {
9676
symbolTable.setVariableExtensions("gl_ShadingRateFlag2VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9677
symbolTable.setVariableExtensions("gl_ShadingRateFlag4VerticalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9678
symbolTable.setVariableExtensions("gl_ShadingRateFlag2HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9679
symbolTable.setVariableExtensions("gl_ShadingRateFlag4HorizontalPixelsEXT", 1, &E_GL_EXT_fragment_shading_rate);
9680
}
9681
break;
9682
9683
default:
9684
assert(false && "Language not supported");
9685
break;
9686
}
9687
9688
//
9689
// Next, identify which built-ins have a mapping to an operator.
9690
// If PureOperatorBuiltins is false, those that are not identified as such are
9691
// expected to be resolved through a library of functions, versus as
9692
// operations.
9693
//
9694
9695
relateTabledBuiltins(version, profile, spvVersion, language, symbolTable);
9696
9697
symbolTable.relateToOperator("doubleBitsToInt64", EOpDoubleBitsToInt64);
9698
symbolTable.relateToOperator("doubleBitsToUint64", EOpDoubleBitsToUint64);
9699
symbolTable.relateToOperator("int64BitsToDouble", EOpInt64BitsToDouble);
9700
symbolTable.relateToOperator("uint64BitsToDouble", EOpUint64BitsToDouble);
9701
symbolTable.relateToOperator("halfBitsToInt16", EOpFloat16BitsToInt16);
9702
symbolTable.relateToOperator("halfBitsToUint16", EOpFloat16BitsToUint16);
9703
symbolTable.relateToOperator("float16BitsToInt16", EOpFloat16BitsToInt16);
9704
symbolTable.relateToOperator("float16BitsToUint16", EOpFloat16BitsToUint16);
9705
symbolTable.relateToOperator("int16BitsToFloat16", EOpInt16BitsToFloat16);
9706
symbolTable.relateToOperator("uint16BitsToFloat16", EOpUint16BitsToFloat16);
9707
9708
symbolTable.relateToOperator("int16BitsToHalf", EOpInt16BitsToFloat16);
9709
symbolTable.relateToOperator("uint16BitsToHalf", EOpUint16BitsToFloat16);
9710
9711
symbolTable.relateToOperator("packSnorm4x8", EOpPackSnorm4x8);
9712
symbolTable.relateToOperator("unpackSnorm4x8", EOpUnpackSnorm4x8);
9713
symbolTable.relateToOperator("packUnorm4x8", EOpPackUnorm4x8);
9714
symbolTable.relateToOperator("unpackUnorm4x8", EOpUnpackUnorm4x8);
9715
9716
symbolTable.relateToOperator("packDouble2x32", EOpPackDouble2x32);
9717
symbolTable.relateToOperator("unpackDouble2x32", EOpUnpackDouble2x32);
9718
9719
symbolTable.relateToOperator("packInt2x32", EOpPackInt2x32);
9720
symbolTable.relateToOperator("unpackInt2x32", EOpUnpackInt2x32);
9721
symbolTable.relateToOperator("packUint2x32", EOpPackUint2x32);
9722
symbolTable.relateToOperator("unpackUint2x32", EOpUnpackUint2x32);
9723
9724
symbolTable.relateToOperator("packInt2x16", EOpPackInt2x16);
9725
symbolTable.relateToOperator("unpackInt2x16", EOpUnpackInt2x16);
9726
symbolTable.relateToOperator("packUint2x16", EOpPackUint2x16);
9727
symbolTable.relateToOperator("unpackUint2x16", EOpUnpackUint2x16);
9728
9729
symbolTable.relateToOperator("packInt4x16", EOpPackInt4x16);
9730
symbolTable.relateToOperator("unpackInt4x16", EOpUnpackInt4x16);
9731
symbolTable.relateToOperator("packUint4x16", EOpPackUint4x16);
9732
symbolTable.relateToOperator("unpackUint4x16", EOpUnpackUint4x16);
9733
symbolTable.relateToOperator("packFloat2x16", EOpPackFloat2x16);
9734
symbolTable.relateToOperator("unpackFloat2x16", EOpUnpackFloat2x16);
9735
9736
symbolTable.relateToOperator("pack16", EOpPack16);
9737
symbolTable.relateToOperator("pack32", EOpPack32);
9738
symbolTable.relateToOperator("pack64", EOpPack64);
9739
9740
symbolTable.relateToOperator("unpack32", EOpUnpack32);
9741
symbolTable.relateToOperator("unpack16", EOpUnpack16);
9742
symbolTable.relateToOperator("unpack8", EOpUnpack8);
9743
9744
symbolTable.relateToOperator("controlBarrier", EOpBarrier);
9745
symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierAtomicCounter);
9746
symbolTable.relateToOperator("memoryBarrierImage", EOpMemoryBarrierImage);
9747
9748
if (spvVersion.vulkanRelaxed) {
9749
//
9750
// functions signature have been replaced to take uint operations on buffer variables
9751
// remap atomic counter functions to atomic operations
9752
//
9753
symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierBuffer);
9754
}
9755
9756
symbolTable.relateToOperator("atomicLoad", EOpAtomicLoad);
9757
symbolTable.relateToOperator("atomicStore", EOpAtomicStore);
9758
9759
symbolTable.relateToOperator("atomicCounterIncrement", EOpAtomicCounterIncrement);
9760
symbolTable.relateToOperator("atomicCounterDecrement", EOpAtomicCounterDecrement);
9761
symbolTable.relateToOperator("atomicCounter", EOpAtomicCounter);
9762
9763
if (spvVersion.vulkanRelaxed) {
9764
//
9765
// functions signature have been replaced to take uint operations
9766
// remap atomic counter functions to atomic operations
9767
//
9768
// these atomic counter functions do not match signatures of glsl
9769
// atomic functions, so they will be remapped to semantically
9770
// equivalent functions in the parser
9771
//
9772
symbolTable.relateToOperator("atomicCounterIncrement", EOpNull);
9773
symbolTable.relateToOperator("atomicCounterDecrement", EOpNull);
9774
symbolTable.relateToOperator("atomicCounter", EOpNull);
9775
}
9776
9777
symbolTable.relateToOperator("clockARB", EOpReadClockSubgroupKHR);
9778
symbolTable.relateToOperator("clock2x32ARB", EOpReadClockSubgroupKHR);
9779
9780
symbolTable.relateToOperator("clockRealtimeEXT", EOpReadClockDeviceKHR);
9781
symbolTable.relateToOperator("clockRealtime2x32EXT", EOpReadClockDeviceKHR);
9782
9783
if (profile != EEsProfile && version == 450) {
9784
symbolTable.relateToOperator("atomicCounterAddARB", EOpAtomicCounterAdd);
9785
symbolTable.relateToOperator("atomicCounterSubtractARB", EOpAtomicCounterSubtract);
9786
symbolTable.relateToOperator("atomicCounterMinARB", EOpAtomicCounterMin);
9787
symbolTable.relateToOperator("atomicCounterMaxARB", EOpAtomicCounterMax);
9788
symbolTable.relateToOperator("atomicCounterAndARB", EOpAtomicCounterAnd);
9789
symbolTable.relateToOperator("atomicCounterOrARB", EOpAtomicCounterOr);
9790
symbolTable.relateToOperator("atomicCounterXorARB", EOpAtomicCounterXor);
9791
symbolTable.relateToOperator("atomicCounterExchangeARB", EOpAtomicCounterExchange);
9792
symbolTable.relateToOperator("atomicCounterCompSwapARB", EOpAtomicCounterCompSwap);
9793
}
9794
9795
if (profile != EEsProfile && version >= 460) {
9796
symbolTable.relateToOperator("atomicCounterAdd", EOpAtomicCounterAdd);
9797
symbolTable.relateToOperator("atomicCounterSubtract", EOpAtomicCounterSubtract);
9798
symbolTable.relateToOperator("atomicCounterMin", EOpAtomicCounterMin);
9799
symbolTable.relateToOperator("atomicCounterMax", EOpAtomicCounterMax);
9800
symbolTable.relateToOperator("atomicCounterAnd", EOpAtomicCounterAnd);
9801
symbolTable.relateToOperator("atomicCounterOr", EOpAtomicCounterOr);
9802
symbolTable.relateToOperator("atomicCounterXor", EOpAtomicCounterXor);
9803
symbolTable.relateToOperator("atomicCounterExchange", EOpAtomicCounterExchange);
9804
symbolTable.relateToOperator("atomicCounterCompSwap", EOpAtomicCounterCompSwap);
9805
}
9806
9807
if (spvVersion.vulkanRelaxed) {
9808
//
9809
// functions signature have been replaced to take 'uint' instead of 'atomic_uint'
9810
// remap atomic counter functions to non-counter atomic ops so
9811
// functions act as aliases to non-counter atomic ops
9812
//
9813
symbolTable.relateToOperator("atomicCounterAdd", EOpAtomicAdd);
9814
symbolTable.relateToOperator("atomicCounterSubtract", EOpAtomicSubtract);
9815
symbolTable.relateToOperator("atomicCounterMin", EOpAtomicMin);
9816
symbolTable.relateToOperator("atomicCounterMax", EOpAtomicMax);
9817
symbolTable.relateToOperator("atomicCounterAnd", EOpAtomicAnd);
9818
symbolTable.relateToOperator("atomicCounterOr", EOpAtomicOr);
9819
symbolTable.relateToOperator("atomicCounterXor", EOpAtomicXor);
9820
symbolTable.relateToOperator("atomicCounterExchange", EOpAtomicExchange);
9821
symbolTable.relateToOperator("atomicCounterCompSwap", EOpAtomicCompSwap);
9822
}
9823
9824
symbolTable.relateToOperator("fma", EOpFma);
9825
symbolTable.relateToOperator("frexp", EOpFrexp);
9826
symbolTable.relateToOperator("ldexp", EOpLdexp);
9827
symbolTable.relateToOperator("uaddCarry", EOpAddCarry);
9828
symbolTable.relateToOperator("usubBorrow", EOpSubBorrow);
9829
symbolTable.relateToOperator("umulExtended", EOpUMulExtended);
9830
symbolTable.relateToOperator("imulExtended", EOpIMulExtended);
9831
symbolTable.relateToOperator("bitfieldExtract", EOpBitfieldExtract);
9832
symbolTable.relateToOperator("bitfieldInsert", EOpBitfieldInsert);
9833
symbolTable.relateToOperator("bitfieldReverse", EOpBitFieldReverse);
9834
symbolTable.relateToOperator("bitCount", EOpBitCount);
9835
symbolTable.relateToOperator("findLSB", EOpFindLSB);
9836
symbolTable.relateToOperator("findMSB", EOpFindMSB);
9837
9838
symbolTable.relateToOperator("helperInvocationEXT", EOpIsHelperInvocation);
9839
9840
symbolTable.relateToOperator("countLeadingZeros", EOpCountLeadingZeros);
9841
symbolTable.relateToOperator("countTrailingZeros", EOpCountTrailingZeros);
9842
symbolTable.relateToOperator("absoluteDifference", EOpAbsDifference);
9843
symbolTable.relateToOperator("addSaturate", EOpAddSaturate);
9844
symbolTable.relateToOperator("subtractSaturate", EOpSubSaturate);
9845
symbolTable.relateToOperator("average", EOpAverage);
9846
symbolTable.relateToOperator("averageRounded", EOpAverageRounded);
9847
symbolTable.relateToOperator("multiply32x16", EOpMul32x16);
9848
symbolTable.relateToOperator("debugPrintfEXT", EOpDebugPrintf);
9849
symbolTable.relateToOperator("assumeEXT", EOpAssumeEXT);
9850
symbolTable.relateToOperator("expectEXT", EOpExpectEXT);
9851
9852
9853
if (PureOperatorBuiltins) {
9854
symbolTable.relateToOperator("imageSize", EOpImageQuerySize);
9855
symbolTable.relateToOperator("imageSamples", EOpImageQuerySamples);
9856
symbolTable.relateToOperator("imageLoad", EOpImageLoad);
9857
symbolTable.relateToOperator("imageStore", EOpImageStore);
9858
symbolTable.relateToOperator("imageAtomicAdd", EOpImageAtomicAdd);
9859
symbolTable.relateToOperator("imageAtomicMin", EOpImageAtomicMin);
9860
symbolTable.relateToOperator("imageAtomicMax", EOpImageAtomicMax);
9861
symbolTable.relateToOperator("imageAtomicAnd", EOpImageAtomicAnd);
9862
symbolTable.relateToOperator("imageAtomicOr", EOpImageAtomicOr);
9863
symbolTable.relateToOperator("imageAtomicXor", EOpImageAtomicXor);
9864
symbolTable.relateToOperator("imageAtomicExchange", EOpImageAtomicExchange);
9865
symbolTable.relateToOperator("imageAtomicCompSwap", EOpImageAtomicCompSwap);
9866
symbolTable.relateToOperator("imageAtomicLoad", EOpImageAtomicLoad);
9867
symbolTable.relateToOperator("imageAtomicStore", EOpImageAtomicStore);
9868
9869
symbolTable.relateToOperator("subpassLoad", EOpSubpassLoad);
9870
symbolTable.relateToOperator("subpassLoadMS", EOpSubpassLoadMS);
9871
9872
symbolTable.relateToOperator("textureGather", EOpTextureGather);
9873
symbolTable.relateToOperator("textureGatherOffset", EOpTextureGatherOffset);
9874
symbolTable.relateToOperator("textureGatherOffsets", EOpTextureGatherOffsets);
9875
9876
symbolTable.relateToOperator("noise1", EOpNoise);
9877
symbolTable.relateToOperator("noise2", EOpNoise);
9878
symbolTable.relateToOperator("noise3", EOpNoise);
9879
symbolTable.relateToOperator("noise4", EOpNoise);
9880
9881
symbolTable.relateToOperator("textureFootprintNV", EOpImageSampleFootprintNV);
9882
symbolTable.relateToOperator("textureFootprintClampNV", EOpImageSampleFootprintClampNV);
9883
symbolTable.relateToOperator("textureFootprintLodNV", EOpImageSampleFootprintLodNV);
9884
symbolTable.relateToOperator("textureFootprintGradNV", EOpImageSampleFootprintGradNV);
9885
symbolTable.relateToOperator("textureFootprintGradClampNV", EOpImageSampleFootprintGradClampNV);
9886
9887
if (spvVersion.spv == 0 && IncludeLegacy(version, profile, spvVersion))
9888
symbolTable.relateToOperator("ftransform", EOpFtransform);
9889
9890
if (spvVersion.spv == 0 && (IncludeLegacy(version, profile, spvVersion) ||
9891
(profile == EEsProfile && version == 100))) {
9892
9893
symbolTable.relateToOperator("texture1D", EOpTexture);
9894
symbolTable.relateToOperator("texture1DGradARB", EOpTextureGrad);
9895
symbolTable.relateToOperator("texture1DProj", EOpTextureProj);
9896
symbolTable.relateToOperator("texture1DProjGradARB", EOpTextureProjGrad);
9897
symbolTable.relateToOperator("texture1DLod", EOpTextureLod);
9898
symbolTable.relateToOperator("texture1DProjLod", EOpTextureProjLod);
9899
9900
symbolTable.relateToOperator("texture2DRect", EOpTexture);
9901
symbolTable.relateToOperator("texture2DRectProj", EOpTextureProj);
9902
symbolTable.relateToOperator("texture2DRectGradARB", EOpTextureGrad);
9903
symbolTable.relateToOperator("texture2DRectProjGradARB", EOpTextureProjGrad);
9904
symbolTable.relateToOperator("shadow2DRect", EOpTexture);
9905
symbolTable.relateToOperator("shadow2DRectProj", EOpTextureProj);
9906
symbolTable.relateToOperator("shadow2DRectGradARB", EOpTextureGrad);
9907
symbolTable.relateToOperator("shadow2DRectProjGradARB", EOpTextureProjGrad);
9908
9909
symbolTable.relateToOperator("texture2D", EOpTexture);
9910
symbolTable.relateToOperator("texture2DProj", EOpTextureProj);
9911
symbolTable.relateToOperator("texture2DGradEXT", EOpTextureGrad);
9912
symbolTable.relateToOperator("texture2DGradARB", EOpTextureGrad);
9913
symbolTable.relateToOperator("texture2DProjGradEXT", EOpTextureProjGrad);
9914
symbolTable.relateToOperator("texture2DProjGradARB", EOpTextureProjGrad);
9915
symbolTable.relateToOperator("texture2DLod", EOpTextureLod);
9916
symbolTable.relateToOperator("texture2DLodEXT", EOpTextureLod);
9917
symbolTable.relateToOperator("texture2DProjLod", EOpTextureProjLod);
9918
symbolTable.relateToOperator("texture2DProjLodEXT", EOpTextureProjLod);
9919
9920
symbolTable.relateToOperator("texture3D", EOpTexture);
9921
symbolTable.relateToOperator("texture3DGradARB", EOpTextureGrad);
9922
symbolTable.relateToOperator("texture3DProj", EOpTextureProj);
9923
symbolTable.relateToOperator("texture3DProjGradARB", EOpTextureProjGrad);
9924
symbolTable.relateToOperator("texture3DLod", EOpTextureLod);
9925
symbolTable.relateToOperator("texture3DProjLod", EOpTextureProjLod);
9926
symbolTable.relateToOperator("textureCube", EOpTexture);
9927
symbolTable.relateToOperator("textureCubeGradEXT", EOpTextureGrad);
9928
symbolTable.relateToOperator("textureCubeGradARB", EOpTextureGrad);
9929
symbolTable.relateToOperator("textureCubeLod", EOpTextureLod);
9930
symbolTable.relateToOperator("textureCubeLodEXT", EOpTextureLod);
9931
symbolTable.relateToOperator("shadow1D", EOpTexture);
9932
symbolTable.relateToOperator("shadow1DGradARB", EOpTextureGrad);
9933
symbolTable.relateToOperator("shadow2D", EOpTexture);
9934
symbolTable.relateToOperator("shadow2DGradARB", EOpTextureGrad);
9935
symbolTable.relateToOperator("shadow1DProj", EOpTextureProj);
9936
symbolTable.relateToOperator("shadow2DProj", EOpTextureProj);
9937
symbolTable.relateToOperator("shadow1DProjGradARB", EOpTextureProjGrad);
9938
symbolTable.relateToOperator("shadow2DProjGradARB", EOpTextureProjGrad);
9939
symbolTable.relateToOperator("shadow1DLod", EOpTextureLod);
9940
symbolTable.relateToOperator("shadow2DLod", EOpTextureLod);
9941
symbolTable.relateToOperator("shadow1DProjLod", EOpTextureProjLod);
9942
symbolTable.relateToOperator("shadow2DProjLod", EOpTextureProjLod);
9943
}
9944
9945
if (profile != EEsProfile) {
9946
symbolTable.relateToOperator("sparseTextureARB", EOpSparseTexture);
9947
symbolTable.relateToOperator("sparseTextureLodARB", EOpSparseTextureLod);
9948
symbolTable.relateToOperator("sparseTextureOffsetARB", EOpSparseTextureOffset);
9949
symbolTable.relateToOperator("sparseTexelFetchARB", EOpSparseTextureFetch);
9950
symbolTable.relateToOperator("sparseTexelFetchOffsetARB", EOpSparseTextureFetchOffset);
9951
symbolTable.relateToOperator("sparseTextureLodOffsetARB", EOpSparseTextureLodOffset);
9952
symbolTable.relateToOperator("sparseTextureGradARB", EOpSparseTextureGrad);
9953
symbolTable.relateToOperator("sparseTextureGradOffsetARB", EOpSparseTextureGradOffset);
9954
symbolTable.relateToOperator("sparseTextureGatherARB", EOpSparseTextureGather);
9955
symbolTable.relateToOperator("sparseTextureGatherOffsetARB", EOpSparseTextureGatherOffset);
9956
symbolTable.relateToOperator("sparseTextureGatherOffsetsARB", EOpSparseTextureGatherOffsets);
9957
symbolTable.relateToOperator("sparseImageLoadARB", EOpSparseImageLoad);
9958
symbolTable.relateToOperator("sparseTexelsResidentARB", EOpSparseTexelsResident);
9959
9960
symbolTable.relateToOperator("sparseTextureClampARB", EOpSparseTextureClamp);
9961
symbolTable.relateToOperator("sparseTextureOffsetClampARB", EOpSparseTextureOffsetClamp);
9962
symbolTable.relateToOperator("sparseTextureGradClampARB", EOpSparseTextureGradClamp);
9963
symbolTable.relateToOperator("sparseTextureGradOffsetClampARB", EOpSparseTextureGradOffsetClamp);
9964
symbolTable.relateToOperator("textureClampARB", EOpTextureClamp);
9965
symbolTable.relateToOperator("textureOffsetClampARB", EOpTextureOffsetClamp);
9966
symbolTable.relateToOperator("textureGradClampARB", EOpTextureGradClamp);
9967
symbolTable.relateToOperator("textureGradOffsetClampARB", EOpTextureGradOffsetClamp);
9968
9969
symbolTable.relateToOperator("ballotARB", EOpBallot);
9970
symbolTable.relateToOperator("readInvocationARB", EOpReadInvocation);
9971
symbolTable.relateToOperator("readFirstInvocationARB", EOpReadFirstInvocation);
9972
9973
if (version >= 430) {
9974
symbolTable.relateToOperator("anyInvocationARB", EOpAnyInvocation);
9975
symbolTable.relateToOperator("allInvocationsARB", EOpAllInvocations);
9976
symbolTable.relateToOperator("allInvocationsEqualARB", EOpAllInvocationsEqual);
9977
}
9978
if (version >= 460) {
9979
symbolTable.relateToOperator("anyInvocation", EOpAnyInvocation);
9980
symbolTable.relateToOperator("allInvocations", EOpAllInvocations);
9981
symbolTable.relateToOperator("allInvocationsEqual", EOpAllInvocationsEqual);
9982
}
9983
symbolTable.relateToOperator("minInvocationsAMD", EOpMinInvocations);
9984
symbolTable.relateToOperator("maxInvocationsAMD", EOpMaxInvocations);
9985
symbolTable.relateToOperator("addInvocationsAMD", EOpAddInvocations);
9986
symbolTable.relateToOperator("minInvocationsNonUniformAMD", EOpMinInvocationsNonUniform);
9987
symbolTable.relateToOperator("maxInvocationsNonUniformAMD", EOpMaxInvocationsNonUniform);
9988
symbolTable.relateToOperator("addInvocationsNonUniformAMD", EOpAddInvocationsNonUniform);
9989
symbolTable.relateToOperator("minInvocationsInclusiveScanAMD", EOpMinInvocationsInclusiveScan);
9990
symbolTable.relateToOperator("maxInvocationsInclusiveScanAMD", EOpMaxInvocationsInclusiveScan);
9991
symbolTable.relateToOperator("addInvocationsInclusiveScanAMD", EOpAddInvocationsInclusiveScan);
9992
symbolTable.relateToOperator("minInvocationsInclusiveScanNonUniformAMD", EOpMinInvocationsInclusiveScanNonUniform);
9993
symbolTable.relateToOperator("maxInvocationsInclusiveScanNonUniformAMD", EOpMaxInvocationsInclusiveScanNonUniform);
9994
symbolTable.relateToOperator("addInvocationsInclusiveScanNonUniformAMD", EOpAddInvocationsInclusiveScanNonUniform);
9995
symbolTable.relateToOperator("minInvocationsExclusiveScanAMD", EOpMinInvocationsExclusiveScan);
9996
symbolTable.relateToOperator("maxInvocationsExclusiveScanAMD", EOpMaxInvocationsExclusiveScan);
9997
symbolTable.relateToOperator("addInvocationsExclusiveScanAMD", EOpAddInvocationsExclusiveScan);
9998
symbolTable.relateToOperator("minInvocationsExclusiveScanNonUniformAMD", EOpMinInvocationsExclusiveScanNonUniform);
9999
symbolTable.relateToOperator("maxInvocationsExclusiveScanNonUniformAMD", EOpMaxInvocationsExclusiveScanNonUniform);
10000
symbolTable.relateToOperator("addInvocationsExclusiveScanNonUniformAMD", EOpAddInvocationsExclusiveScanNonUniform);
10001
symbolTable.relateToOperator("swizzleInvocationsAMD", EOpSwizzleInvocations);
10002
symbolTable.relateToOperator("swizzleInvocationsMaskedAMD", EOpSwizzleInvocationsMasked);
10003
symbolTable.relateToOperator("writeInvocationAMD", EOpWriteInvocation);
10004
symbolTable.relateToOperator("mbcntAMD", EOpMbcnt);
10005
10006
symbolTable.relateToOperator("min3", EOpMin3);
10007
symbolTable.relateToOperator("max3", EOpMax3);
10008
symbolTable.relateToOperator("mid3", EOpMid3);
10009
10010
symbolTable.relateToOperator("cubeFaceIndexAMD", EOpCubeFaceIndex);
10011
symbolTable.relateToOperator("cubeFaceCoordAMD", EOpCubeFaceCoord);
10012
symbolTable.relateToOperator("timeAMD", EOpTime);
10013
10014
symbolTable.relateToOperator("textureGatherLodAMD", EOpTextureGatherLod);
10015
symbolTable.relateToOperator("textureGatherLodOffsetAMD", EOpTextureGatherLodOffset);
10016
symbolTable.relateToOperator("textureGatherLodOffsetsAMD", EOpTextureGatherLodOffsets);
10017
symbolTable.relateToOperator("sparseTextureGatherLodAMD", EOpSparseTextureGatherLod);
10018
symbolTable.relateToOperator("sparseTextureGatherLodOffsetAMD", EOpSparseTextureGatherLodOffset);
10019
symbolTable.relateToOperator("sparseTextureGatherLodOffsetsAMD", EOpSparseTextureGatherLodOffsets);
10020
10021
symbolTable.relateToOperator("imageLoadLodAMD", EOpImageLoadLod);
10022
symbolTable.relateToOperator("imageStoreLodAMD", EOpImageStoreLod);
10023
symbolTable.relateToOperator("sparseImageLoadLodAMD", EOpSparseImageLoadLod);
10024
10025
symbolTable.relateToOperator("fragmentMaskFetchAMD", EOpFragmentMaskFetch);
10026
symbolTable.relateToOperator("fragmentFetchAMD", EOpFragmentFetch);
10027
}
10028
10029
// GL_KHR_shader_subgroup
10030
if ((profile == EEsProfile && version >= 310) ||
10031
(profile != EEsProfile && version >= 140)) {
10032
symbolTable.relateToOperator("subgroupBarrier", EOpSubgroupBarrier);
10033
symbolTable.relateToOperator("subgroupMemoryBarrier", EOpSubgroupMemoryBarrier);
10034
symbolTable.relateToOperator("subgroupMemoryBarrierBuffer", EOpSubgroupMemoryBarrierBuffer);
10035
symbolTable.relateToOperator("subgroupMemoryBarrierImage", EOpSubgroupMemoryBarrierImage);
10036
symbolTable.relateToOperator("subgroupElect", EOpSubgroupElect);
10037
symbolTable.relateToOperator("subgroupAll", EOpSubgroupAll);
10038
symbolTable.relateToOperator("subgroupAny", EOpSubgroupAny);
10039
symbolTable.relateToOperator("subgroupAllEqual", EOpSubgroupAllEqual);
10040
symbolTable.relateToOperator("subgroupBroadcast", EOpSubgroupBroadcast);
10041
symbolTable.relateToOperator("subgroupBroadcastFirst", EOpSubgroupBroadcastFirst);
10042
symbolTable.relateToOperator("subgroupBallot", EOpSubgroupBallot);
10043
symbolTable.relateToOperator("subgroupInverseBallot", EOpSubgroupInverseBallot);
10044
symbolTable.relateToOperator("subgroupBallotBitExtract", EOpSubgroupBallotBitExtract);
10045
symbolTable.relateToOperator("subgroupBallotBitCount", EOpSubgroupBallotBitCount);
10046
symbolTable.relateToOperator("subgroupBallotInclusiveBitCount", EOpSubgroupBallotInclusiveBitCount);
10047
symbolTable.relateToOperator("subgroupBallotExclusiveBitCount", EOpSubgroupBallotExclusiveBitCount);
10048
symbolTable.relateToOperator("subgroupBallotFindLSB", EOpSubgroupBallotFindLSB);
10049
symbolTable.relateToOperator("subgroupBallotFindMSB", EOpSubgroupBallotFindMSB);
10050
symbolTable.relateToOperator("subgroupShuffle", EOpSubgroupShuffle);
10051
symbolTable.relateToOperator("subgroupShuffleXor", EOpSubgroupShuffleXor);
10052
symbolTable.relateToOperator("subgroupShuffleUp", EOpSubgroupShuffleUp);
10053
symbolTable.relateToOperator("subgroupShuffleDown", EOpSubgroupShuffleDown);
10054
symbolTable.relateToOperator("subgroupRotate", EOpSubgroupRotate);
10055
symbolTable.relateToOperator("subgroupClusteredRotate", EOpSubgroupClusteredRotate);
10056
symbolTable.relateToOperator("subgroupAdd", EOpSubgroupAdd);
10057
symbolTable.relateToOperator("subgroupMul", EOpSubgroupMul);
10058
symbolTable.relateToOperator("subgroupMin", EOpSubgroupMin);
10059
symbolTable.relateToOperator("subgroupMax", EOpSubgroupMax);
10060
symbolTable.relateToOperator("subgroupAnd", EOpSubgroupAnd);
10061
symbolTable.relateToOperator("subgroupOr", EOpSubgroupOr);
10062
symbolTable.relateToOperator("subgroupXor", EOpSubgroupXor);
10063
symbolTable.relateToOperator("subgroupInclusiveAdd", EOpSubgroupInclusiveAdd);
10064
symbolTable.relateToOperator("subgroupInclusiveMul", EOpSubgroupInclusiveMul);
10065
symbolTable.relateToOperator("subgroupInclusiveMin", EOpSubgroupInclusiveMin);
10066
symbolTable.relateToOperator("subgroupInclusiveMax", EOpSubgroupInclusiveMax);
10067
symbolTable.relateToOperator("subgroupInclusiveAnd", EOpSubgroupInclusiveAnd);
10068
symbolTable.relateToOperator("subgroupInclusiveOr", EOpSubgroupInclusiveOr);
10069
symbolTable.relateToOperator("subgroupInclusiveXor", EOpSubgroupInclusiveXor);
10070
symbolTable.relateToOperator("subgroupExclusiveAdd", EOpSubgroupExclusiveAdd);
10071
symbolTable.relateToOperator("subgroupExclusiveMul", EOpSubgroupExclusiveMul);
10072
symbolTable.relateToOperator("subgroupExclusiveMin", EOpSubgroupExclusiveMin);
10073
symbolTable.relateToOperator("subgroupExclusiveMax", EOpSubgroupExclusiveMax);
10074
symbolTable.relateToOperator("subgroupExclusiveAnd", EOpSubgroupExclusiveAnd);
10075
symbolTable.relateToOperator("subgroupExclusiveOr", EOpSubgroupExclusiveOr);
10076
symbolTable.relateToOperator("subgroupExclusiveXor", EOpSubgroupExclusiveXor);
10077
symbolTable.relateToOperator("subgroupClusteredAdd", EOpSubgroupClusteredAdd);
10078
symbolTable.relateToOperator("subgroupClusteredMul", EOpSubgroupClusteredMul);
10079
symbolTable.relateToOperator("subgroupClusteredMin", EOpSubgroupClusteredMin);
10080
symbolTable.relateToOperator("subgroupClusteredMax", EOpSubgroupClusteredMax);
10081
symbolTable.relateToOperator("subgroupClusteredAnd", EOpSubgroupClusteredAnd);
10082
symbolTable.relateToOperator("subgroupClusteredOr", EOpSubgroupClusteredOr);
10083
symbolTable.relateToOperator("subgroupClusteredXor", EOpSubgroupClusteredXor);
10084
symbolTable.relateToOperator("subgroupQuadBroadcast", EOpSubgroupQuadBroadcast);
10085
symbolTable.relateToOperator("subgroupQuadSwapHorizontal", EOpSubgroupQuadSwapHorizontal);
10086
symbolTable.relateToOperator("subgroupQuadSwapVertical", EOpSubgroupQuadSwapVertical);
10087
symbolTable.relateToOperator("subgroupQuadSwapDiagonal", EOpSubgroupQuadSwapDiagonal);
10088
10089
symbolTable.relateToOperator("subgroupPartitionNV", EOpSubgroupPartition);
10090
symbolTable.relateToOperator("subgroupPartitionedAddNV", EOpSubgroupPartitionedAdd);
10091
symbolTable.relateToOperator("subgroupPartitionedMulNV", EOpSubgroupPartitionedMul);
10092
symbolTable.relateToOperator("subgroupPartitionedMinNV", EOpSubgroupPartitionedMin);
10093
symbolTable.relateToOperator("subgroupPartitionedMaxNV", EOpSubgroupPartitionedMax);
10094
symbolTable.relateToOperator("subgroupPartitionedAndNV", EOpSubgroupPartitionedAnd);
10095
symbolTable.relateToOperator("subgroupPartitionedOrNV", EOpSubgroupPartitionedOr);
10096
symbolTable.relateToOperator("subgroupPartitionedXorNV", EOpSubgroupPartitionedXor);
10097
symbolTable.relateToOperator("subgroupPartitionedInclusiveAddNV", EOpSubgroupPartitionedInclusiveAdd);
10098
symbolTable.relateToOperator("subgroupPartitionedInclusiveMulNV", EOpSubgroupPartitionedInclusiveMul);
10099
symbolTable.relateToOperator("subgroupPartitionedInclusiveMinNV", EOpSubgroupPartitionedInclusiveMin);
10100
symbolTable.relateToOperator("subgroupPartitionedInclusiveMaxNV", EOpSubgroupPartitionedInclusiveMax);
10101
symbolTable.relateToOperator("subgroupPartitionedInclusiveAndNV", EOpSubgroupPartitionedInclusiveAnd);
10102
symbolTable.relateToOperator("subgroupPartitionedInclusiveOrNV", EOpSubgroupPartitionedInclusiveOr);
10103
symbolTable.relateToOperator("subgroupPartitionedInclusiveXorNV", EOpSubgroupPartitionedInclusiveXor);
10104
symbolTable.relateToOperator("subgroupPartitionedExclusiveAddNV", EOpSubgroupPartitionedExclusiveAdd);
10105
symbolTable.relateToOperator("subgroupPartitionedExclusiveMulNV", EOpSubgroupPartitionedExclusiveMul);
10106
symbolTable.relateToOperator("subgroupPartitionedExclusiveMinNV", EOpSubgroupPartitionedExclusiveMin);
10107
symbolTable.relateToOperator("subgroupPartitionedExclusiveMaxNV", EOpSubgroupPartitionedExclusiveMax);
10108
symbolTable.relateToOperator("subgroupPartitionedExclusiveAndNV", EOpSubgroupPartitionedExclusiveAnd);
10109
symbolTable.relateToOperator("subgroupPartitionedExclusiveOrNV", EOpSubgroupPartitionedExclusiveOr);
10110
symbolTable.relateToOperator("subgroupPartitionedExclusiveXorNV", EOpSubgroupPartitionedExclusiveXor);
10111
}
10112
10113
if (profile == EEsProfile) {
10114
symbolTable.relateToOperator("shadow2DEXT", EOpTexture);
10115
symbolTable.relateToOperator("shadow2DProjEXT", EOpTextureProj);
10116
}
10117
10118
// GL_EXT_shader_quad_control
10119
if ((profile == EEsProfile && version >= 310) ||
10120
(profile != EEsProfile && version >= 140)) {
10121
symbolTable.relateToOperator("subgroupQuadAll", EOpSubgroupQuadAll);
10122
symbolTable.relateToOperator("subgroupQuadAny", EOpSubgroupQuadAny);
10123
}
10124
10125
if ((profile == EEsProfile && version >= 310) ||
10126
(profile != EEsProfile && version >= 140)) {
10127
symbolTable.relateToOperator("textureWeightedQCOM", EOpImageSampleWeightedQCOM);
10128
symbolTable.relateToOperator("textureBoxFilterQCOM", EOpImageBoxFilterQCOM);
10129
symbolTable.relateToOperator("textureBlockMatchSADQCOM", EOpImageBlockMatchSADQCOM);
10130
symbolTable.relateToOperator("textureBlockMatchSSDQCOM", EOpImageBlockMatchSSDQCOM);
10131
10132
symbolTable.relateToOperator("textureBlockMatchWindowSSDQCOM", EOpImageBlockMatchWindowSSDQCOM);
10133
symbolTable.relateToOperator("textureBlockMatchWindowSADQCOM", EOpImageBlockMatchWindowSADQCOM);
10134
symbolTable.relateToOperator("textureBlockMatchGatherSSDQCOM", EOpImageBlockMatchGatherSSDQCOM);
10135
symbolTable.relateToOperator("textureBlockMatchGatherSADQCOM", EOpImageBlockMatchGatherSADQCOM);
10136
}
10137
10138
if (profile != EEsProfile && spvVersion.spv == 0) {
10139
symbolTable.relateToOperator("texture1DArray", EOpTexture);
10140
symbolTable.relateToOperator("texture2DArray", EOpTexture);
10141
symbolTable.relateToOperator("shadow1DArray", EOpTexture);
10142
symbolTable.relateToOperator("shadow2DArray", EOpTexture);
10143
10144
symbolTable.relateToOperator("texture1DArrayLod", EOpTextureLod);
10145
symbolTable.relateToOperator("texture2DArrayLod", EOpTextureLod);
10146
symbolTable.relateToOperator("shadow1DArrayLod", EOpTextureLod);
10147
}
10148
}
10149
10150
switch(language) {
10151
case EShLangVertex:
10152
break;
10153
10154
case EShLangTessControl:
10155
case EShLangTessEvaluation:
10156
break;
10157
10158
case EShLangGeometry:
10159
symbolTable.relateToOperator("EmitStreamVertex", EOpEmitStreamVertex);
10160
symbolTable.relateToOperator("EndStreamPrimitive", EOpEndStreamPrimitive);
10161
symbolTable.relateToOperator("EmitVertex", EOpEmitVertex);
10162
symbolTable.relateToOperator("EndPrimitive", EOpEndPrimitive);
10163
break;
10164
10165
case EShLangFragment:
10166
if (profile != EEsProfile && version >= 400) {
10167
symbolTable.relateToOperator("dFdxFine", EOpDPdxFine);
10168
symbolTable.relateToOperator("dFdyFine", EOpDPdyFine);
10169
symbolTable.relateToOperator("fwidthFine", EOpFwidthFine);
10170
symbolTable.relateToOperator("dFdxCoarse", EOpDPdxCoarse);
10171
symbolTable.relateToOperator("dFdyCoarse", EOpDPdyCoarse);
10172
symbolTable.relateToOperator("fwidthCoarse", EOpFwidthCoarse);
10173
}
10174
10175
if (profile != EEsProfile && version >= 460) {
10176
symbolTable.relateToOperator("rayQueryInitializeEXT", EOpRayQueryInitialize);
10177
symbolTable.relateToOperator("rayQueryTerminateEXT", EOpRayQueryTerminate);
10178
symbolTable.relateToOperator("rayQueryGenerateIntersectionEXT", EOpRayQueryGenerateIntersection);
10179
symbolTable.relateToOperator("rayQueryConfirmIntersectionEXT", EOpRayQueryConfirmIntersection);
10180
symbolTable.relateToOperator("rayQueryProceedEXT", EOpRayQueryProceed);
10181
symbolTable.relateToOperator("rayQueryGetIntersectionTypeEXT", EOpRayQueryGetIntersectionType);
10182
symbolTable.relateToOperator("rayQueryGetRayTMinEXT", EOpRayQueryGetRayTMin);
10183
symbolTable.relateToOperator("rayQueryGetRayFlagsEXT", EOpRayQueryGetRayFlags);
10184
symbolTable.relateToOperator("rayQueryGetIntersectionTEXT", EOpRayQueryGetIntersectionT);
10185
symbolTable.relateToOperator("rayQueryGetIntersectionInstanceCustomIndexEXT", EOpRayQueryGetIntersectionInstanceCustomIndex);
10186
symbolTable.relateToOperator("rayQueryGetIntersectionInstanceIdEXT", EOpRayQueryGetIntersectionInstanceId);
10187
symbolTable.relateToOperator("rayQueryGetIntersectionInstanceShaderBindingTableRecordOffsetEXT", EOpRayQueryGetIntersectionInstanceShaderBindingTableRecordOffset);
10188
symbolTable.relateToOperator("rayQueryGetIntersectionGeometryIndexEXT", EOpRayQueryGetIntersectionGeometryIndex);
10189
symbolTable.relateToOperator("rayQueryGetIntersectionPrimitiveIndexEXT", EOpRayQueryGetIntersectionPrimitiveIndex);
10190
symbolTable.relateToOperator("rayQueryGetIntersectionBarycentricsEXT", EOpRayQueryGetIntersectionBarycentrics);
10191
symbolTable.relateToOperator("rayQueryGetIntersectionFrontFaceEXT", EOpRayQueryGetIntersectionFrontFace);
10192
symbolTable.relateToOperator("rayQueryGetIntersectionCandidateAABBOpaqueEXT", EOpRayQueryGetIntersectionCandidateAABBOpaque);
10193
symbolTable.relateToOperator("rayQueryGetIntersectionObjectRayDirectionEXT", EOpRayQueryGetIntersectionObjectRayDirection);
10194
symbolTable.relateToOperator("rayQueryGetIntersectionObjectRayOriginEXT", EOpRayQueryGetIntersectionObjectRayOrigin);
10195
symbolTable.relateToOperator("rayQueryGetWorldRayDirectionEXT", EOpRayQueryGetWorldRayDirection);
10196
symbolTable.relateToOperator("rayQueryGetWorldRayOriginEXT", EOpRayQueryGetWorldRayOrigin);
10197
symbolTable.relateToOperator("rayQueryGetIntersectionObjectToWorldEXT", EOpRayQueryGetIntersectionObjectToWorld);
10198
symbolTable.relateToOperator("rayQueryGetIntersectionWorldToObjectEXT", EOpRayQueryGetIntersectionWorldToObject);
10199
symbolTable.relateToOperator("rayQueryGetIntersectionTriangleVertexPositionsEXT", EOpRayQueryGetIntersectionTriangleVertexPositionsEXT);
10200
}
10201
10202
symbolTable.relateToOperator("interpolateAtCentroid", EOpInterpolateAtCentroid);
10203
symbolTable.relateToOperator("interpolateAtSample", EOpInterpolateAtSample);
10204
symbolTable.relateToOperator("interpolateAtOffset", EOpInterpolateAtOffset);
10205
10206
if (profile != EEsProfile)
10207
symbolTable.relateToOperator("interpolateAtVertexAMD", EOpInterpolateAtVertex);
10208
10209
symbolTable.relateToOperator("beginInvocationInterlockARB", EOpBeginInvocationInterlock);
10210
symbolTable.relateToOperator("endInvocationInterlockARB", EOpEndInvocationInterlock);
10211
10212
symbolTable.relateToOperator("stencilAttachmentReadEXT", EOpStencilAttachmentReadEXT);
10213
symbolTable.relateToOperator("depthAttachmentReadEXT", EOpDepthAttachmentReadEXT);
10214
symbolTable.relateToOperator("colorAttachmentReadEXT", EOpColorAttachmentReadEXT);
10215
10216
break;
10217
10218
case EShLangCompute:
10219
symbolTable.relateToOperator("subgroupMemoryBarrierShared", EOpSubgroupMemoryBarrierShared);
10220
if ((profile != EEsProfile && version >= 450) ||
10221
(profile == EEsProfile && version >= 320)) {
10222
symbolTable.relateToOperator("dFdx", EOpDPdx);
10223
symbolTable.relateToOperator("dFdy", EOpDPdy);
10224
symbolTable.relateToOperator("fwidth", EOpFwidth);
10225
symbolTable.relateToOperator("dFdxFine", EOpDPdxFine);
10226
symbolTable.relateToOperator("dFdyFine", EOpDPdyFine);
10227
symbolTable.relateToOperator("fwidthFine", EOpFwidthFine);
10228
symbolTable.relateToOperator("dFdxCoarse", EOpDPdxCoarse);
10229
symbolTable.relateToOperator("dFdyCoarse", EOpDPdyCoarse);
10230
symbolTable.relateToOperator("fwidthCoarse",EOpFwidthCoarse);
10231
}
10232
symbolTable.relateToOperator("coopMatLoadNV", EOpCooperativeMatrixLoadNV);
10233
symbolTable.relateToOperator("coopMatStoreNV", EOpCooperativeMatrixStoreNV);
10234
symbolTable.relateToOperator("coopMatMulAddNV", EOpCooperativeMatrixMulAddNV);
10235
10236
symbolTable.relateToOperator("coopMatLoad", EOpCooperativeMatrixLoad);
10237
symbolTable.relateToOperator("coopMatStore", EOpCooperativeMatrixStore);
10238
symbolTable.relateToOperator("coopMatMulAdd", EOpCooperativeMatrixMulAdd);
10239
10240
if (profile != EEsProfile && version >= 460) {
10241
symbolTable.relateToOperator("fetchMicroTriangleVertexPositionNV", EOpFetchMicroTriangleVertexPositionNV);
10242
symbolTable.relateToOperator("fetchMicroTriangleVertexBarycentricNV", EOpFetchMicroTriangleVertexBarycentricNV);
10243
}
10244
break;
10245
10246
case EShLangRayGen:
10247
if (profile != EEsProfile && version >= 460) {
10248
symbolTable.relateToOperator("fetchMicroTriangleVertexPositionNV", EOpFetchMicroTriangleVertexPositionNV);
10249
symbolTable.relateToOperator("fetchMicroTriangleVertexBarycentricNV", EOpFetchMicroTriangleVertexBarycentricNV);
10250
}
10251
[[fallthrough]];
10252
case EShLangClosestHit:
10253
case EShLangMiss:
10254
if (profile != EEsProfile && version >= 460) {
10255
symbolTable.relateToOperator("traceNV", EOpTraceNV);
10256
symbolTable.relateToOperator("traceRayMotionNV", EOpTraceRayMotionNV);
10257
symbolTable.relateToOperator("traceRayEXT", EOpTraceKHR);
10258
symbolTable.relateToOperator("executeCallableNV", EOpExecuteCallableNV);
10259
symbolTable.relateToOperator("executeCallableEXT", EOpExecuteCallableKHR);
10260
10261
symbolTable.relateToOperator("hitObjectTraceRayNV", EOpHitObjectTraceRayNV);
10262
symbolTable.relateToOperator("hitObjectTraceRayMotionNV", EOpHitObjectTraceRayMotionNV);
10263
symbolTable.relateToOperator("hitObjectRecordHitNV", EOpHitObjectRecordHitNV);
10264
symbolTable.relateToOperator("hitObjectRecordHitMotionNV", EOpHitObjectRecordHitMotionNV);
10265
symbolTable.relateToOperator("hitObjectRecordHitWithIndexNV", EOpHitObjectRecordHitWithIndexNV);
10266
symbolTable.relateToOperator("hitObjectRecordHitWithIndexMotionNV", EOpHitObjectRecordHitWithIndexMotionNV);
10267
symbolTable.relateToOperator("hitObjectRecordMissNV", EOpHitObjectRecordMissNV);
10268
symbolTable.relateToOperator("hitObjectRecordMissMotionNV", EOpHitObjectRecordMissMotionNV);
10269
symbolTable.relateToOperator("hitObjectRecordEmptyNV", EOpHitObjectRecordEmptyNV);
10270
symbolTable.relateToOperator("hitObjectExecuteShaderNV", EOpHitObjectExecuteShaderNV);
10271
symbolTable.relateToOperator("hitObjectIsEmptyNV", EOpHitObjectIsEmptyNV);
10272
symbolTable.relateToOperator("hitObjectIsMissNV", EOpHitObjectIsMissNV);
10273
symbolTable.relateToOperator("hitObjectIsHitNV", EOpHitObjectIsHitNV);
10274
symbolTable.relateToOperator("hitObjectGetRayTMinNV", EOpHitObjectGetRayTMinNV);
10275
symbolTable.relateToOperator("hitObjectGetRayTMaxNV", EOpHitObjectGetRayTMaxNV);
10276
symbolTable.relateToOperator("hitObjectGetObjectRayOriginNV", EOpHitObjectGetObjectRayOriginNV);
10277
symbolTable.relateToOperator("hitObjectGetObjectRayDirectionNV", EOpHitObjectGetObjectRayDirectionNV);
10278
symbolTable.relateToOperator("hitObjectGetWorldRayOriginNV", EOpHitObjectGetWorldRayOriginNV);
10279
symbolTable.relateToOperator("hitObjectGetWorldRayDirectionNV", EOpHitObjectGetWorldRayDirectionNV);
10280
symbolTable.relateToOperator("hitObjectGetWorldToObjectNV", EOpHitObjectGetWorldToObjectNV);
10281
symbolTable.relateToOperator("hitObjectGetObjectToWorldNV", EOpHitObjectGetObjectToWorldNV);
10282
symbolTable.relateToOperator("hitObjectGetInstanceCustomIndexNV", EOpHitObjectGetInstanceCustomIndexNV);
10283
symbolTable.relateToOperator("hitObjectGetInstanceIdNV", EOpHitObjectGetInstanceIdNV);
10284
symbolTable.relateToOperator("hitObjectGetGeometryIndexNV", EOpHitObjectGetGeometryIndexNV);
10285
symbolTable.relateToOperator("hitObjectGetPrimitiveIndexNV", EOpHitObjectGetPrimitiveIndexNV);
10286
symbolTable.relateToOperator("hitObjectGetHitKindNV", EOpHitObjectGetHitKindNV);
10287
symbolTable.relateToOperator("hitObjectGetAttributesNV", EOpHitObjectGetAttributesNV);
10288
symbolTable.relateToOperator("hitObjectGetCurrentTimeNV", EOpHitObjectGetCurrentTimeNV);
10289
symbolTable.relateToOperator("hitObjectGetShaderBindingTableRecordIndexNV", EOpHitObjectGetShaderBindingTableRecordIndexNV);
10290
symbolTable.relateToOperator("hitObjectGetShaderRecordBufferHandleNV", EOpHitObjectGetShaderRecordBufferHandleNV);
10291
symbolTable.relateToOperator("reorderThreadNV", EOpReorderThreadNV);
10292
}
10293
break;
10294
case EShLangIntersect:
10295
if (profile != EEsProfile && version >= 460) {
10296
symbolTable.relateToOperator("reportIntersectionNV", EOpReportIntersection);
10297
symbolTable.relateToOperator("reportIntersectionEXT", EOpReportIntersection);
10298
}
10299
break;
10300
case EShLangAnyHit:
10301
if (profile != EEsProfile && version >= 460) {
10302
symbolTable.relateToOperator("ignoreIntersectionNV", EOpIgnoreIntersectionNV);
10303
symbolTable.relateToOperator("terminateRayNV", EOpTerminateRayNV);
10304
}
10305
break;
10306
case EShLangCallable:
10307
if (profile != EEsProfile && version >= 460) {
10308
symbolTable.relateToOperator("executeCallableNV", EOpExecuteCallableNV);
10309
symbolTable.relateToOperator("executeCallableEXT", EOpExecuteCallableKHR);
10310
}
10311
break;
10312
case EShLangMesh:
10313
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
10314
symbolTable.relateToOperator("writePackedPrimitiveIndices4x8NV", EOpWritePackedPrimitiveIndices4x8NV);
10315
symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared);
10316
symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier);
10317
symbolTable.relateToOperator("subgroupMemoryBarrierShared", EOpSubgroupMemoryBarrierShared);
10318
}
10319
10320
if (profile != EEsProfile && version >= 450) {
10321
symbolTable.relateToOperator("SetMeshOutputsEXT", EOpSetMeshOutputsEXT);
10322
}
10323
10324
if (profile != EEsProfile && version >= 460) {
10325
// Builtins for GL_NV_displacement_micromap.
10326
symbolTable.relateToOperator("fetchMicroTriangleVertexPositionNV", EOpFetchMicroTriangleVertexPositionNV);
10327
symbolTable.relateToOperator("fetchMicroTriangleVertexBarycentricNV", EOpFetchMicroTriangleVertexBarycentricNV);
10328
}
10329
break;
10330
case EShLangTask:
10331
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
10332
symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared);
10333
symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier);
10334
symbolTable.relateToOperator("subgroupMemoryBarrierShared", EOpSubgroupMemoryBarrierShared);
10335
}
10336
if (profile != EEsProfile && version >= 450) {
10337
symbolTable.relateToOperator("EmitMeshTasksEXT", EOpEmitMeshTasksEXT);
10338
}
10339
break;
10340
10341
default:
10342
assert(false && "Language not supported");
10343
}
10344
}
10345
10346
//
10347
// Add context-dependent (resource-specific) built-ins not handled by the above. These
10348
// would be ones that need to be programmatically added because they cannot
10349
// be added by simple text strings. For these, also
10350
// 1) Map built-in functions to operators, for those that will turn into an operation node
10351
// instead of remaining a function call.
10352
// 2) Tag extension-related symbols added to their base version with their extensions, so
10353
// that if an early version has the extension turned off, there is an error reported on use.
10354
//
10355
void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources)
10356
{
10357
if (profile != EEsProfile && version >= 430 && version < 440) {
10358
symbolTable.setVariableExtensions("gl_MaxTransformFeedbackBuffers", 1, &E_GL_ARB_enhanced_layouts);
10359
symbolTable.setVariableExtensions("gl_MaxTransformFeedbackInterleavedComponents", 1, &E_GL_ARB_enhanced_layouts);
10360
}
10361
if (profile != EEsProfile && version >= 130 && version < 420) {
10362
symbolTable.setVariableExtensions("gl_MinProgramTexelOffset", 1, &E_GL_ARB_shading_language_420pack);
10363
symbolTable.setVariableExtensions("gl_MaxProgramTexelOffset", 1, &E_GL_ARB_shading_language_420pack);
10364
}
10365
if (profile != EEsProfile && version >= 150 && version < 410)
10366
symbolTable.setVariableExtensions("gl_MaxViewports", 1, &E_GL_ARB_viewport_array);
10367
10368
switch(language) {
10369
case EShLangFragment:
10370
// Set up gl_FragData based on current array size.
10371
if (version == 100 || IncludeLegacy(version, profile, spvVersion) || (! ForwardCompatibility && profile != EEsProfile && version < 420)) {
10372
TPrecisionQualifier pq = profile == EEsProfile ? EpqMedium : EpqNone;
10373
TType fragData(EbtFloat, EvqFragColor, pq, 4);
10374
TArraySizes* arraySizes = new TArraySizes;
10375
arraySizes->addInnerSize(resources.maxDrawBuffers);
10376
fragData.transferArraySizes(arraySizes);
10377
symbolTable.insert(*new TVariable(NewPoolTString("gl_FragData"), fragData));
10378
SpecialQualifier("gl_FragData", EvqFragColor, EbvFragData, symbolTable);
10379
}
10380
10381
// GL_EXT_blend_func_extended
10382
if (profile == EEsProfile && version >= 100) {
10383
symbolTable.setVariableExtensions("gl_MaxDualSourceDrawBuffersEXT", 1, &E_GL_EXT_blend_func_extended);
10384
symbolTable.setVariableExtensions("gl_SecondaryFragColorEXT", 1, &E_GL_EXT_blend_func_extended);
10385
symbolTable.setVariableExtensions("gl_SecondaryFragDataEXT", 1, &E_GL_EXT_blend_func_extended);
10386
SpecialQualifier("gl_SecondaryFragColorEXT", EvqVaryingOut, EbvSecondaryFragColorEXT, symbolTable);
10387
SpecialQualifier("gl_SecondaryFragDataEXT", EvqVaryingOut, EbvSecondaryFragDataEXT, symbolTable);
10388
}
10389
10390
break;
10391
10392
case EShLangTessControl:
10393
case EShLangTessEvaluation:
10394
// Because of the context-dependent array size (gl_MaxPatchVertices),
10395
// these variables were added later than the others and need to be mapped now.
10396
10397
// standard members
10398
BuiltInVariable("gl_in", "gl_Position", EbvPosition, symbolTable);
10399
BuiltInVariable("gl_in", "gl_PointSize", EbvPointSize, symbolTable);
10400
BuiltInVariable("gl_in", "gl_ClipDistance", EbvClipDistance, symbolTable);
10401
BuiltInVariable("gl_in", "gl_CullDistance", EbvCullDistance, symbolTable);
10402
10403
// compatibility members
10404
BuiltInVariable("gl_in", "gl_ClipVertex", EbvClipVertex, symbolTable);
10405
BuiltInVariable("gl_in", "gl_FrontColor", EbvFrontColor, symbolTable);
10406
BuiltInVariable("gl_in", "gl_BackColor", EbvBackColor, symbolTable);
10407
BuiltInVariable("gl_in", "gl_FrontSecondaryColor", EbvFrontSecondaryColor, symbolTable);
10408
BuiltInVariable("gl_in", "gl_BackSecondaryColor", EbvBackSecondaryColor, symbolTable);
10409
BuiltInVariable("gl_in", "gl_TexCoord", EbvTexCoord, symbolTable);
10410
BuiltInVariable("gl_in", "gl_FogFragCoord", EbvFogFragCoord, symbolTable);
10411
10412
symbolTable.setVariableExtensions("gl_in", "gl_SecondaryPositionNV", 1, &E_GL_NV_stereo_view_rendering);
10413
symbolTable.setVariableExtensions("gl_in", "gl_PositionPerViewNV", 1, &E_GL_NVX_multiview_per_view_attributes);
10414
10415
BuiltInVariable("gl_in", "gl_SecondaryPositionNV", EbvSecondaryPositionNV, symbolTable);
10416
BuiltInVariable("gl_in", "gl_PositionPerViewNV", EbvPositionPerViewNV, symbolTable);
10417
10418
// extension requirements
10419
if (profile == EEsProfile) {
10420
symbolTable.setVariableExtensions("gl_in", "gl_PointSize", Num_AEP_tessellation_point_size, AEP_tessellation_point_size);
10421
}
10422
10423
break;
10424
10425
default:
10426
break;
10427
}
10428
}
10429
10430
} // end namespace glslang
10431
10432