summaryrefslogtreecommitdiffstats
path: root/thirdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp')
-rw-r--r--thirdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp378
1 files changed, 136 insertions, 242 deletions
diff --git a/thirdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp b/thirdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp
index c6f947d9b2..b8c64e0985 100644
--- a/thirdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp
+++ b/thirdparty/glslang/glslang/MachineIndependent/ParseHelper.cpp
@@ -57,11 +57,8 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b
infoSink, forwardCompatible, messages, entryPoint),
inMain(false),
blockName(nullptr),
- limits(resources.limits)
-#ifndef GLSLANG_WEB
- ,
+ limits(resources.limits),
atomicUintOffsets(nullptr), anyIndexLimits(false)
-#endif
{
// decide whether precision qualifiers should be ignored or respected
if (isEsProfile() || spvVersion.vulkan > 0) {
@@ -87,7 +84,6 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b
globalSharedDefaults.layoutMatrix = ElmColumnMajor;
globalSharedDefaults.layoutPacking = ElpStd430;
-#ifndef GLSLANG_WEB
// "Shaders in the transform
// feedback capturing mode have an initial global default of
// layout(xfb_buffer = 0) out;"
@@ -99,7 +95,6 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b
if (language == EShLangGeometry)
globalOutputDefaults.layoutStream = 0;
-#endif
if (entryPoint != nullptr && entryPoint->size() > 0 && *entryPoint != "main")
infoSink.info.message(EPrefixError, "Source entry point must be \"main\"");
@@ -107,9 +102,7 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b
TParseContext::~TParseContext()
{
-#ifndef GLSLANG_WEB
delete [] atomicUintOffsets;
-#endif
}
// Set up all default precisions as needed by the current environment.
@@ -173,7 +166,6 @@ void TParseContext::setLimits(const TBuiltInResource& r)
resources = r;
intermediate.setLimits(r);
-#ifndef GLSLANG_WEB
anyIndexLimits = ! limits.generalAttributeMatrixVectorIndexing ||
! limits.generalConstantMatrixVectorIndexing ||
! limits.generalSamplerIndexing ||
@@ -188,7 +180,6 @@ void TParseContext::setLimits(const TBuiltInResource& r)
atomicUintOffsets = new int[resources.maxAtomicCounterBindings];
for (int b = 0; b < resources.maxAtomicCounterBindings; ++b)
atomicUintOffsets[b] = 0;
-#endif
}
//
@@ -335,7 +326,6 @@ void TParseContext::setInvariant(const TSourceLoc& loc, const char* builtin) {
void TParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>& tokens)
{
-#ifndef GLSLANG_WEB
if (pragmaCallback)
pragmaCallback(loc.line, tokens);
@@ -437,7 +427,6 @@ void TParseContext::handlePragma(const TSourceLoc& loc, const TVector<TString>&
setInvariant(loc, "gl_FragColor");
setInvariant(loc, "gl_FragData");
}
-#endif
}
//
@@ -451,7 +440,6 @@ TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symb
if (symbol && symbol->getNumExtensions())
requireExtensions(loc, symbol->getNumExtensions(), symbol->getExtensions(), symbol->getName().c_str());
-#ifndef GLSLANG_WEB
if (symbol && symbol->isReadOnly()) {
// All shared things containing an unsized array must be copied up
// on first use, so that all future references will share its array structure,
@@ -471,7 +459,6 @@ TIntermTyped* TParseContext::handleVariable(const TSourceLoc& loc, TSymbol* symb
makeEditable(symbol);
}
}
-#endif
const TVariable* variable;
const TAnonMember* anon = symbol ? symbol->getAsAnonMember() : nullptr;
@@ -576,7 +563,6 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
// at least one of base and index is not a front-end constant variable...
TIntermTyped* result = nullptr;
-#ifndef GLSLANG_WEB
if (base->isReference() && ! base->isArray()) {
requireExtensions(loc, 1, &E_GL_EXT_buffer_reference2, "buffer reference indexing");
if (base->getType().getReferentType()->containsUnsizedArray()) {
@@ -595,13 +581,11 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
}
if (base->getAsSymbolNode() && isIoResizeArray(base->getType()))
handleIoResizeArrayAccess(loc, base);
-#endif
if (index->getQualifier().isFrontEndConstant())
checkIndex(loc, base->getType(), indexValue);
if (index->getQualifier().isFrontEndConstant()) {
-#ifndef GLSLANG_WEB
if (base->getType().isUnsizedArray()) {
base->getWritableType().updateImplicitArraySize(indexValue + 1);
base->getWritableType().setImplicitlySized(true);
@@ -624,11 +608,9 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
}
}
} else
-#endif
checkIndex(loc, base->getType(), indexValue);
result = intermediate.addIndex(EOpIndexDirect, base, index, loc);
} else {
-#ifndef GLSLANG_WEB
if (base->getType().isUnsizedArray()) {
// we have a variable index into an unsized array, which is okay,
// depending on the situation
@@ -640,7 +622,6 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
}
base->getWritableType().setArrayVariablyIndexed();
}
-#endif
if (base->getBasicType() == EbtBlock) {
if (base->getQualifier().storage == EvqBuffer)
requireProfile(base->getLoc(), ~EEsProfile, "variable indexing buffer block array");
@@ -676,7 +657,6 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
}
result->setType(newType);
-#ifndef GLSLANG_WEB
inheritMemoryQualifiers(base->getQualifier(), result->getWritableType().getQualifier());
// Propagate nonuniform
@@ -685,13 +665,10 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
if (anyIndexLimits)
handleIndexLimits(loc, base, index);
-#endif
return result;
}
-#ifndef GLSLANG_WEB
-
// for ES 2.0 (version 100) limitations for almost all index operations except vertex-shader uniforms
void TParseContext::handleIndexLimits(const TSourceLoc& /*loc*/, TIntermTyped* base, TIntermTyped* index)
{
@@ -885,8 +862,6 @@ void TParseContext::checkIoArrayConsistency(const TSourceLoc& loc, int requiredS
}
}
-#endif // GLSLANG_WEB
-
// Handle seeing a binary node with a math operation.
// Returns nullptr if not semantically allowed.
TIntermTyped* TParseContext::handleBinaryMath(const TSourceLoc& loc, const char* str, TOperator op, TIntermTyped* left, TIntermTyped* right)
@@ -1165,7 +1140,6 @@ TFunction* TParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFunct
TSymbol* symbol = symbolTable.find(function.getMangledName(), &builtIn);
if (symbol && symbol->getAsFunction() && builtIn)
requireProfile(loc, ~EEsProfile, "redefinition of built-in function");
-#ifndef GLSLANG_WEB
// Check the validity of using spirv_literal qualifier
for (int i = 0; i < function.getParamCount(); ++i) {
if (function[i].type->getQualifier().isSpirvLiteral() && function.getBuiltInOp() != EOpSpirvInst)
@@ -1177,19 +1151,16 @@ TFunction* TParseContext::handleFunctionDeclarator(const TSourceLoc& loc, TFunct
// respect this redeclared one.
if (symbol && builtIn && function.getBuiltInOp() == EOpSpirvInst)
symbol = nullptr;
-#endif
const TFunction* prevDec = symbol ? symbol->getAsFunction() : nullptr;
if (prevDec) {
if (prevDec->isPrototyped() && prototype)
profileRequires(loc, EEsProfile, 300, nullptr, "multiple prototypes for same function");
if (prevDec->getType() != function.getType())
error(loc, "overloaded functions must have the same return type", function.getName().c_str(), "");
-#ifndef GLSLANG_WEB
if (prevDec->getSpirvInstruction() != function.getSpirvInstruction()) {
error(loc, "overloaded functions must have the same qualifiers", function.getName().c_str(),
"spirv_instruction");
}
-#endif
for (int i = 0; i < prevDec->getParamCount(); ++i) {
if ((*prevDec)[i].type->getQualifier().storage != function[i].type->getQualifier().storage)
error(loc, "overloaded functions must have the same parameter storage qualifiers for argument", function[i].type->getStorageQualifierString(), "%d", i+1);
@@ -1391,7 +1362,6 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
if (lValueErrorCheck(arguments->getLoc(), "assign", arg->getAsTyped()))
error(arguments->getLoc(), "Non-L-value cannot be passed for 'out' or 'inout' parameters.", "out", "");
}
-#ifndef GLSLANG_WEB
if (formalQualifier.isSpirvLiteral()) {
if (!arg->getAsTyped()->getQualifier().isFrontEndConstant()) {
error(arguments->getLoc(),
@@ -1399,13 +1369,11 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
"spirv_literal", "");
}
}
-#endif
const TType& argType = arg->getAsTyped()->getType();
const TQualifier& argQualifier = argType.getQualifier();
bool containsBindlessSampler = intermediate.getBindlessMode() && argType.containsSampler();
if (argQualifier.isMemory() && !containsBindlessSampler && (argType.containsOpaque() || argType.isReference())) {
const char* message = "argument cannot drop memory qualifier when passed to formal parameter";
-#ifndef GLSLANG_WEB
if (argQualifier.volatil && ! formalQualifier.volatil)
error(arguments->getLoc(), message, "volatile", "");
if (argQualifier.coherent && ! (formalQualifier.devicecoherent || formalQualifier.coherent))
@@ -1425,7 +1393,6 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
// Don't check 'restrict', it is different than the rest:
// "...but only restrict can be taken away from a calling argument, by a formal parameter that
// lacks the restrict qualifier..."
-#endif
}
if (!builtIn && argQualifier.getFormat() != formalQualifier.getFormat()) {
// we have mismatched formats, which should only be allowed if writeonly
@@ -1455,11 +1422,9 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
if (builtIn && fnCandidate->getBuiltInOp() != EOpNull) {
// A function call mapped to a built-in operation.
result = handleBuiltInFunctionCall(loc, arguments, *fnCandidate);
-#ifndef GLSLANG_WEB
} else if (fnCandidate->getBuiltInOp() == EOpSpirvInst) {
// When SPIR-V instruction qualifier is specified, the function call is still mapped to a built-in operation.
result = handleBuiltInFunctionCall(loc, arguments, *fnCandidate);
-#endif
} else {
// This is a function call not mapped to built-in operator.
// It could still be a built-in function, but only if PureOperatorBuiltins == false.
@@ -1479,11 +1444,9 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
intermediate.addToCallGraph(infoSink, currentCaller, fnCandidate->getMangledName());
}
-#ifndef GLSLANG_WEB
if (builtIn)
nonOpBuiltInCheck(loc, *fnCandidate, *call);
else
-#endif
userFunctionCallCheck(loc, *call);
}
@@ -1501,7 +1464,8 @@ TIntermTyped* TParseContext::handleFunctionCall(const TSourceLoc& loc, TFunction
if (result->getAsTyped()->getType().isCoopMat() &&
!result->getAsTyped()->getType().isParameterized()) {
- assert(fnCandidate->getBuiltInOp() == EOpCooperativeMatrixMulAdd);
+ assert(fnCandidate->getBuiltInOp() == EOpCooperativeMatrixMulAdd ||
+ fnCandidate->getBuiltInOp() == EOpCooperativeMatrixMulAddNV);
result->setType(result->getAsAggregate()->getSequence()[2]->getAsTyped()->getType());
}
@@ -1537,7 +1501,6 @@ TIntermTyped* TParseContext::handleBuiltInFunctionCall(TSourceLoc loc, TIntermNo
} else if (result->getAsOperator())
builtInOpCheck(loc, function, *result->getAsOperator());
-#ifndef GLSLANG_WEB
// Special handling for function call with SPIR-V instruction qualifier specified
if (function.getBuiltInOp() == EOpSpirvInst) {
if (auto agg = result->getAsAggregate()) {
@@ -1564,7 +1527,6 @@ TIntermTyped* TParseContext::handleBuiltInFunctionCall(TSourceLoc loc, TIntermNo
} else
assert(0);
}
-#endif
return result;
}
@@ -1667,9 +1629,7 @@ void TParseContext::computeBuiltinPrecisions(TIntermTyped& node, const TFunction
TIntermNode* TParseContext::handleReturnValue(const TSourceLoc& loc, TIntermTyped* value)
{
-#ifndef GLSLANG_WEB
storage16BitAssignmentCheck(loc, value->getType(), "return");
-#endif
functionReturnsValue = true;
TIntermBranch* branch = nullptr;
@@ -1703,7 +1663,6 @@ TIntermNode* TParseContext::handleReturnValue(const TSourceLoc& loc, TIntermType
// See if the operation is being done in an illegal location.
void TParseContext::checkLocation(const TSourceLoc& loc, TOperator op)
{
-#ifndef GLSLANG_WEB
switch (op) {
case EOpBarrier:
if (language == EShLangTessControl) {
@@ -1756,7 +1715,6 @@ void TParseContext::checkLocation(const TSourceLoc& loc, TOperator op)
default:
break;
}
-#endif
}
// Finish processing object.length(). This started earlier in handleDotDereference(), where
@@ -1774,7 +1732,6 @@ TIntermTyped* TParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction
const TType& type = intermNode->getAsTyped()->getType();
if (type.isArray()) {
if (type.isUnsizedArray()) {
-#ifndef GLSLANG_WEB
if (intermNode->getAsSymbolNode() && isIoResizeArray(type)) {
// We could be between a layout declaration that gives a built-in io array implicit size and
// a user redeclaration of that array, meaning we have to substitute its implicit size here
@@ -1786,16 +1743,13 @@ TIntermTyped* TParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction
length = getIoArrayImplicitSize(type.getQualifier());
}
}
-#endif
if (length == 0) {
-#ifndef GLSLANG_WEB
if (intermNode->getAsSymbolNode() && isIoResizeArray(type))
error(loc, "", function->getName().c_str(), "array must first be sized by a redeclaration or layout qualifier");
else if (isRuntimeLength(*intermNode->getAsTyped())) {
// Create a unary op and let the back end handle it
return intermediate.addBuiltInFunctionCall(loc, EOpArrayLength, true, intermNode, TType(EbtInt));
} else
-#endif
error(loc, "", function->getName().c_str(), "array must be declared with a size before using this method");
}
} else if (type.getOuterArrayNode()) {
@@ -1828,7 +1782,6 @@ TIntermTyped* TParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction
//
void TParseContext::addInputArgumentConversions(const TFunction& function, TIntermNode*& arguments) const
{
-#ifndef GLSLANG_WEB
TIntermAggregate* aggregate = arguments->getAsAggregate();
// Process each argument's conversion
@@ -1856,7 +1809,6 @@ void TParseContext::addInputArgumentConversions(const TFunction& function, TInte
}
}
}
-#endif
}
//
@@ -1868,9 +1820,6 @@ void TParseContext::addInputArgumentConversions(const TFunction& function, TInte
//
TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& function, TIntermAggregate& intermNode) const
{
-#ifdef GLSLANG_WEB
- return &intermNode;
-#else
TIntermSequence& arguments = intermNode.getSequence();
// Will there be any output conversions?
@@ -1938,7 +1887,6 @@ TIntermTyped* TParseContext::addOutputArgumentConversions(const TFunction& funct
conversionTree = intermediate.setAggregateOperator(conversionTree, EOpComma, intermNode.getType(), intermNode.getLoc());
return conversionTree;
-#endif
}
TIntermTyped* TParseContext::addAssign(const TSourceLoc& loc, TOperator op, TIntermTyped* left, TIntermTyped* right)
@@ -2148,7 +2096,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
TString featureString;
const char* feature = nullptr;
switch (callNode.getOp()) {
-#ifndef GLSLANG_WEB
case EOpTextureGather:
case EOpTextureGatherOffset:
case EOpTextureGatherOffsets:
@@ -2289,7 +2236,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
break;
}
-#endif
case EOpTextureOffset:
case EOpTextureFetchOffset:
@@ -2317,12 +2263,10 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
if (arg > 0) {
-#ifndef GLSLANG_WEB
bool f16ShadowCompare = (*argp)[1]->getAsTyped()->getBasicType() == EbtFloat16 &&
arg0->getType().getSampler().shadow;
if (f16ShadowCompare)
++arg;
-#endif
if (! (*argp)[arg]->getAsTyped()->getQualifier().isConstant())
error(loc, "argument must be compile-time constant", "texel offset", "");
else if ((*argp)[arg]->getAsConstantUnion()) {
@@ -2349,7 +2293,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
break;
}
-#ifndef GLSLANG_WEB
case EOpTraceNV:
if (!(*argp)[10]->getAsConstantUnion())
error(loc, "argument must be compile-time constant", "payload number", "a");
@@ -2680,7 +2623,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
}
break;
-#endif
default:
break;
@@ -2743,8 +2685,6 @@ void TParseContext::builtInOpCheck(const TSourceLoc& loc, const TFunction& fnCan
}
}
-#ifndef GLSLANG_WEB
-
extern bool PureOperatorBuiltins;
// Deprecated! Use PureOperatorBuiltins == true instead, in which case this
@@ -2871,8 +2811,6 @@ void TParseContext::nonOpBuiltInCheck(const TSourceLoc& loc, const TFunction& fn
}
}
-#endif
-
//
// Do any extra checking for a user function call.
//
@@ -3031,7 +2969,6 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt
bool errorReturn = false;
switch(binaryNode->getOp()) {
-#ifndef GLSLANG_WEB
case EOpIndexDirect:
case EOpIndexIndirect:
// ... tessellation control shader ...
@@ -3048,7 +2985,6 @@ bool TParseContext::lValueErrorCheck(const TSourceLoc& loc, const char* op, TInt
}
}
break; // left node is checked by base class
-#endif
case EOpVectorSwizzle:
errorReturn = lValueErrorCheck(loc, op, binaryNode->getLeft());
if (!errorReturn) {
@@ -3266,10 +3202,6 @@ void TParseContext::reservedPpErrorCheck(const TSourceLoc& loc, const char* iden
//
bool TParseContext::lineContinuationCheck(const TSourceLoc& loc, bool endOfComment)
{
-#ifdef GLSLANG_WEB
- return true;
-#endif
-
const char* message = "line continuation";
bool lineContinuationAllowed = (isEsProfile() && version >= 300) ||
@@ -3326,7 +3258,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
// it, in which case the type comes from the argument instead of from the
// constructor function.
switch (op) {
-#ifndef GLSLANG_WEB
case EOpConstructNonuniform:
if (node != nullptr && node->getAsTyped() != nullptr) {
type.shallowCopy(node->getAsTyped()->getType());
@@ -3334,7 +3265,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
type.getQualifier().nonUniform = true;
}
break;
-#endif
default:
type.shallowCopy(function.getType());
break;
@@ -3360,7 +3290,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
case EOpConstructMat4x2:
case EOpConstructMat4x3:
case EOpConstructMat4x4:
-#ifndef GLSLANG_WEB
case EOpConstructDMat2x2:
case EOpConstructDMat2x3:
case EOpConstructDMat2x4:
@@ -3379,7 +3308,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
case EOpConstructF16Mat4x2:
case EOpConstructF16Mat4x3:
case EOpConstructF16Mat4x4:
-#endif
constructingMatrix = true;
break;
default:
@@ -3446,7 +3374,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
if (op == EOpConstructNonuniform)
constType = false;
-#ifndef GLSLANG_WEB
switch (op) {
case EOpConstructFloat16:
case EOpConstructF16Vec2:
@@ -3486,7 +3413,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
default:
break;
}
-#endif
// inherit constness from children
if (constType) {
@@ -3507,7 +3433,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
case EOpConstructUVec2:
case EOpConstructUVec3:
case EOpConstructUVec4:
-#ifndef GLSLANG_WEB
case EOpConstructUint8:
case EOpConstructInt16:
case EOpConstructUint16:
@@ -3531,7 +3456,6 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
case EOpConstructU64Vec2:
case EOpConstructU64Vec3:
case EOpConstructU64Vec4:
-#endif
// This was the list of valid ones, if they aren't converting from float
// and aren't making an array.
makeSpecConst = ! floatArgument && ! type.isArray();
@@ -3642,6 +3566,12 @@ bool TParseContext::constructorError(const TSourceLoc& loc, TIntermNode* node, T
}
TIntermTyped* typed = node->getAsTyped();
+ if (type.isCoopMat() && typed->getType().isCoopMat() &&
+ !type.sameCoopMatShapeAndUse(typed->getType())) {
+ error(loc, "Cooperative matrix type parameters mismatch", constructorString.c_str(), "");
+ return true;
+ }
+
if (typed == nullptr) {
error(loc, "constructor argument does not have a type", constructorString.c_str(), "");
return true;
@@ -3820,8 +3750,6 @@ void TParseContext::samplerCheck(const TSourceLoc& loc, const TType& type, const
}
}
-#ifndef GLSLANG_WEB
-
void TParseContext::atomicUintCheck(const TSourceLoc& loc, const TType& type, const TString& identifier)
{
if (type.getQualifier().storage == EvqUniform)
@@ -3846,8 +3774,6 @@ void TParseContext::accStructCheck(const TSourceLoc& loc, const TType& type, con
}
-#endif // GLSLANG_WEB
-
void TParseContext::transparentOpaqueCheck(const TSourceLoc& loc, const TType& type, const TString& identifier)
{
if (parsingBuiltins)
@@ -3931,13 +3857,11 @@ void TParseContext::globalQualifierFixCheck(const TSourceLoc& loc, TQualifier& q
if (!nonuniformOkay && qualifier.isNonUniform())
error(loc, "for non-parameter, can only apply to 'in' or no storage qualifier", "nonuniformEXT", "");
-#ifndef GLSLANG_WEB
if (qualifier.isSpirvByReference())
error(loc, "can only apply to parameter", "spirv_by_reference", "");
if (qualifier.isSpirvLiteral())
error(loc, "can only apply to parameter", "spirv_literal", "");
-#endif
// Storage qualifier isn't ready for memberQualifierCheck, we should skip invariantCheck for it.
if (!isMemberCheck || structNestingLevel > 0)
@@ -4043,12 +3967,10 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
if (! symbolTable.atBuiltInLevel())
error(loc, "global storage input qualifier cannot be used in a compute shader", "in", "");
break;
-#ifndef GLSLANG_WEB
case EShLangTessControl:
if (qualifier.patch)
error(loc, "can only use on output in tessellation-control shader", "patch", "");
break;
-#endif
default:
break;
}
@@ -4087,12 +4009,10 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
case EShLangCompute:
error(loc, "global storage output qualifier cannot be used in a compute shader", "out", "");
break;
-#ifndef GLSLANG_WEB
case EShLangTessEvaluation:
if (qualifier.patch)
error(loc, "can only use on input in tessellation-evaluation shader", "patch", "");
break;
-#endif
default:
break;
}
@@ -4160,7 +4080,6 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
if (dst.precision == EpqNone || (force && src.precision != EpqNone))
dst.precision = src.precision;
-#ifndef GLSLANG_WEB
if (!force && ((src.coherent && (dst.devicecoherent || dst.queuefamilycoherent || dst.workgroupcoherent || dst.subgroupcoherent || dst.shadercallcoherent)) ||
(src.devicecoherent && (dst.coherent || dst.queuefamilycoherent || dst.workgroupcoherent || dst.subgroupcoherent || dst.shadercallcoherent)) ||
(src.queuefamilycoherent && (dst.coherent || dst.devicecoherent || dst.workgroupcoherent || dst.subgroupcoherent || dst.shadercallcoherent)) ||
@@ -4170,7 +4089,7 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
error(loc, "only one coherent/devicecoherent/queuefamilycoherent/workgroupcoherent/subgroupcoherent/shadercallcoherent qualifier allowed",
GetPrecisionQualifierString(src.precision), "");
}
-#endif
+
// Layout qualifiers
mergeObjectLayoutQualifiers(dst, src, false);
@@ -4182,7 +4101,6 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
MERGE_SINGLETON(smooth);
MERGE_SINGLETON(flat);
MERGE_SINGLETON(specConstant);
-#ifndef GLSLANG_WEB
MERGE_SINGLETON(noContraction);
MERGE_SINGLETON(nopersp);
MERGE_SINGLETON(explicitInterp);
@@ -4203,9 +4121,7 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
MERGE_SINGLETON(readonly);
MERGE_SINGLETON(writeonly);
MERGE_SINGLETON(nonUniform);
-#endif
-#ifndef GLSLANG_WEB
// SPIR-V storage class qualifier (GL_EXT_spirv_intrinsics)
dst.spirvStorageClass = src.spirvStorageClass;
@@ -4238,7 +4154,6 @@ void TParseContext::mergeQualifiers(const TSourceLoc& loc, TQualifier& dst, cons
dst.spirvDecorate = src.spirvDecorate;
}
}
-#endif
if (repeated)
error(loc, "replicated qualifiers", "", "");
@@ -4302,17 +4217,18 @@ TPrecisionQualifier TParseContext::getDefaultPrecision(TPublicType& publicType)
return defaultPrecision[publicType.basicType];
}
-void TParseContext::precisionQualifierCheck(const TSourceLoc& loc, TBasicType baseType, TQualifier& qualifier)
+void TParseContext::precisionQualifierCheck(const TSourceLoc& loc, TBasicType baseType, TQualifier& qualifier, bool isCoopMat)
{
// Built-in symbols are allowed some ambiguous precisions, to be pinned down
// later by context.
if (! obeyPrecisionQualifiers() || parsingBuiltins)
return;
-#ifndef GLSLANG_WEB
if (baseType == EbtAtomicUint && qualifier.precision != EpqNone && qualifier.precision != EpqHigh)
error(loc, "atomic counters can only be highp", "atomic_uint", "");
-#endif
+
+ if (isCoopMat)
+ return;
if (baseType == EbtFloat || baseType == EbtUint || baseType == EbtInt || baseType == EbtSampler || baseType == EbtAtomicUint) {
if (qualifier.precision == EpqNone) {
@@ -4358,7 +4274,8 @@ bool TParseContext::containsFieldWithBasicType(const TType& type, TBasicType bas
//
// Do size checking for an array type's size.
//
-void TParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, TArraySize& sizePair, const char *sizeType)
+void TParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, TArraySize& sizePair,
+ const char* sizeType, const bool allowZero)
{
bool isConst = false;
sizePair.node = nullptr;
@@ -4378,9 +4295,8 @@ void TParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, TA
TIntermSymbol* symbol = expr->getAsSymbolNode();
if (symbol && symbol->getConstArray().size() > 0)
size = symbol->getConstArray()[0].getIConst();
- } else if (expr->getAsUnaryNode() &&
- expr->getAsUnaryNode()->getOp() == glslang::EOpArrayLength &&
- expr->getAsUnaryNode()->getOperand()->getType().isCoopMat()) {
+ } else if (expr->getAsUnaryNode() && expr->getAsUnaryNode()->getOp() == glslang::EOpArrayLength &&
+ expr->getAsUnaryNode()->getOperand()->getType().isCoopMatNV()) {
isConst = true;
size = 1;
sizePair.node = expr->getAsUnaryNode();
@@ -4394,9 +4310,16 @@ void TParseContext::arraySizeCheck(const TSourceLoc& loc, TIntermTyped* expr, TA
return;
}
- if (size <= 0) {
- error(loc, sizeType, "", "must be a positive integer");
- return;
+ if (allowZero) {
+ if (size < 0) {
+ error(loc, sizeType, "", "must be a non-negative integer");
+ return;
+ }
+ } else {
+ if (size <= 0) {
+ error(loc, sizeType, "", "must be a positive integer");
+ return;
+ }
}
}
@@ -4494,8 +4417,6 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua
(qualifier.storage != EvqTemporary && qualifier.storage != EvqGlobal && qualifier.storage != EvqShared && qualifier.storage != EvqConst))
error(loc, "only outermost dimension of an array of arrays can be a specialization constant", "[]", "");
-#ifndef GLSLANG_WEB
-
// desktop always allows outer-dimension-unsized variable arrays,
if (!isEsProfile())
return;
@@ -4535,8 +4456,6 @@ void TParseContext::arraySizesCheck(const TSourceLoc& loc, const TQualifier& qua
break;
}
-#endif
-
// last member of ssbo block exception:
if (qualifier.storage == EvqBuffer && lastMember)
return;
@@ -4581,7 +4500,6 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie
if (symbolTable.atGlobalLevel())
trackLinkage(*symbol);
-#ifndef GLSLANG_WEB
if (! symbolTable.atBuiltInLevel()) {
if (isIoResizeArray(type)) {
ioArraySymbolResizeList.push_back(symbol);
@@ -4589,7 +4507,6 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie
} else
fixIoArraySize(loc, symbol->getWritableType());
}
-#endif
return;
}
@@ -4627,7 +4544,6 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie
return;
}
-#ifndef GLSLANG_WEB
if (existingType.isSizedArray()) {
// be more leniant for input arrays to geometry shaders and tessellation control outputs, where the redeclaration is the same size
if (! (isIoResizeArray(type) && existingType.getOuterArraySize() == type.getOuterArraySize()))
@@ -4641,11 +4557,8 @@ void TParseContext::declareArray(const TSourceLoc& loc, const TString& identifie
if (isIoResizeArray(type))
checkIoArraysConsistency(loc);
-#endif
}
-#ifndef GLSLANG_WEB
-
// Policy and error check for needing a runtime sized array.
void TParseContext::checkRuntimeSizable(const TSourceLoc& loc, const TIntermTyped& base)
{
@@ -4728,8 +4641,6 @@ void TParseContext::checkAndResizeMeshViewDim(const TSourceLoc& loc, TType& type
}
}
-#endif // GLSLANG_WEB
-
// Returns true if the first argument to the #line directive is the line number for the next line.
//
// Desktop, pre-version 3.30: "After processing this directive
@@ -4772,7 +4683,6 @@ void TParseContext::nonInitConstCheck(const TSourceLoc& loc, TString& identifier
TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TString& identifier,
const TQualifier& qualifier, const TShaderQualifiers& publicType)
{
-#ifndef GLSLANG_WEB
if (! builtInName(identifier) || symbolTable.atBuiltInLevel() || ! symbolTable.atGlobalLevel())
return nullptr;
@@ -4935,7 +4845,6 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS
return symbol;
}
-#endif
return nullptr;
}
@@ -4947,7 +4856,6 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS
void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName,
const TString* instanceName, TArraySizes* arraySizes)
{
-#ifndef GLSLANG_WEB
const char* feature = "built-in block redeclaration";
profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature);
profileRequires(loc, ~EEsProfile, 410, E_GL_ARB_separate_shader_objects, feature);
@@ -5163,7 +5071,6 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT
// Save it in the AST for linker use.
trackLinkage(*block);
-#endif // GLSLANG_WEB
}
void TParseContext::paramCheckFixStorage(const TSourceLoc& loc, const TStorageQualifier& qualifier, TType& type)
@@ -5192,7 +5099,6 @@ void TParseContext::paramCheckFixStorage(const TSourceLoc& loc, const TStorageQu
void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& qualifier, TType& type)
{
-#ifndef GLSLANG_WEB
if (qualifier.isMemory()) {
type.getQualifier().volatil = qualifier.volatil;
type.getQualifier().coherent = qualifier.coherent;
@@ -5206,7 +5112,6 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali
type.getQualifier().writeonly = qualifier.writeonly;
type.getQualifier().restrict = qualifier.restrict;
}
-#endif
if (qualifier.isAuxiliary() ||
qualifier.isInterpolation())
@@ -5223,7 +5128,6 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali
}
if (qualifier.isNonUniform())
type.getQualifier().nonUniform = qualifier.nonUniform;
-#ifndef GLSLANG_WEB
if (qualifier.isSpirvByReference())
type.getQualifier().setSpirvByReference();
if (qualifier.isSpirvLiteral()) {
@@ -5232,7 +5136,6 @@ void TParseContext::paramCheckFix(const TSourceLoc& loc, const TQualifier& quali
type.getQualifier().setSpirvLiteral();
else
error(loc, "cannot use spirv_literal qualifier", type.getBasicTypeString().c_str(), "");
-#endif
}
paramCheckFixStorage(loc, qualifier.storage, type);
@@ -5269,15 +5172,12 @@ void TParseContext::opaqueCheck(const TSourceLoc& loc, const TType& type, const
void TParseContext::referenceCheck(const TSourceLoc& loc, const TType& type, const char* op)
{
-#ifndef GLSLANG_WEB
if (containsFieldWithBasicType(type, EbtReference))
error(loc, "can't use with reference types", op, "");
-#endif
}
void TParseContext::storage16BitAssignmentCheck(const TSourceLoc& loc, const TType& type, const char* op)
{
-#ifndef GLSLANG_WEB
if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtFloat16))
requireFloat16Arithmetic(loc, op, "can't use with structs containing float16");
@@ -5307,7 +5207,6 @@ void TParseContext::storage16BitAssignmentCheck(const TSourceLoc& loc, const TTy
if (type.isArray() && type.getBasicType() == EbtUint8)
requireInt8Arithmetic(loc, op, "can't use with arrays containing uint8");
-#endif
}
void TParseContext::specializationCheck(const TSourceLoc& loc, const TType& type, const char* op)
@@ -5359,7 +5258,6 @@ void TParseContext::structTypeCheck(const TSourceLoc& /*loc*/, TPublicType& publ
//
void TParseContext::inductiveLoopCheck(const TSourceLoc& loc, TIntermNode* init, TIntermLoop* loop)
{
-#ifndef GLSLANG_WEB
// loop index init must exist and be a declaration, which shows up in the AST as an aggregate of size 1 of the declaration
bool badInit = false;
if (! init || ! init->getAsAggregate() || init->getAsAggregate()->getSequence().size() != 1)
@@ -5455,10 +5353,8 @@ void TParseContext::inductiveLoopCheck(const TSourceLoc& loc, TIntermNode* init,
// the body
inductiveLoopBodyCheck(loop->getBody(), loopIndex, symbolTable);
-#endif
}
-#ifndef GLSLANG_WEB
// Do limit checks for built-in arrays.
void TParseContext::arrayLimitCheck(const TSourceLoc& loc, const TString& identifier, int size)
{
@@ -5473,7 +5369,6 @@ void TParseContext::arrayLimitCheck(const TSourceLoc& loc, const TString& identi
else if (identifier.compare("gl_CullDistancePerViewNV") == 0)
limitCheck(loc, size, "gl_MaxCullDistances", "gl_CullDistancePerViewNV array size");
}
-#endif // GLSLANG_WEB
// See if the provided value is less than or equal to the symbol indicated by limit,
// which should be a constant in the symbol table.
@@ -5487,8 +5382,6 @@ void TParseContext::limitCheck(const TSourceLoc& loc, int value, const char* lim
error(loc, "must be less than or equal to", feature, "%s (%d)", limit, constArray[0].getIConst());
}
-#ifndef GLSLANG_WEB
-
//
// Do any additional error checking, etc., once we know the parsing is done.
//
@@ -5554,7 +5447,6 @@ void TParseContext::finish()
}
}
}
-#endif // GLSLANG_WEB
//
// Layout qualifier stuff.
@@ -5598,7 +5490,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
publicType.qualifier.layoutPacking = ElpStd140;
return;
}
-#ifndef GLSLANG_WEB
if (id == TQualifier::getLayoutPackingString(ElpStd430)) {
requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, "std430");
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 430, E_GL_ARB_shader_storage_buffer_object, "std430");
@@ -5896,7 +5787,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
publicType.shaderQualifiers.layoutPrimitiveCulling = true;
return;
}
-#endif
error(loc, "unrecognized layout identifier, or qualifier requires assignment (e.g., binding = 4)", id.c_str(), "");
}
@@ -5984,10 +5874,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
error(loc, "needs a literal integer", "set", "");
return;
} else if (id == "binding") {
-#ifndef GLSLANG_WEB
profileRequires(loc, ~EEsProfile, 420, E_GL_ARB_shading_language_420pack, "binding");
profileRequires(loc, EEsProfile, 310, nullptr, "binding");
-#endif
if ((unsigned int)value >= TQualifier::layoutBindingEnd)
error(loc, "binding is too large", id.c_str(), "");
else
@@ -6010,7 +5898,6 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
error(loc, "needs a literal integer", "constant_id", "");
return;
}
-#ifndef GLSLANG_WEB
if (id == "component") {
requireProfile(loc, ECoreProfile | ECompatibilityProfile, "component");
profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, "component");
@@ -6108,10 +5995,8 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
error(loc, "needs a literal integer", "buffer_reference_align", "");
return;
}
-#endif
switch (language) {
-#ifndef GLSLANG_WEB
case EShLangTessControl:
if (id == "vertices") {
if (value == 0)
@@ -6208,17 +6093,14 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
case EShLangTask:
// Fall through
-#endif
case EShLangCompute:
if (id.compare(0, 11, "local_size_") == 0) {
-#ifndef GLSLANG_WEB
if (language == EShLangMesh || language == EShLangTask) {
requireExtensions(loc, Num_AEP_mesh_shader, AEP_mesh_shader, "gl_WorkGroupSize");
} else {
profileRequires(loc, EEsProfile, 310, nullptr, "gl_WorkGroupSize");
profileRequires(loc, ~EEsProfile, 430, E_GL_ARB_compute_shader, "gl_WorkGroupSize");
}
-#endif
if (nonLiteral)
error(loc, "needs a literal integer", "local_size", "");
if (id.size() == 12 && value == 0) {
@@ -6285,7 +6167,6 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie
if (src.hasPacking())
dst.layoutPacking = src.layoutPacking;
-#ifndef GLSLANG_WEB
if (src.hasStream())
dst.layoutStream = src.layoutStream;
if (src.hasFormat())
@@ -6294,7 +6175,6 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie
dst.layoutXfbBuffer = src.layoutXfbBuffer;
if (src.hasBufferReferenceAlign())
dst.layoutBufferReferenceAlign = src.layoutBufferReferenceAlign;
-#endif
if (src.hasAlign())
dst.layoutAlign = src.layoutAlign;
@@ -6312,7 +6192,6 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie
if (src.hasSpecConstantId())
dst.layoutSpecConstantId = src.layoutSpecConstantId;
-#ifndef GLSLANG_WEB
if (src.hasComponent())
dst.layoutComponent = src.layoutComponent;
if (src.hasIndex())
@@ -6347,7 +6226,6 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie
dst.pervertexEXT = true;
if (src.layoutHitObjectShaderRecordNV)
dst.layoutHitObjectShaderRecordNV = true;
-#endif
}
}
@@ -6384,9 +6262,7 @@ void TParseContext::layoutObjectCheck(const TSourceLoc& loc, const TSymbol& symb
case EvqVaryingIn:
case EvqVaryingOut:
if (!type.getQualifier().isTaskMemory() &&
-#ifndef GLSLANG_WEB
!type.getQualifier().hasSprivDecorate() &&
-#endif
(type.getBasicType() != EbtBlock ||
(!(*type.getStruct())[0].type->getQualifier().hasLocation() &&
(*type.getStruct())[0].type->getQualifier().builtIn == EbvNone)))
@@ -6448,10 +6324,8 @@ void TParseContext::layoutMemberLocationArrayCheck(const TSourceLoc& loc, bool m
// Do layout error checking with respect to a type.
void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
{
-#ifndef GLSLANG_WEB
if (extensionTurnedOn(E_GL_EXT_spirv_intrinsics))
return; // Skip any check if GL_EXT_spirv_intrinsics is turned on
-#endif
const TQualifier& qualifier = type.getQualifier();
@@ -6500,7 +6374,6 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
case EvqtaskPayloadSharedEXT:
error(loc, "cannot apply to taskPayloadSharedEXT", "location", "");
break;
-#ifndef GLSLANG_WEB
case EvqPayload:
case EvqPayloadIn:
case EvqHitAttr:
@@ -6508,7 +6381,6 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
case EvqCallableDataIn:
case EvqHitObjectAttrNV:
break;
-#endif
case EvqTileImageEXT:
break;
default:
@@ -6526,7 +6398,6 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
error(loc, "fragment outputs or tileImageEXTs sharing the same location", "location", "%d must be the same basic type", repeated);
}
-#ifndef GLSLANG_WEB
if (qualifier.hasXfbOffset() && qualifier.hasXfbBuffer()) {
if (type.isUnsizedArray()) {
error(loc, "unsized array", "xfb_offset", "in buffer %d", qualifier.layoutXfbBuffer);
@@ -6555,7 +6426,6 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
if (! intermediate.setXfbBufferStride(qualifier.layoutXfbBuffer, qualifier.layoutXfbStride))
error(loc, "all stride settings must match for xfb buffer", "xfb_stride", "%d", qualifier.layoutXfbBuffer);
}
-#endif
if (qualifier.hasBinding()) {
// Binding checking, from the spec:
@@ -6575,16 +6445,12 @@ void TParseContext::layoutTypeCheck(const TSourceLoc& loc, const TType& type)
if (type.isSizedArray())
lastBinding += (type.getCumulativeArraySize() - 1);
else {
-#ifndef GLSLANG_WEB
warn(loc, "assuming binding count of one for compile-time checking of binding numbers for unsized array", "[]", "");
-#endif
}
}
}
-#ifndef GLSLANG_WEB
if (spvVersion.vulkan == 0 && lastBinding >= resources.maxCombinedTextureImageUnits)
error(loc, "sampler binding not less than gl_MaxCombinedTextureImageUnits", "binding", type.isArray() ? "(using array)" : "");
-#endif
}
if (type.isAtomic() && !spvVersion.vulkanRelaxed) {
if (qualifier.layoutBinding >= (unsigned int)resources.maxAtomicCounterBindings) {
@@ -6740,7 +6606,6 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier
// output block declarations, and output block member declarations."
switch (qualifier.storage) {
-#ifndef GLSLANG_WEB
case EvqVaryingIn:
{
const char* feature = "location qualifier on input";
@@ -6775,7 +6640,6 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier
}
break;
}
-#endif
case EvqUniform:
case EvqBuffer:
{
@@ -6854,7 +6718,6 @@ void TParseContext::layoutQualifierCheck(const TSourceLoc& loc, const TQualifier
// For places that can't have shader-level layout qualifiers
void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQualifiers& shaderQualifiers)
{
-#ifndef GLSLANG_WEB
const char* message = "can only apply to a standalone qualifier";
if (shaderQualifiers.geometry != ElgNone)
@@ -6905,14 +6768,12 @@ void TParseContext::checkNoShaderLayouts(const TSourceLoc& loc, const TShaderQua
error(loc, message, TQualifier::getInterlockOrderingString(shaderQualifiers.interlockOrdering), "");
if (shaderQualifiers.layoutPrimitiveCulling)
error(loc, "can only be applied as standalone", "primitive_culling", "");
-#endif
}
// Correct and/or advance an object's offset layout qualifier.
void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol)
{
const TQualifier& qualifier = symbol.getType().getQualifier();
-#ifndef GLSLANG_WEB
if (symbol.getType().isAtomic()) {
if (qualifier.hasBinding() && (int)qualifier.layoutBinding < resources.maxAtomicCounterBindings) {
@@ -6946,7 +6807,6 @@ void TParseContext::fixOffset(const TSourceLoc& loc, TSymbol& symbol)
atomicUintOffsets[qualifier.layoutBinding] = offset + numOffsets;
}
}
-#endif
}
//
@@ -6961,10 +6821,6 @@ const TFunction* TParseContext::findFunction(const TSourceLoc& loc, const TFunct
return nullptr;
}
-#ifdef GLSLANG_WEB
- return findFunctionExact(loc, call, builtIn);
-#endif
-
const TFunction* function = nullptr;
// debugPrintfEXT has var args and is in the symbol table as "debugPrintfEXT()",
@@ -7291,7 +7147,6 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T
{
TIntermTyped* result = nullptr;
-#ifndef GLSLANG_WEB
if (function->getBuiltInOp() != EOpNull) {
return nullptr;
}
@@ -7342,7 +7197,6 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T
result = arguments->getAsTyped();
}
}
-#endif
return result;
}
@@ -7351,7 +7205,6 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T
// to establish defaults.
void TParseContext::declareTypeDefaults(const TSourceLoc& loc, const TPublicType& publicType)
{
-#ifndef GLSLANG_WEB
if (publicType.basicType == EbtAtomicUint && publicType.qualifier.hasBinding()) {
if (publicType.qualifier.layoutBinding >= (unsigned int)resources.maxAtomicCounterBindings) {
error(loc, "atomic_uint binding is too large", "binding", "");
@@ -7368,7 +7221,41 @@ void TParseContext::declareTypeDefaults(const TSourceLoc& loc, const TPublicType
if (publicType.qualifier.hasLayout() && !publicType.qualifier.hasBufferReference())
warn(loc, "useless application of layout qualifier", "layout", "");
-#endif
+}
+
+void TParseContext::coopMatTypeParametersCheck(const TSourceLoc& loc, const TPublicType& publicType)
+{
+ if (parsingBuiltins)
+ return;
+ if (publicType.isCoopmatKHR()) {
+ if (publicType.typeParameters == nullptr) {
+ error(loc, "coopmat missing type parameters", "", "");
+ return;
+ }
+ switch (publicType.typeParameters->basicType) {
+ case EbtFloat:
+ case EbtFloat16:
+ case EbtInt:
+ case EbtInt8:
+ case EbtInt16:
+ case EbtUint:
+ case EbtUint8:
+ case EbtUint16:
+ break;
+ default:
+ error(loc, "coopmat invalid basic type", TType::getBasicString(publicType.typeParameters->basicType), "");
+ break;
+ }
+ if (publicType.typeParameters->arraySizes->getNumDims() != 4) {
+ error(loc, "coopmat incorrect number of type parameters", "", "");
+ return;
+ }
+ int use = publicType.typeParameters->arraySizes->getDimSize(3);
+ if (use < 0 || use > 2) {
+ error(loc, "coopmat invalid matrix Use", "", "");
+ return;
+ }
+ }
}
bool TParseContext::vkRelaxedRemapUniformVariable(const TSourceLoc& loc, TString& identifier, const TPublicType&,
@@ -7376,11 +7263,7 @@ bool TParseContext::vkRelaxedRemapUniformVariable(const TSourceLoc& loc, TString
{
if (parsingBuiltins || symbolTable.atBuiltInLevel() || !symbolTable.atGlobalLevel() ||
type.getQualifier().storage != EvqUniform ||
- !(type.containsNonOpaque()
-#ifndef GLSLANG_WEB
- || type.getBasicType() == EbtAtomicUint
-#endif
- )) {
+ !(type.containsNonOpaque()|| type.getBasicType() == EbtAtomicUint)) {
return false;
}
@@ -7409,7 +7292,6 @@ bool TParseContext::vkRelaxedRemapUniformVariable(const TSourceLoc& loc, TString
int bufferBinding = TQualifier::layoutBindingEnd;
TVariable* updatedBlock = nullptr;
-#ifndef GLSLANG_WEB
// Convert atomic_uint into members of a buffer block
if (type.isAtomic()) {
type.setBasicType(EbtUint);
@@ -7425,7 +7307,6 @@ bool TParseContext::vkRelaxedRemapUniformVariable(const TSourceLoc& loc, TString
growAtomicCounterBlock(bufferBinding, loc, type, identifier, nullptr);
updatedBlock = atomicCounterBuffers[bufferBinding];
}
-#endif
if (!updatedBlock) {
growGlobalUniformBlock(loc, type, identifier, nullptr);
@@ -7486,29 +7367,43 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
}
- if (type.isCoopMat()) {
+ if (type.isCoopMatKHR()) {
intermediate.setUseVulkanMemoryModel();
intermediate.setUseStorageBuffer();
- if (!publicType.typeParameters || publicType.typeParameters->getNumDims() != 4) {
+ if (!publicType.typeParameters || !publicType.typeParameters->arraySizes ||
+ publicType.typeParameters->arraySizes->getNumDims() != 3) {
+ error(loc, "unexpected number type parameters", identifier.c_str(), "");
+ }
+ if (publicType.typeParameters) {
+ if (!isTypeFloat(publicType.typeParameters->basicType) && !isTypeInt(publicType.typeParameters->basicType)) {
+ error(loc, "expected 8, 16, 32, or 64 bit signed or unsigned integer or 16, 32, or 64 bit float type", identifier.c_str(), "");
+ }
+ }
+ }
+ else if (type.isCoopMatNV()) {
+ intermediate.setUseVulkanMemoryModel();
+ intermediate.setUseStorageBuffer();
+
+ if (!publicType.typeParameters || publicType.typeParameters->arraySizes->getNumDims() != 4) {
error(loc, "expected four type parameters", identifier.c_str(), "");
}
if (publicType.typeParameters) {
if (isTypeFloat(publicType.basicType) &&
- publicType.typeParameters->getDimSize(0) != 16 &&
- publicType.typeParameters->getDimSize(0) != 32 &&
- publicType.typeParameters->getDimSize(0) != 64) {
+ publicType.typeParameters->arraySizes->getDimSize(0) != 16 &&
+ publicType.typeParameters->arraySizes->getDimSize(0) != 32 &&
+ publicType.typeParameters->arraySizes->getDimSize(0) != 64) {
error(loc, "expected 16, 32, or 64 bits for first type parameter", identifier.c_str(), "");
}
if (isTypeInt(publicType.basicType) &&
- publicType.typeParameters->getDimSize(0) != 8 &&
- publicType.typeParameters->getDimSize(0) != 32) {
- error(loc, "expected 8 or 32 bits for first type parameter", identifier.c_str(), "");
+ publicType.typeParameters->arraySizes->getDimSize(0) != 8 &&
+ publicType.typeParameters->arraySizes->getDimSize(0) != 16 &&
+ publicType.typeParameters->arraySizes->getDimSize(0) != 32) {
+ error(loc, "expected 8, 16, or 32 bits for first type parameter", identifier.c_str(), "");
}
}
-
} else {
- if (publicType.typeParameters && publicType.typeParameters->getNumDims() != 0) {
+ if (publicType.typeParameters && publicType.typeParameters->arraySizes->getNumDims() != 0) {
error(loc, "unexpected type parameters", identifier.c_str(), "");
}
}
@@ -7523,11 +7418,9 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
samplerCheck(loc, type, identifier, initializer);
transparentOpaqueCheck(loc, type, identifier);
-#ifndef GLSLANG_WEB
atomicUintCheck(loc, type, identifier);
accStructCheck(loc, type, identifier);
checkAndResizeMeshViewDim(loc, type, /*isBlockMember*/ false);
-#endif
if (type.getQualifier().storage == EvqConst && type.containsReference()) {
error(loc, "variables with reference type can't have qualifier 'const'", "qualifier", "");
}
@@ -7630,14 +7523,12 @@ TIntermNode* TParseContext::declareVariable(const TSourceLoc& loc, TString& iden
// Pick up global defaults from the provide global defaults into dst.
void TParseContext::inheritGlobalDefaults(TQualifier& dst) const
{
-#ifndef GLSLANG_WEB
if (dst.storage == EvqVaryingOut) {
if (! dst.hasStream() && language == EShLangGeometry)
dst.layoutStream = globalOutputDefaults.layoutStream;
if (! dst.hasXfbBuffer())
dst.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer;
}
-#endif
}
//
@@ -7666,9 +7557,7 @@ TVariable* TParseContext::declareNonArray(const TSourceLoc& loc, const TString&
// make a new variable
TVariable* variable = new TVariable(&identifier, type);
-#ifndef GLSLANG_WEB
ioArrayCheck(loc, type, identifier);
-#endif
// add variable to symbol table
if (symbolTable.insert(*variable)) {
@@ -7745,9 +7634,7 @@ TIntermNode* TParseContext::executeInitializer(const TSourceLoc& loc, TIntermTyp
TType skeletalType;
skeletalType.shallowCopy(variable->getType());
skeletalType.getQualifier().makeTemporary();
-#ifndef GLSLANG_WEB
initializer = convertInitializerList(loc, skeletalType, initializer);
-#endif
if (! initializer) {
// error recovery; don't leave const without constant values
if (qualifier == EvqConst)
@@ -8149,8 +8036,6 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
intermediate.addBuiltInFunctionCall(node->getLoc(), EOpPackUint2x32, true, node, type);
return newNode;
}
-#ifndef GLSLANG_WEB
-
case EOpConstructDVec2:
case EOpConstructDVec3:
case EOpConstructDVec4:
@@ -8336,14 +8221,18 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
return nullptr;
}
- case EOpConstructCooperativeMatrix:
+ case EOpConstructCooperativeMatrixNV:
+ case EOpConstructCooperativeMatrixKHR:
+ if (node->getType() == type) {
+ return node;
+ }
if (!node->getType().isCoopMat()) {
if (type.getBasicType() != node->getType().getBasicType()) {
node = intermediate.addConversion(type.getBasicType(), node);
if (node == nullptr)
return nullptr;
}
- node = intermediate.setAggregateOperator(node, EOpConstructCooperativeMatrix, type, node->getLoc());
+ node = intermediate.setAggregateOperator(node, op, type, node->getLoc());
} else {
TOperator op = EOpNull;
switch (type.getBasicType()) {
@@ -8356,6 +8245,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
case EbtFloat16: op = EOpConvFloat16ToInt; break;
case EbtUint8: op = EOpConvUint8ToInt; break;
case EbtInt8: op = EOpConvInt8ToInt; break;
+ case EbtUint16: op = EOpConvUint16ToInt; break;
+ case EbtInt16: op = EOpConvInt16ToInt; break;
case EbtUint: op = EOpConvUintToInt; break;
default: assert(0);
}
@@ -8366,8 +8257,33 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
case EbtFloat16: op = EOpConvFloat16ToUint; break;
case EbtUint8: op = EOpConvUint8ToUint; break;
case EbtInt8: op = EOpConvInt8ToUint; break;
+ case EbtUint16: op = EOpConvUint16ToUint; break;
+ case EbtInt16: op = EOpConvInt16ToUint; break;
case EbtInt: op = EOpConvIntToUint; break;
- case EbtUint: op = EOpConvUintToInt8; break;
+ default: assert(0);
+ }
+ break;
+ case EbtInt16:
+ switch (node->getType().getBasicType()) {
+ case EbtFloat: op = EOpConvFloatToInt16; break;
+ case EbtFloat16: op = EOpConvFloat16ToInt16; break;
+ case EbtUint8: op = EOpConvUint8ToInt16; break;
+ case EbtInt8: op = EOpConvInt8ToInt16; break;
+ case EbtUint16: op = EOpConvUint16ToInt16; break;
+ case EbtInt: op = EOpConvIntToInt16; break;
+ case EbtUint: op = EOpConvUintToInt16; break;
+ default: assert(0);
+ }
+ break;
+ case EbtUint16:
+ switch (node->getType().getBasicType()) {
+ case EbtFloat: op = EOpConvFloatToUint16; break;
+ case EbtFloat16: op = EOpConvFloat16ToUint16; break;
+ case EbtUint8: op = EOpConvUint8ToUint16; break;
+ case EbtInt8: op = EOpConvInt8ToUint16; break;
+ case EbtInt16: op = EOpConvInt16ToUint16; break;
+ case EbtInt: op = EOpConvIntToUint16; break;
+ case EbtUint: op = EOpConvUintToUint16; break;
default: assert(0);
}
break;
@@ -8376,6 +8292,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
case EbtFloat: op = EOpConvFloatToInt8; break;
case EbtFloat16: op = EOpConvFloat16ToInt8; break;
case EbtUint8: op = EOpConvUint8ToInt8; break;
+ case EbtInt16: op = EOpConvInt16ToInt8; break;
+ case EbtUint16: op = EOpConvUint16ToInt8; break;
case EbtInt: op = EOpConvIntToInt8; break;
case EbtUint: op = EOpConvUintToInt8; break;
default: assert(0);
@@ -8386,6 +8304,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
case EbtFloat: op = EOpConvFloatToUint8; break;
case EbtFloat16: op = EOpConvFloat16ToUint8; break;
case EbtInt8: op = EOpConvInt8ToUint8; break;
+ case EbtInt16: op = EOpConvInt16ToUint8; break;
+ case EbtUint16: op = EOpConvUint16ToUint8; break;
case EbtInt: op = EOpConvIntToUint8; break;
case EbtUint: op = EOpConvUintToUint8; break;
default: assert(0);
@@ -8396,6 +8316,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
case EbtFloat16: op = EOpConvFloat16ToFloat; break;
case EbtInt8: op = EOpConvInt8ToFloat; break;
case EbtUint8: op = EOpConvUint8ToFloat; break;
+ case EbtInt16: op = EOpConvInt16ToFloat; break;
+ case EbtUint16: op = EOpConvUint16ToFloat; break;
case EbtInt: op = EOpConvIntToFloat; break;
case EbtUint: op = EOpConvUintToFloat; break;
default: assert(0);
@@ -8406,6 +8328,8 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
case EbtFloat: op = EOpConvFloatToFloat16; break;
case EbtInt8: op = EOpConvInt8ToFloat16; break;
case EbtUint8: op = EOpConvUint8ToFloat16; break;
+ case EbtInt16: op = EOpConvInt16ToFloat16; break;
+ case EbtUint16: op = EOpConvUint16ToFloat16; break;
case EbtInt: op = EOpConvIntToFloat16; break;
case EbtUint: op = EOpConvUintToFloat16; break;
default: assert(0);
@@ -8434,7 +8358,6 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
type);
} else
return nullptr;
-#endif // GLSLANG_WEB
default:
error(loc, "unsupported construction", "", "");
@@ -8481,7 +8404,6 @@ TIntermTyped* TParseContext::constructAggregate(TIntermNode* node, const TType&
// If a memory qualifier is present in 'to', also make it present in 'from'.
void TParseContext::inheritMemoryQualifiers(const TQualifier& from, TQualifier& to)
{
-#ifndef GLSLANG_WEB
if (from.isReadOnly())
to.readonly = from.readonly;
if (from.isWriteOnly())
@@ -8492,7 +8414,6 @@ void TParseContext::inheritMemoryQualifiers(const TQualifier& from, TQualifier&
to.volatil = from.volatil;
if (from.restrict)
to.restrict = from.restrict;
-#endif
}
//
@@ -8545,7 +8466,6 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
error(memberLoc, "member storage qualifier cannot contradict block storage qualifier", memberType.getFieldName().c_str(), "");
memberQualifier.storage = currentBlockQualifier.storage;
globalQualifierFixCheck(memberLoc, memberQualifier);
-#ifndef GLSLANG_WEB
inheritMemoryQualifiers(currentBlockQualifier, memberQualifier);
if (currentBlockQualifier.perPrimitiveNV)
memberQualifier.perPrimitiveNV = currentBlockQualifier.perPrimitiveNV;
@@ -8559,7 +8479,6 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
error(memberLoc, "member cannot have a spirv_storage_class qualifier", memberType.getFieldName().c_str(), "");
if (memberQualifier.hasSprivDecorate() && !memberQualifier.getSpirvDecorate().decorateIds.empty())
error(memberLoc, "member cannot have a spirv_decorate_id qualifier", memberType.getFieldName().c_str(), "");
-#endif
if ((currentBlockQualifier.storage == EvqUniform || currentBlockQualifier.storage == EvqBuffer) && (memberQualifier.isInterpolation() || memberQualifier.isAuxiliary()))
error(memberLoc, "member of uniform or buffer block cannot have an auxiliary or interpolation qualifier", memberType.getFieldName().c_str(), "");
if (memberType.isArray())
@@ -8639,7 +8558,6 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
for (unsigned int member = 0; member < typeList.size(); ++member) {
TQualifier& memberQualifier = typeList[member].type->getQualifier();
const TSourceLoc& memberLoc = typeList[member].loc;
-#ifndef GLSLANG_WEB
if (memberQualifier.hasStream()) {
if (defaultQualification.layoutStream != memberQualifier.layoutStream)
error(memberLoc, "member cannot contradict block", "stream", "");
@@ -8653,14 +8571,12 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
if (defaultQualification.layoutXfbBuffer != memberQualifier.layoutXfbBuffer)
error(memberLoc, "member cannot contradict block (or what block inherited from global)", "xfb_buffer", "");
}
-#endif
if (memberQualifier.hasPacking())
error(memberLoc, "member of block cannot have a packing layout qualifier", typeList[member].type->getFieldName().c_str(), "");
if (memberQualifier.hasLocation()) {
const char* feature = "location on block member";
switch (currentBlockQualifier.storage) {
-#ifndef GLSLANG_WEB
case EvqVaryingIn:
case EvqVaryingOut:
requireProfile(memberLoc, ECoreProfile | ECompatibilityProfile | EEsProfile, feature);
@@ -8668,7 +8584,6 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
profileRequires(memberLoc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature);
memberWithLocation = true;
break;
-#endif
default:
error(memberLoc, "can only use in an in/out block", feature, "");
break;
@@ -8696,7 +8611,6 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
layoutMemberLocationArrayCheck(loc, memberWithLocation, arraySizes);
-#ifndef GLSLANG_WEB
// Ensure that the block has an XfbBuffer assigned. This is needed
// because if the block has a XfbOffset assigned, then it is
// assumed that it has implicitly assigned the current global
@@ -8706,7 +8620,6 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
if (!currentBlockQualifier.hasXfbBuffer() && currentBlockQualifier.hasXfbOffset())
currentBlockQualifier.layoutXfbBuffer = globalOutputDefaults.layoutXfbBuffer;
}
-#endif
// Process the members
fixBlockLocations(loc, currentBlockQualifier, typeList, memberWithLocation, memberWithoutLocation);
@@ -8717,13 +8630,11 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
for (unsigned int member = 0; member < typeList.size(); ++member)
layoutTypeCheck(typeList[member].loc, *typeList[member].type);
-#ifndef GLSLANG_WEB
if (memberWithPerViewQualifier) {
for (unsigned int member = 0; member < typeList.size(); ++member) {
checkAndResizeMeshViewDim(typeList[member].loc, *typeList[member].type, /*isBlockMember*/ true);
}
}
-#endif
// reverse merge, so that currentBlockQualifier now has all layout information
// (can't use defaultQualification directly, it's missing other non-layout-default-class qualifiers)
@@ -8737,7 +8648,6 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
if (arraySizes != nullptr)
blockType.transferArraySizes(arraySizes);
-#ifndef GLSLANG_WEB
if (arraySizes == nullptr)
ioArrayCheck(loc, blockType, instanceName ? *instanceName : *blockName);
if (currentBlockQualifier.hasBufferReference()) {
@@ -8764,9 +8674,7 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
if (!instanceName) {
return;
}
- } else
-#endif
- {
+ } else {
//
// Don't make a user-defined type out of block name; that will cause an error
// if the same block name gets reused in a different interface.
@@ -8814,14 +8722,12 @@ void TParseContext::declareBlock(const TSourceLoc& loc, TTypeList& typeList, con
// Check for general layout qualifier errors
layoutObjectCheck(loc, variable);
-#ifndef GLSLANG_WEB
// fix up
if (isIoResizeArray(blockType)) {
ioArraySymbolResizeList.push_back(&variable);
checkIoArraysConsistency(loc, true);
} else
fixIoArraySize(loc, variable.getWritableType());
-#endif
// Save it in the AST for linker use.
trackLinkage(variable);
@@ -8886,7 +8792,6 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q
}
profileRequires(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, 0, E_GL_EXT_shared_memory_block, "shared block");
break;
-#ifndef GLSLANG_WEB
case EvqPayload:
profileRequires(loc, ~EEsProfile, 460, 2, extsrt, "rayPayloadNV block");
requireStage(loc, (EShLanguageMask)(EShLangRayGenMask | EShLangAnyHitMask | EShLangClosestHitMask | EShLangMissMask),
@@ -8914,7 +8819,6 @@ void TParseContext::blockStageIoCheck(const TSourceLoc& loc, const TQualifier& q
profileRequires(loc, ~EEsProfile, 460, E_GL_NV_shader_invocation_reorder, "hitObjectAttributeNV block");
requireStage(loc, (EShLanguageMask)(EShLangRayGenMask | EShLangClosestHitMask | EShLangMissMask), "hitObjectAttributeNV block");
break;
-#endif
default:
error(loc, "only uniform, buffer, in, or out blocks are supported", blockName->c_str(), "");
break;
@@ -9003,7 +8907,6 @@ void TParseContext::fixBlockLocations(const TSourceLoc& loc, TQualifier& qualifi
void TParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList)
{
-#ifndef GLSLANG_WEB
// "If a block is qualified with xfb_offset, all its
// members are assigned transform feedback buffer offsets. If a block is not qualified with xfb_offset, any
// members of that block not qualified with an xfb_offset will not be assigned transform feedback buffer
@@ -9037,7 +8940,6 @@ void TParseContext::fixXfbOffsets(TQualifier& qualifier, TTypeList& typeList)
// The above gave all block members an offset, so we can take it off the block now,
// which will avoid double counting the offset usage.
qualifier.layoutXfbOffset = TQualifier::layoutXfbOffsetEnd;
-#endif
}
// Calculate and save the offset of each block member, using the recursively
@@ -9214,7 +9116,7 @@ void TParseContext::addQualifierToExisting(const TSourceLoc& loc, TQualifier qua
// TParseContext::declareBlock.
if (!symbol && qualifier.hasBufferReference()) {
TTypeList typeList;
- TType blockType(&typeList, identifier, qualifier);;
+ TType blockType(&typeList, identifier, qualifier);
TType blockNameType(EbtReference, blockType, identifier);
TVariable* blockNameVar = new TVariable(&identifier, blockNameType, true);
if (! symbolTable.insert(*blockNameVar)) {
@@ -9293,7 +9195,6 @@ void TParseContext::invariantCheck(const TSourceLoc& loc, const TQualifier& qual
//
void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, const TPublicType& publicType)
{
-#ifndef GLSLANG_WEB
if (publicType.shaderQualifiers.vertices != TQualifier::layoutNotSet) {
assert(language == EShLangTessControl || language == EShLangGeometry || language == EShLangMesh);
const char* id = (language == EShLangTessControl) ? "vertices" : "max_vertices";
@@ -9385,7 +9286,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
else
error(loc, "can only apply to 'in'", "point_mode", "");
}
-#endif
+
for (int i = 0; i < 3; ++i) {
if (publicType.shaderQualifiers.localSizeNotDefault[i]) {
if (publicType.qualifier.storage == EvqVaryingIn) {
@@ -9402,9 +9303,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
}
if (intermediate.getLocalSize(i) > (unsigned int)max)
error(loc, "too large; see gl_MaxComputeWorkGroupSize", "local_size", "");
- }
-#ifndef GLSLANG_WEB
- else if (language == EShLangMesh) {
+ } else if (language == EShLangMesh) {
switch (i) {
case 0:
max = extensionTurnedOn(E_GL_EXT_mesh_shader) ?
@@ -9454,9 +9353,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
"gl_MaxTaskWorkGroupSizeEXT" : "gl_MaxTaskWorkGroupSizeNV");
error(loc, maxsErrtring.c_str(), "local_size", "");
}
- }
-#endif
- else {
+ } else {
assert(0);
}
@@ -9481,7 +9378,6 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
}
}
-#ifndef GLSLANG_WEB
if (publicType.shaderQualifiers.earlyFragmentTests) {
if (publicType.qualifier.storage == EvqVaryingIn)
intermediate.setEarlyFragmentTests();
@@ -9577,7 +9473,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
// Exit early as further checks are not valid
return;
}
-#endif
+
const TQualifier& qualifier = publicType.qualifier;
if (qualifier.isAuxiliary() ||
@@ -9610,7 +9506,6 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
case EvqVaryingIn:
break;
case EvqVaryingOut:
-#ifndef GLSLANG_WEB
if (qualifier.hasStream())
globalOutputDefaults.layoutStream = qualifier.layoutStream;
if (qualifier.hasXfbBuffer())
@@ -9619,7 +9514,6 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
if (! intermediate.setXfbBufferStride(globalOutputDefaults.layoutXfbBuffer, qualifier.layoutXfbStride))
error(loc, "all stride settings must match for xfb buffer", "xfb_stride", "%d", qualifier.layoutXfbBuffer);
}
-#endif
break;
case EvqShared:
if (qualifier.hasMatrix())