summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp')
-rw-r--r--3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp315
1 files changed, 174 insertions, 141 deletions
diff --git a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp
index 2344d36cee3..6bf847bab35 100644
--- a/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp
+++ b/3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/Initialize.cpp
@@ -85,18 +85,18 @@ const int TypeStringScalarMask = ~TypeStringColumnMask; // take type to
enum ArgType {
// numbers hardcoded to correspond to 'TypeString'; order and value matter
- TypeB = 1 << 0, // Boolean
- TypeF = 1 << 1, // float 32
- TypeI = 1 << 2, // int 32
- TypeU = 1 << 3, // uint 32
- TypeF16 = 1 << 4, // float 16
- TypeF64 = 1 << 5, // float 64
- TypeI8 = 1 << 6, // int 8
- TypeI16 = 1 << 7, // int 16
- TypeI64 = 1 << 8, // int 64
- TypeU8 = 1 << 9, // uint 8
- TypeU16 = 1 << 10, // uint 16
- TypeU64 = 1 << 11, // uint 64
+ TypeB = 1 << 0, // Boolean
+ TypeF = 1 << 1, // float 32
+ TypeI = 1 << 2, // int 32
+ TypeU = 1 << 3, // uint 32
+ TypeF16 = 1 << 4, // float 16
+ TypeF64 = 1 << 5, // float 64
+ TypeI8 = 1 << 6, // int 8
+ TypeI16 = 1 << 7, // int 16
+ TypeI64 = 1 << 8, // int 64
+ TypeU8 = 1 << 9, // uint 8
+ TypeU16 = 1 << 10, // uint 16
+ TypeU64 = 1 << 11, // uint 64
};
// Mixtures of the above, to help the function tables
const ArgType TypeFI = static_cast<ArgType>(TypeF | TypeI);
@@ -106,22 +106,22 @@ const ArgType TypeIU = static_cast<ArgType>(TypeI | TypeU);
// The relationships between arguments and return type, whether anything is
// output, or other unusual situations.
enum ArgClass {
- ClassRegular = 0, // nothing special, just all vector widths with matching return type; traditional arithmetic
- ClassLS = 1 << 0, // the last argument is also held fixed as a (type-matched) scalar while the others cycle
- ClassXLS = 1 << 1, // the last argument is exclusively a (type-matched) scalar while the others cycle
- ClassLS2 = 1 << 2, // the last two arguments are held fixed as a (type-matched) scalar while the others cycle
- ClassFS = 1 << 3, // the first argument is held fixed as a (type-matched) scalar while the others cycle
- ClassFS2 = 1 << 4, // the first two arguments are held fixed as a (type-matched) scalar while the others cycle
- ClassLO = 1 << 5, // the last argument is an output
- ClassB = 1 << 6, // return type cycles through only bool/bvec, matching vector width of args
- ClassLB = 1 << 7, // last argument cycles through only bool/bvec, matching vector width of args
- ClassV1 = 1 << 8, // scalar only
- ClassFIO = 1 << 9, // first argument is inout
- ClassRS = 1 << 10, // the return is held scalar as the arguments cycle
- ClassNS = 1 << 11, // no scalar prototype
- ClassCV = 1 << 12, // first argument is 'coherent volatile'
- ClassFO = 1 << 13, // first argument is output
- ClassV3 = 1 << 14, // vec3 only
+ ClassRegular = 0, // nothing special, just all vector widths with matching return type; traditional arithmetic
+ ClassLS = 1 << 0, // the last argument is also held fixed as a (type-matched) scalar while the others cycle
+ ClassXLS = 1 << 1, // the last argument is exclusively a (type-matched) scalar while the others cycle
+ ClassLS2 = 1 << 2, // the last two arguments are held fixed as a (type-matched) scalar while the others cycle
+ ClassFS = 1 << 3, // the first argument is held fixed as a (type-matched) scalar while the others cycle
+ ClassFS2 = 1 << 4, // the first two arguments are held fixed as a (type-matched) scalar while the others cycle
+ ClassLO = 1 << 5, // the last argument is an output
+ ClassB = 1 << 6, // return type cycles through only bool/bvec, matching vector width of args
+ ClassLB = 1 << 7, // last argument cycles through only bool/bvec, matching vector width of args
+ ClassV1 = 1 << 8, // scalar only
+ ClassFIO = 1 << 9, // first argument is inout
+ ClassRS = 1 << 10, // the return is held scalar as the arguments cycle
+ ClassNS = 1 << 11, // no scalar prototype
+ ClassCV = 1 << 12, // first argument is 'coherent volatile'
+ ClassFO = 1 << 13, // first argument is output
+ ClassV3 = 1 << 14, // vec3 only
};
// Mixtures of the above, to help the function tables
const ArgClass ClassV1FIOCV = (ArgClass)(ClassV1 | ClassFIO | ClassCV);
@@ -147,6 +147,7 @@ EProfile EDesktopProfile = static_cast<EProfile>(ENoProfile | ECoreProfile | ECo
// Declare pointers to put into the table for versioning.
#ifdef GLSLANG_WEB
const Versioning* Es300Desktop130 = nullptr;
+ const Versioning* Es310Desktop430 = nullptr;
#else
const Versioning Es300Desktop130Version[] = { { EEsProfile, 0, 300, 0, nullptr },
{ EDesktopProfile, 0, 130, 0, nullptr },
@@ -256,7 +257,6 @@ const BuiltInFunction BaseFunctions[] = {
{ EOpGreaterThanEqual, "greaterThanEqual", 2, TypeU, ClassBNS, Es300Desktop130 },
{ EOpVectorEqual, "equal", 2, TypeU, ClassBNS, Es300Desktop130 },
{ EOpVectorNotEqual, "notEqual", 2, TypeU, ClassBNS, Es300Desktop130 },
-#ifndef GLSLANG_WEB
{ EOpAtomicAdd, "atomicAdd", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 },
{ EOpAtomicMin, "atomicMin", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 },
{ EOpAtomicMax, "atomicMax", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 },
@@ -265,9 +265,11 @@ const BuiltInFunction BaseFunctions[] = {
{ EOpAtomicXor, "atomicXor", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 },
{ EOpAtomicExchange, "atomicExchange", 2, TypeIU, ClassV1FIOCV, Es310Desktop430 },
{ EOpAtomicCompSwap, "atomicCompSwap", 3, TypeIU, ClassV1FIOCV, Es310Desktop430 },
+#ifndef GLSLANG_WEB
{ EOpMix, "mix", 3, TypeB, ClassRegular, Es310Desktop450 },
{ EOpMix, "mix", 3, TypeIU, ClassLB, Es310Desktop450 },
#endif
+
{ EOpNull }
};
@@ -278,6 +280,59 @@ const BuiltInFunction DerivativeFunctions[] = {
{ EOpNull }
};
+// For functions declared some other way, but still use the table to relate to operator.
+struct CustomFunction {
+ TOperator op; // operator to map the name to
+ const char* name; // function name
+ const Versioning* versioning; // nullptr means always a valid version
+};
+
+const CustomFunction CustomFunctions[] = {
+ { EOpBarrier, "barrier", nullptr },
+ { EOpMemoryBarrierShared, "memoryBarrierShared", nullptr },
+ { EOpGroupMemoryBarrier, "groupMemoryBarrier", nullptr },
+ { EOpMemoryBarrier, "memoryBarrier", nullptr },
+ { EOpMemoryBarrierBuffer, "memoryBarrierBuffer", nullptr },
+
+ { EOpPackSnorm2x16, "packSnorm2x16", nullptr },
+ { EOpUnpackSnorm2x16, "unpackSnorm2x16", nullptr },
+ { EOpPackUnorm2x16, "packUnorm2x16", nullptr },
+ { EOpUnpackUnorm2x16, "unpackUnorm2x16", nullptr },
+ { EOpPackHalf2x16, "packHalf2x16", nullptr },
+ { EOpUnpackHalf2x16, "unpackHalf2x16", nullptr },
+
+ { EOpMul, "matrixCompMult", nullptr },
+ { EOpOuterProduct, "outerProduct", nullptr },
+ { EOpTranspose, "transpose", nullptr },
+ { EOpDeterminant, "determinant", nullptr },
+ { EOpMatrixInverse, "inverse", nullptr },
+ { EOpFloatBitsToInt, "floatBitsToInt", nullptr },
+ { EOpFloatBitsToUint, "floatBitsToUint", nullptr },
+ { EOpIntBitsToFloat, "intBitsToFloat", nullptr },
+ { EOpUintBitsToFloat, "uintBitsToFloat", nullptr },
+
+ { EOpTextureQuerySize, "textureSize", nullptr },
+ { EOpTextureQueryLod, "textureQueryLod", nullptr },
+ { EOpTextureQueryLevels, "textureQueryLevels", nullptr },
+ { EOpTextureQuerySamples, "textureSamples", nullptr },
+ { EOpTexture, "texture", nullptr },
+ { EOpTextureProj, "textureProj", nullptr },
+ { EOpTextureLod, "textureLod", nullptr },
+ { EOpTextureOffset, "textureOffset", nullptr },
+ { EOpTextureFetch, "texelFetch", nullptr },
+ { EOpTextureFetchOffset, "texelFetchOffset", nullptr },
+ { EOpTextureProjOffset, "textureProjOffset", nullptr },
+ { EOpTextureLodOffset, "textureLodOffset", nullptr },
+ { EOpTextureProjLod, "textureProjLod", nullptr },
+ { EOpTextureProjLodOffset, "textureProjLodOffset", nullptr },
+ { EOpTextureGrad, "textureGrad", nullptr },
+ { EOpTextureGradOffset, "textureGradOffset", nullptr },
+ { EOpTextureProjGrad, "textureProjGrad", nullptr },
+ { EOpTextureProjGradOffset, "textureProjGradOffset", nullptr },
+
+ { EOpNull }
+};
+
// For the given table of functions, add all the indicated prototypes for each
// one, to be returned in the passed in decls.
void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)
@@ -331,8 +386,10 @@ void AddTabledBuiltin(TString& decls, const BuiltInFunction& function)
if (arg == function.numArguments - 1 && (function.classes & ClassLO))
decls.append("out ");
if (arg == 0) {
+#ifndef GLSLANG_WEB
if (function.classes & ClassCV)
decls.append("coherent volatile ");
+#endif
if (function.classes & ClassFIO)
decls.append("inout ");
if (function.classes & ClassFO)
@@ -382,9 +439,10 @@ bool ValidVersion(const BuiltInFunction& function, int version, EProfile profile
// Relate a single table of built-ins to their AST operator.
// This can get called redundantly (especially for the common built-ins, when
// called once per stage). This is a performance issue only, not a correctness
-// concern. It is done for quality arising from simplicity, as there are subtlies
+// concern. It is done for quality arising from simplicity, as there are subtleties
// to get correct if instead trying to do it surgically.
-void RelateTabledBuiltins(const BuiltInFunction* functions, TSymbolTable& symbolTable)
+template<class FunctionT>
+void RelateTabledBuiltins(const FunctionT* functions, TSymbolTable& symbolTable)
{
while (functions->op != EOpNull) {
symbolTable.relateToOperator(functions->name, functions->op);
@@ -408,10 +466,6 @@ void TBuiltIns::addTabledBuiltins(int version, EProfile profile, const SpvVersio
forEachFunction(commonBuiltins, BaseFunctions);
forEachFunction(stageBuiltins[EShLangFragment], DerivativeFunctions);
-#ifdef GLSLANG_WEB
- return;
-#endif
-
if ((profile == EEsProfile && version >= 320) || (profile != EEsProfile && version >= 450))
forEachFunction(stageBuiltins[EShLangCompute], DerivativeFunctions);
}
@@ -421,6 +475,7 @@ void TBuiltIns::relateTabledBuiltins(int /* version */, EProfile /* profile */,
{
RelateTabledBuiltins(BaseFunctions, symbolTable);
RelateTabledBuiltins(DerivativeFunctions, symbolTable);
+ RelateTabledBuiltins(CustomFunctions, symbolTable);
}
inline bool IncludeLegacy(int version, EProfile profile, const SpvVersion& spvVersion)
@@ -465,7 +520,7 @@ TBuiltIns::TBuiltIns()
dimMap[Esd1D] = 1;
dimMap[EsdRect] = 2;
dimMap[EsdBuffer] = 1;
- dimMap[EsdSubpass] = 2; // potientially unused for now
+ dimMap[EsdSubpass] = 2; // potentially unused for now
#endif
}
@@ -484,6 +539,10 @@ TBuiltIns::~TBuiltIns()
//
void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvVersion)
{
+#ifdef GLSLANG_WEB
+ version = 310;
+ profile = EEsProfile;
+#endif
addTabledBuiltins(version, profile, spvVersion);
//============================================================================
@@ -1306,14 +1365,13 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
commonBuiltins.append(
"mediump vec2 unpackHalf2x16(highp uint);"
"\n");
- }
-#ifndef GLSLANG_WEB
- else if (profile != EEsProfile && version >= 420) {
+ } else if (profile != EEsProfile && version >= 420) {
commonBuiltins.append(
" vec2 unpackHalf2x16(highp uint);"
"\n");
}
+#ifndef GLSLANG_WEB
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 400)) {
commonBuiltins.append(
@@ -3795,6 +3853,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"void EndPrimitive();"
"\n");
}
+#endif
//============================================================================
//
@@ -3824,15 +3883,20 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
);
if ((profile != EEsProfile && version >= 420) || esBarrier) {
commonBuiltins.append(
- "void memoryBarrierAtomicCounter();"
"void memoryBarrierBuffer();"
- "void memoryBarrierImage();"
);
stageBuiltins[EShLangCompute].append(
"void memoryBarrierShared();"
"void groupMemoryBarrier();"
);
}
+#ifndef GLSLANG_WEB
+ if ((profile != EEsProfile && version >= 420) || esBarrier) {
+ commonBuiltins.append(
+ "void memoryBarrierAtomicCounter();"
+ "void memoryBarrierImage();"
+ );
+ }
if ((profile != EEsProfile && version >= 450) || (profile == EEsProfile && version >= 320)) {
stageBuiltins[EShLangMeshNV].append(
"void memoryBarrierShared();"
@@ -4279,6 +4343,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
+#endif
//============================================================================
//
@@ -4308,6 +4373,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"\n");
}
+#ifndef GLSLANG_WEB
//============================================================================
//
// Define the interface to the mesh/task shader.
@@ -5314,10 +5380,9 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
#ifdef GLSLANG_WEB
const int ms = 0;
#else
- for (int ms = 0; ms <= 1; ++ms)
+ for (int ms = 0; ms <= 1; ++ms) // loop over "bool" multisample or not
#endif
{
-#ifndef GLSLANG_WEB
if ((ms || image) && shadow)
continue;
if (ms && profile != EEsProfile && version < 150)
@@ -5326,7 +5391,6 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
continue;
if (ms && profile == EEsProfile && version < 310)
continue;
-#endif
for (int arrayed = 0; arrayed <= 1; ++arrayed) { // loop over "bool" arrayed or not
#ifdef GLSLANG_WEB
@@ -5431,14 +5495,12 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, c
}
}
-#ifndef GLSLANG_WEB
//
// sparseTexelsResidentARB()
//
if (profile != EEsProfile && version >= 450) {
commonBuiltins.append("bool sparseTexelsResidentARB(int code);\n");
}
-#endif
}
//
@@ -5725,6 +5787,11 @@ void TBuiltIns::addSubpassSampling(TSampler sampler, const TString& typeName, in
//
void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile)
{
+#ifdef GLSLANG_WEB
+ profile = EEsProfile;
+ version = 310;
+#endif
+
//
// texturing
//
@@ -6005,6 +6072,11 @@ void TBuiltIns::addSamplingFunctions(TSampler sampler, const TString& typeName,
//
void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, int version, EProfile profile)
{
+#ifdef GLSLANG_WEB
+ profile = EEsProfile;
+ version = 310;
+#endif
+
switch (sampler.dim) {
case Esd2D:
case EsdRect:
@@ -6243,6 +6315,11 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, const TString& typeName, in
//
void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language)
{
+#ifdef GLSLANG_WEB
+ version = 310;
+ profile = EEsProfile;
+#endif
+
//
// Initialize the context-dependent (resource-dependent) built-in strings for parsing.
//
@@ -6300,9 +6377,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
s.append(builtInConstant);
}
-#ifdef GLSLANG_WEB
- }
-#else
+#ifndef GLSLANG_WEB
if (version >= 310) {
// geometry
@@ -6584,8 +6659,29 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
snprintf(builtInConstant, maxSize, "const int gl_MaxTransformFeedbackInterleavedComponents = %d;", resources.maxTransformFeedbackInterleavedComponents);
s.append(builtInConstant);
}
+#endif
}
+ // compute
+ if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) {
+ snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupCount = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupCountX,
+ resources.maxComputeWorkGroupCountY,
+ resources.maxComputeWorkGroupCountZ);
+ s.append(builtInConstant);
+ snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupSize = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupSizeX,
+ resources.maxComputeWorkGroupSizeY,
+ resources.maxComputeWorkGroupSizeZ);
+ s.append(builtInConstant);
+
+ snprintf(builtInConstant, maxSize, "const int gl_MaxComputeUniformComponents = %d;", resources.maxComputeUniformComponents);
+ s.append(builtInConstant);
+ snprintf(builtInConstant, maxSize, "const int gl_MaxComputeTextureImageUnits = %d;", resources.maxComputeTextureImageUnits);
+ s.append(builtInConstant);
+
+ s.append("\n");
+ }
+
+#ifndef GLSLANG_WEB
// images (some in compute below)
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 130)) {
@@ -6601,6 +6697,18 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
s.append(builtInConstant);
}
+ // compute
+ if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) {
+ snprintf(builtInConstant, maxSize, "const int gl_MaxComputeImageUniforms = %d;", resources.maxComputeImageUniforms);
+ s.append(builtInConstant);
+ snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounters = %d;", resources.maxComputeAtomicCounters);
+ s.append(builtInConstant);
+ snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounterBuffers = %d;", resources.maxComputeAtomicCounterBuffers);
+ s.append(builtInConstant);
+
+ s.append("\n");
+ }
+
// atomic counters (some in compute below)
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 420)) {
@@ -6638,31 +6746,6 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
s.append("\n");
}
- // compute
- if ((profile == EEsProfile && version >= 310) || (profile != EEsProfile && version >= 420)) {
- snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupCount = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupCountX,
- resources.maxComputeWorkGroupCountY,
- resources.maxComputeWorkGroupCountZ);
- s.append(builtInConstant);
- snprintf(builtInConstant, maxSize, "const ivec3 gl_MaxComputeWorkGroupSize = ivec3(%d,%d,%d);", resources.maxComputeWorkGroupSizeX,
- resources.maxComputeWorkGroupSizeY,
- resources.maxComputeWorkGroupSizeZ);
- s.append(builtInConstant);
-
- snprintf(builtInConstant, maxSize, "const int gl_MaxComputeUniformComponents = %d;", resources.maxComputeUniformComponents);
- s.append(builtInConstant);
- snprintf(builtInConstant, maxSize, "const int gl_MaxComputeTextureImageUnits = %d;", resources.maxComputeTextureImageUnits);
- s.append(builtInConstant);
- snprintf(builtInConstant, maxSize, "const int gl_MaxComputeImageUniforms = %d;", resources.maxComputeImageUniforms);
- s.append(builtInConstant);
- snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounters = %d;", resources.maxComputeAtomicCounters);
- s.append(builtInConstant);
- snprintf(builtInConstant, maxSize, "const int gl_MaxComputeAtomicCounterBuffers = %d;", resources.maxComputeAtomicCounterBuffers);
- s.append(builtInConstant);
-
- s.append("\n");
- }
-
// GL_ARB_cull_distance
if (profile != EEsProfile && version >= 450) {
snprintf(builtInConstant, maxSize, "const int gl_MaxCullDistances = %d;", resources.maxCullDistances);
@@ -6781,6 +6864,11 @@ static void BuiltInVariable(const char* blockName, const char* name, TBuiltInVar
//
void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion& spvVersion, EShLanguage language, TSymbolTable& symbolTable)
{
+#ifdef GLSLANG_WEB
+ version = 310;
+ profile = EEsProfile;
+#endif
+
//
// Tag built-in variables and functions with additional qualifier and extension information
// that cannot be declared with the text strings.
@@ -7547,7 +7635,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
#endif
break;
-#ifndef GLSLANG_WEB
case EShLangCompute:
BuiltInVariable("gl_NumWorkGroups", EbvNumWorkGroups, symbolTable);
BuiltInVariable("gl_WorkGroupSize", EbvWorkGroupSize, symbolTable);
@@ -7555,6 +7642,15 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_LocalInvocationID", EbvLocalInvocationId, symbolTable);
BuiltInVariable("gl_GlobalInvocationID", EbvGlobalInvocationId, symbolTable);
BuiltInVariable("gl_LocalInvocationIndex", EbvLocalInvocationIndex, symbolTable);
+ BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
+ BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
+
+#ifndef GLSLANG_WEB
+ if ((profile != EEsProfile && version >= 140) ||
+ (profile == EEsProfile && version >= 310)) {
+ symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
+ symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
+ }
if (profile != EEsProfile && version < 430) {
symbolTable.setVariableExtensions("gl_NumWorkGroups", 1, &E_GL_ARB_compute_shader);
@@ -7636,14 +7732,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_SMIDNV", EbvSMID, symbolTable);
}
- if ((profile != EEsProfile && version >= 140) ||
- (profile == EEsProfile && version >= 310)) {
- symbolTable.setVariableExtensions("gl_DeviceIndex", 1, &E_GL_EXT_device_group);
- BuiltInVariable("gl_DeviceIndex", EbvDeviceIndex, symbolTable);
- symbolTable.setVariableExtensions("gl_ViewIndex", 1, &E_GL_EXT_multiview);
- BuiltInVariable("gl_ViewIndex", EbvViewIndex, symbolTable);
- }
-
// GL_KHR_shader_subgroup
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 140)) {
@@ -7674,8 +7762,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("dFdyCoarse", 1, &E_GL_NV_compute_shader_derivatives);
symbolTable.setFunctionExtensions("fwidthCoarse", 1, &E_GL_NV_compute_shader_derivatives);
}
-
+#endif
break;
+
+#ifndef GLSLANG_WEB
case EShLangRayGenNV:
case EShLangIntersectNV:
case EShLangAnyHitNV:
@@ -8034,21 +8124,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
relateTabledBuiltins(version, profile, spvVersion, language, symbolTable);
- symbolTable.relateToOperator("matrixCompMult", EOpMul);
- // 120 and 150 are correct for both ES and desktop
- if (version >= 120) {
- symbolTable.relateToOperator("outerProduct", EOpOuterProduct);
- symbolTable.relateToOperator("transpose", EOpTranspose);
- if (version >= 150) {
- symbolTable.relateToOperator("determinant", EOpDeterminant);
- symbolTable.relateToOperator("inverse", EOpMatrixInverse);
- }
- }
-
- symbolTable.relateToOperator("floatBitsToInt", EOpFloatBitsToInt);
- symbolTable.relateToOperator("floatBitsToUint", EOpFloatBitsToUint);
- symbolTable.relateToOperator("intBitsToFloat", EOpIntBitsToFloat);
- symbolTable.relateToOperator("uintBitsToFloat", EOpUintBitsToFloat);
#ifndef GLSLANG_WEB
symbolTable.relateToOperator("doubleBitsToInt64", EOpDoubleBitsToInt64);
symbolTable.relateToOperator("doubleBitsToUint64", EOpDoubleBitsToUint64);
@@ -8063,14 +8138,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("int16BitsToHalf", EOpInt16BitsToFloat16);
symbolTable.relateToOperator("uint16BitsToHalf", EOpUint16BitsToFloat16);
-#endif
-
- symbolTable.relateToOperator("packSnorm2x16", EOpPackSnorm2x16);
- symbolTable.relateToOperator("unpackSnorm2x16", EOpUnpackSnorm2x16);
- symbolTable.relateToOperator("packUnorm2x16", EOpPackUnorm2x16);
- symbolTable.relateToOperator("unpackUnorm2x16", EOpUnpackUnorm2x16);
-#ifndef GLSLANG_WEB
symbolTable.relateToOperator("packSnorm4x8", EOpPackSnorm4x8);
symbolTable.relateToOperator("unpackSnorm4x8", EOpUnpackSnorm4x8);
symbolTable.relateToOperator("packUnorm4x8", EOpPackUnorm4x8);
@@ -8078,17 +8146,12 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("packDouble2x32", EOpPackDouble2x32);
symbolTable.relateToOperator("unpackDouble2x32", EOpUnpackDouble2x32);
-#endif
-
- symbolTable.relateToOperator("packHalf2x16", EOpPackHalf2x16);
- symbolTable.relateToOperator("unpackHalf2x16", EOpUnpackHalf2x16);
symbolTable.relateToOperator("packInt2x32", EOpPackInt2x32);
symbolTable.relateToOperator("unpackInt2x32", EOpUnpackInt2x32);
symbolTable.relateToOperator("packUint2x32", EOpPackUint2x32);
symbolTable.relateToOperator("unpackUint2x32", EOpUnpackUint2x32);
-#ifndef GLSLANG_WEB
symbolTable.relateToOperator("packInt2x16", EOpPackInt2x16);
symbolTable.relateToOperator("unpackInt2x16", EOpUnpackInt2x16);
symbolTable.relateToOperator("packUint2x16", EOpPackUint2x16);
@@ -8109,11 +8172,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("unpack16", EOpUnpack16);
symbolTable.relateToOperator("unpack8", EOpUnpack8);
- symbolTable.relateToOperator("barrier", EOpBarrier);
symbolTable.relateToOperator("controlBarrier", EOpBarrier);
- symbolTable.relateToOperator("memoryBarrier", EOpMemoryBarrier);
symbolTable.relateToOperator("memoryBarrierAtomicCounter", EOpMemoryBarrierAtomicCounter);
- symbolTable.relateToOperator("memoryBarrierBuffer", EOpMemoryBarrierBuffer);
symbolTable.relateToOperator("memoryBarrierImage", EOpMemoryBarrierImage);
symbolTable.relateToOperator("atomicLoad", EOpAtomicLoad);
@@ -8156,10 +8216,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("findMSB", EOpFindMSB);
symbolTable.relateToOperator("helperInvocationEXT", EOpIsHelperInvocation);
-#endif
if (PureOperatorBuiltins) {
-#ifndef GLSLANG_WEB
symbolTable.relateToOperator("imageSize", EOpImageQuerySize);
symbolTable.relateToOperator("imageSamples", EOpImageQuerySamples);
symbolTable.relateToOperator("imageLoad", EOpImageLoad);
@@ -8177,28 +8235,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("subpassLoad", EOpSubpassLoad);
symbolTable.relateToOperator("subpassLoadMS", EOpSubpassLoadMS);
-#endif
- symbolTable.relateToOperator("textureSize", EOpTextureQuerySize);
- symbolTable.relateToOperator("textureQueryLod", EOpTextureQueryLod);
- symbolTable.relateToOperator("textureQueryLevels", EOpTextureQueryLevels);
- symbolTable.relateToOperator("textureSamples", EOpTextureQuerySamples);
- symbolTable.relateToOperator("texture", EOpTexture);
- symbolTable.relateToOperator("textureProj", EOpTextureProj);
- symbolTable.relateToOperator("textureLod", EOpTextureLod);
- symbolTable.relateToOperator("textureOffset", EOpTextureOffset);
- symbolTable.relateToOperator("texelFetch", EOpTextureFetch);
- symbolTable.relateToOperator("texelFetchOffset", EOpTextureFetchOffset);
- symbolTable.relateToOperator("textureProjOffset", EOpTextureProjOffset);
- symbolTable.relateToOperator("textureLodOffset", EOpTextureLodOffset);
- symbolTable.relateToOperator("textureProjLod", EOpTextureProjLod);
- symbolTable.relateToOperator("textureProjLodOffset", EOpTextureProjLodOffset);
- symbolTable.relateToOperator("textureGrad", EOpTextureGrad);
- symbolTable.relateToOperator("textureGradOffset", EOpTextureGradOffset);
- symbolTable.relateToOperator("textureProjGrad", EOpTextureProjGrad);
- symbolTable.relateToOperator("textureProjGradOffset", EOpTextureProjGradOffset);
-
-#ifndef GLSLANG_WEB
symbolTable.relateToOperator("textureGather", EOpTextureGather);
symbolTable.relateToOperator("textureGatherOffset", EOpTextureGatherOffset);
symbolTable.relateToOperator("textureGatherOffsets", EOpTextureGatherOffsets);
@@ -8440,10 +8477,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.relateToOperator("shadow2DEXT", EOpTexture);
symbolTable.relateToOperator("shadow2DProjEXT", EOpTextureProj);
}
-#endif
}
-#ifndef GLSLANG_WEB
switch(language) {
case EShLangVertex:
break;
@@ -8481,8 +8516,6 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
break;
case EShLangCompute:
- symbolTable.relateToOperator("memoryBarrierShared", EOpMemoryBarrierShared);
- symbolTable.relateToOperator("groupMemoryBarrier", EOpGroupMemoryBarrier);
symbolTable.relateToOperator("subgroupMemoryBarrierShared", EOpSubgroupMemoryBarrierShared);
if ((profile != EEsProfile && version >= 450) ||
(profile == EEsProfile && version >= 320)) {