diff --git a/Test/baseResults/330.frag.out b/Test/baseResults/330.frag.out index d9d0bbf3dcb8abbb223408a67d2bcf74f75d35f0..dc93262ff8da56896b121c6d9f2a5e22c24a7923 100644 --- a/Test/baseResults/330.frag.out +++ b/Test/baseResults/330.frag.out @@ -1,4 +1,4 @@ -Warning, version 330 is not yet complete; some version-specific are present, but many are missing. +Warning, version 330 is not yet complete; some version-specific features are present, but many are missing. WARNING: 0:6: varying deprecated in version 130; may be removed in future release 0:? Sequence 0:8 Function Definition: main( (void) diff --git a/Test/baseResults/330comp.frag.out b/Test/baseResults/330comp.frag.out index 9a76d4f4bc7bf51762105774c7936e7f6b9d0f31..d9c163c9edbd5335b5507ac9d5b0def4f6966231 100644 --- a/Test/baseResults/330comp.frag.out +++ b/Test/baseResults/330comp.frag.out @@ -1,4 +1,4 @@ -Warning, version 330 is not yet complete; some version-specific are present, but many are missing. +Warning, version 330 is not yet complete; some version-specific features are present, but many are missing. 0:? Sequence 0:8 Function Definition: main( (void) 0:8 Function Parameters: diff --git a/Test/baseResults/400.frag.out b/Test/baseResults/400.frag.out index eec0658cdf07c69c9bc7bbdd8ffcfefb70e82100..16a0d09f7434ea9ba9bc9b46ccddd64ad6eb2e59 100644 --- a/Test/baseResults/400.frag.out +++ b/Test/baseResults/400.frag.out @@ -1,4 +1,4 @@ -Warning, version 330 is not yet complete; some version-specific are present, but many are missing. +Warning, version 330 is not yet complete; some version-specific features are present, but many are missing. ERROR: 0:11: 'variable indexing sampler array' : not supported for this version or the enabled extensions ERROR: 1 compilation errors. No code generated. diff --git a/Test/baseResults/400.geom.out b/Test/baseResults/400.geom.out index d27f7ad91528d12c6ae4abeea29ad01c24a5485a..151563de2ac9d4d61694a584b74f2468ee38e34d 100644 --- a/Test/baseResults/400.geom.out +++ b/Test/baseResults/400.geom.out @@ -1,4 +1,4 @@ -Warning, version 400 is not yet complete; some version-specific are present, but many are missing. +Warning, version 400 is not yet complete; some version-specific features are present, but many are missing. 0:? Sequence 0:3 Function Definition: main( (void) 0:3 Function Parameters: diff --git a/Test/baseResults/400.tesc.out b/Test/baseResults/400.tesc.out index f356a5fe5a1fd56851029822115525d0bee60a2f..e02d4d1925170a43adfec057a6042593f9c76c2e 100644 --- a/Test/baseResults/400.tesc.out +++ b/Test/baseResults/400.tesc.out @@ -1,4 +1,4 @@ -Warning, version 400 is not yet complete; some version-specific are present, but many are missing. +Warning, version 400 is not yet complete; some version-specific features are present, but many are missing. 0:? Sequence 0:3 Function Definition: main( (void) 0:3 Function Parameters: diff --git a/Test/baseResults/400.tese.out b/Test/baseResults/400.tese.out index e369c8ff77de515c98f830899a92d3e20ea091a7..27c716cca0a3d238c8c1737a49a37212ccdf241b 100644 --- a/Test/baseResults/400.tese.out +++ b/Test/baseResults/400.tese.out @@ -1,4 +1,4 @@ -Warning, version 400 is not yet complete; some version-specific are present, but many are missing. +Warning, version 400 is not yet complete; some version-specific features are present, but many are missing. ERROR: 0:5: 'barrier' : no matching overloaded function found ERROR: 1 compilation errors. No code generated. diff --git a/Test/baseResults/420.tese.out b/Test/baseResults/420.tese.out index bf47c37001c5892df1c45aeec684365bb36694b3..951bfb5b4d1c760f466814b1e80e7fdb1d08b23a 100644 --- a/Test/baseResults/420.tese.out +++ b/Test/baseResults/420.tese.out @@ -1,4 +1,4 @@ -Warning, version 420 is not yet complete; some version-specific are present, but many are missing. +Warning, version 420 is not yet complete; some version-specific features are present, but many are missing. 0:? Sequence 0:3 Function Definition: main( (void) 0:3 Function Parameters: diff --git a/Test/baseResults/420.vert.out b/Test/baseResults/420.vert.out index 373af19fe7247a19f91615479c29c85584ce6ab4..6703561aa7dc4d8268a60c177281f8c6b2690e31 100644 --- a/Test/baseResults/420.vert.out +++ b/Test/baseResults/420.vert.out @@ -1,4 +1,4 @@ -Warning, version 420 is not yet complete; some version-specific are present, but many are missing. +Warning, version 420 is not yet complete; some version-specific features are present, but many are missing. WARNING: 0:3: varying deprecated in version 130; may be removed in future release ERROR: 0:3: 'varying' : no longer supported in core profile; removed in version 420 ERROR: 0:7: '' : vertex input cannot be further qualified diff --git a/Test/baseResults/430.comp.out b/Test/baseResults/430.comp.out index 834791b9d2bc02e55af8a4fd5a321c1f973d17fe..fedcba85681cae1a261c386ef69fda9b21226e4d 100644 --- a/Test/baseResults/430.comp.out +++ b/Test/baseResults/430.comp.out @@ -1,4 +1,4 @@ -Warning, version 430 is not yet complete; some version-specific are present, but many are missing. +Warning, version 430 is not yet complete; some version-specific features are present, but many are missing. 0:? Sequence 0:3 Function Definition: main( (void) 0:3 Function Parameters: diff --git a/Test/baseResults/430scope.vert.out b/Test/baseResults/430scope.vert.out index 4c600de28b52ea9da2b1935c3fc4158dd01d2fa0..bd00995909bdf2481b5609a476f699177f0485e9 100644 --- a/Test/baseResults/430scope.vert.out +++ b/Test/baseResults/430scope.vert.out @@ -1,4 +1,4 @@ -Warning, version 430 is not yet complete; some version-specific are present, but many are missing. +Warning, version 430 is not yet complete; some version-specific features are present, but many are missing. ERROR: 0:5: 'a' : redefinition ERROR: 0:17: 'b' : illegal redeclaration ERROR: 0:19: 'f' : redefinition diff --git a/Test/baseResults/comment.frag.out b/Test/baseResults/comment.frag.out index 5084e36d9f34ad7e2f4b5725a379a5229285dfda..48e85c65509f511f038f8e3e95ff10c3df71f52f 100644 --- a/Test/baseResults/comment.frag.out +++ b/Test/baseResults/comment.frag.out @@ -1,4 +1,4 @@ -Warning, version 430 is not yet complete; some version-specific are present, but many are missing. +Warning, version 430 is not yet complete; some version-specific features are present, but many are missing. 0:? Sequence 0:17 Function Definition: main( (void) 0:17 Function Parameters: diff --git a/Test/baseResults/constErrors.frag.out b/Test/baseResults/constErrors.frag.out index 14c9a7ab8c1cd79c536f2efef641d8ce3070d31d..bd249e2fc1af5939b156f18fae784a6dba8c75c9 100644 --- a/Test/baseResults/constErrors.frag.out +++ b/Test/baseResults/constErrors.frag.out @@ -1,4 +1,4 @@ -Warning, version 330 is not yet complete; some version-specific are present, but many are missing. +Warning, version 330 is not yet complete; some version-specific features are present, but many are missing. ERROR: 0:14: '=' : assigning non-constant to 'const int' ERROR: 0:17: '' : constant expression required ERROR: 0:17: '' : array size must be a constant integer expression diff --git a/Test/baseResults/constFold.frag.out b/Test/baseResults/constFold.frag.out index 22cf44fa8dd52dd815b28cecea30653aa613524f..8b227c024cd12d1c351e67c12f6c1feb09687c38 100644 --- a/Test/baseResults/constFold.frag.out +++ b/Test/baseResults/constFold.frag.out @@ -1,4 +1,4 @@ -Warning, version 430 is not yet complete; some version-specific are present, but many are missing. +Warning, version 430 is not yet complete; some version-specific features are present, but many are missing. 0:? Sequence 0:28 Function Definition: main( (void) 0:28 Function Parameters: diff --git a/Test/baseResults/dce.frag.out b/Test/baseResults/dce.frag.out index 9d800f66719f46f5067110a4e0bf8ff51c056ba6..2b948b6cc9c94c3489dfd1221dee27b3f68366f6 100644 --- a/Test/baseResults/dce.frag.out +++ b/Test/baseResults/dce.frag.out @@ -1,4 +1,4 @@ -Warning, version 400 is not yet complete; some version-specific are present, but many are missing. +Warning, version 400 is not yet complete; some version-specific features are present, but many are missing. 0:? Sequence 0:5 Sequence 0:5 move second child to first child (int) diff --git a/Test/baseResults/mains1.frag.out b/Test/baseResults/mains1.frag.out index b8b4147b6d413d53057a768012df79f94251a00e..6acc69d5e74079a28d7b8c97806c552c210df989 100644 --- a/Test/baseResults/mains1.frag.out +++ b/Test/baseResults/mains1.frag.out @@ -16,7 +16,7 @@ Warning, version 110 is not yet complete; most features are present, but a few a noMain1.geom ERROR: #version: geometry shaders require non-es profile and version 150 or above -Warning, version 150 is not yet complete; some version-specific are present, but many are missing. +Warning, version 150 is not yet complete; some version-specific features are present, but many are missing. ERROR: 1 compilation errors. No code generated. @@ -26,7 +26,7 @@ ERROR: node is still EOpNull! 0:? Linker Objects noMain2.geom -Warning, version 150 is not yet complete; some version-specific are present, but many are missing. +Warning, version 150 is not yet complete; some version-specific features are present, but many are missing. 0:? Sequence 0:3 Function Definition: bar( (void) diff --git a/Test/baseResults/matrix2.frag.out b/Test/baseResults/matrix2.frag.out index f8515874d69dac01d16ef0b4921c9dfed41a9c00..976ef2258f54a0f7021623c27b3f40626fb402bc 100644 --- a/Test/baseResults/matrix2.frag.out +++ b/Test/baseResults/matrix2.frag.out @@ -1,4 +1,4 @@ -Warning, version 150 is not yet complete; some version-specific are present, but many are missing. +Warning, version 150 is not yet complete; some version-specific features are present, but many are missing. WARNING: 0:4: varying deprecated in version 130; may be removed in future release WARNING: 0:13: varying deprecated in version 130; may be removed in future release WARNING: 0:15: varying deprecated in version 130; may be removed in future release diff --git a/Test/baseResults/newTexture.frag.out b/Test/baseResults/newTexture.frag.out index fdfad500adfeec05688ba28289e2bc83832ec190..fc4a36e1289c9bdafc11ce9e54200fe5ea58b2b4 100644 --- a/Test/baseResults/newTexture.frag.out +++ b/Test/baseResults/newTexture.frag.out @@ -1,4 +1,4 @@ -Warning, version 430 is not yet complete; some version-specific are present, but many are missing. +Warning, version 430 is not yet complete; some version-specific features are present, but many are missing. 0:? Sequence 0:34 Function Definition: main( (void) 0:34 Function Parameters: diff --git a/Test/baseResults/numeral.frag.out b/Test/baseResults/numeral.frag.out index 08de14940ef560ef1ce90e03eec684ce2f9b3927..035c07bf059df79e8152915ec454ed638ec674d8 100644 --- a/Test/baseResults/numeral.frag.out +++ b/Test/baseResults/numeral.frag.out @@ -1,4 +1,4 @@ -Warning, version 400 is not yet complete; some version-specific are present, but many are missing. +Warning, version 400 is not yet complete; some version-specific features are present, but many are missing. ERROR: 0:14: '' : octal literal digit too large ERROR: 0:15: '' : octal literal digit too large ERROR: 0:16: '' : octal literal digit too large diff --git a/Test/baseResults/recurse1.vert.out b/Test/baseResults/recurse1.vert.out index 2748662e12fa5e9ca6de600a41269ca3738d12ae..8c7cb8fec32da52187483e47bfa42c2e87267f60 100644 --- a/Test/baseResults/recurse1.vert.out +++ b/Test/baseResults/recurse1.vert.out @@ -1,5 +1,5 @@ recurse1.vert -Warning, version 330 is not yet complete; some version-specific are present, but many are missing. +Warning, version 330 is not yet complete; some version-specific features are present, but many are missing. 0:? Sequence 0:3 Function Definition: main( (void) @@ -69,7 +69,7 @@ Warning, version 330 is not yet complete; some version-specific are present, but 0:? 'gl_InstanceID' (gl_InstanceId int) recurse1.frag -Warning, version 330 is not yet complete; some version-specific are present, but many are missing. +Warning, version 330 is not yet complete; some version-specific features are present, but many are missing. 0:? Sequence 0:5 Function Definition: main( (void) @@ -104,7 +104,7 @@ Warning, version 330 is not yet complete; some version-specific are present, but 0:? Linker Objects recurse2.frag -Warning, version 330 is not yet complete; some version-specific are present, but many are missing. +Warning, version 330 is not yet complete; some version-specific features are present, but many are missing. 0:? Sequence 0:9 Function Definition: cbar(i1; (float) diff --git a/Test/baseResults/simpleFunctionCall.frag.out b/Test/baseResults/simpleFunctionCall.frag.out index f28c0d13010c58ca879fd9f6d932d33ee92010a3..b87a6580ec85ccacd19016d236a2d8d53271c4fd 100644 --- a/Test/baseResults/simpleFunctionCall.frag.out +++ b/Test/baseResults/simpleFunctionCall.frag.out @@ -1,4 +1,4 @@ -Warning, version 150 is not yet complete; some version-specific are present, but many are missing. +Warning, version 150 is not yet complete; some version-specific features are present, but many are missing. WARNING: 0:4: varying deprecated in version 130; may be removed in future release 0:? Sequence 0:7 Function Definition: foo( (4-component vector of float) diff --git a/Test/baseResults/specExamples.frag.out b/Test/baseResults/specExamples.frag.out index 04244425b1b5a06aa925080885221ebf39114a66..1c1fc94a96eee5b06f721e5437849fe01e6a9eaf 100644 --- a/Test/baseResults/specExamples.frag.out +++ b/Test/baseResults/specExamples.frag.out @@ -1,4 +1,4 @@ -Warning, version 430 is not yet complete; some version-specific are present, but many are missing. +Warning, version 430 is not yet complete; some version-specific features are present, but many are missing. ERROR: 0:6: '=' : cannot convert from 'const uint' to 'int' ERROR: 0:20: '' : numeric literal too big ERROR: 0:21: '' : hexidecimal literal too big diff --git a/Test/baseResults/specExamples.vert.out b/Test/baseResults/specExamples.vert.out index ea52fd5b9e3f62c36e5df8d0fe503fd653b13894..8141074c771430414b7b4e8a94c39c4adcc0c75c 100644 --- a/Test/baseResults/specExamples.vert.out +++ b/Test/baseResults/specExamples.vert.out @@ -1,4 +1,4 @@ -Warning, version 430 is not yet complete; some version-specific are present, but many are missing. +Warning, version 430 is not yet complete; some version-specific features are present, but many are missing. ERROR: 0:5: 'Vertex' : only uniform interface blocks are supported ERROR: 0:10: 'Vertex2' : only uniform interface blocks are supported ERROR: 0:23: 'transforms' : redeclaration of array with size diff --git a/Test/baseResults/versionsClean.vert.out b/Test/baseResults/versionsClean.vert.out index 81bd78fd0dce6ba2d85385f577200631b7541245..62943904dbfd726bc38144a69994a27248455747 100644 --- a/Test/baseResults/versionsClean.vert.out +++ b/Test/baseResults/versionsClean.vert.out @@ -1,4 +1,4 @@ -Warning, version 420 is not yet complete; some version-specific are present, but many are missing. +Warning, version 420 is not yet complete; some version-specific features are present, but many are missing. 0:? Sequence 0:40 Function Definition: main( (void) 0:40 Function Parameters: diff --git a/Test/baseResults/versionsErrors.vert.out b/Test/baseResults/versionsErrors.vert.out index 3493e5d92688bd118571cc88a791a6462b206937..29a841c5c61b52eaec70a6b5f74c5b7f6a9804a6 100644 --- a/Test/baseResults/versionsErrors.vert.out +++ b/Test/baseResults/versionsErrors.vert.out @@ -1,4 +1,4 @@ -Warning, version 420 is not yet complete; some version-specific are present, but many are missing. +Warning, version 420 is not yet complete; some version-specific features are present, but many are missing. WARNING: 0:38: attribute deprecated in version 130; may be removed in future release ERROR: 0:38: 'attribute' : no longer supported in core profile; removed in version 420 ERROR: 0:45: 'discard' : not supported in this stage: vertex diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index f29ac44518a53625056ab4f7a1fadd5a20ff88aa..cdff8684647c10c230835455ec65e15fc70c6440 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -321,7 +321,7 @@ TIntermTyped* TIntermediate::addBuiltInFunctionCall(TSourceLoc loc, TOperator op // This is the safe way to change the operator on an aggregate, as it // does lots of error checking and fixing. Especially for establishing // a function call's operation on it's set of parameters. Sequences -// of instructions are also aggregates, but they just direnctly set +// of instructions are also aggregates, but they just directly set // their operator to EOpSequence. // // Returns an aggregate node, which could be the one passed in if @@ -629,7 +629,7 @@ TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* r TIntermAggregate* aggNode = 0; if (left) aggNode = left->getAsAggregate(); - if (!aggNode || aggNode->getOp() != EOpNull) { + if (! aggNode || aggNode->getOp() != EOpNull) { aggNode = new TIntermAggregate; if (left) aggNode->getSequence().push_back(left); @@ -645,7 +645,7 @@ TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* r { TIntermAggregate* aggNode = growAggregate(left, right); if (aggNode) - aggNode->setLoc(loc); + aggNode->setLoc(loc); return aggNode; } diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 9725ff2b31c72bae95492285b0cacb1a60dfbf9c..b28d90f891f0930a5b77eafb47113ed755c8cf8b 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -46,10 +46,10 @@ extern int yyparse(void*); namespace glslang { -TParseContext::TParseContext(TSymbolTable& symt, TIntermediate& interm, bool pb, int v, EProfile p, EShLanguage L, TInfoSink& is, - bool fc, EShMessages m) : +TParseContext::TParseContext(TSymbolTable& symt, TIntermediate& interm, bool pb, int v, EProfile p, EShLanguage L, TInfoSink& is, + bool fc, EShMessages m) : intermediate(interm), symbolTable(symt), infoSink(is), language(L), - version(v), profile(p), forwardCompatible(fc), messages(m), + version(v), profile(p), forwardCompatible(fc), messages(m), contextPragma(true, false), loopNestingLevel(0), structNestingLevel(0), tokensBeforeEOF(false), numErrors(0), parsingBuiltins(pb), afterEOF(false) @@ -98,7 +98,7 @@ TParseContext::TParseContext(TSymbolTable& symt, TIntermediate& interm, bool pb, globalUniformDefaults.layoutPacking = ElpShared; globalInputDefaults.clear(); - + globalOutputDefaults.clear(); } @@ -277,11 +277,11 @@ bool TParseContext::parseVectorFields(TSourceLoc loc, const TString& compString, for (int i = 0; i < fields.num; ++i) { switch (compString[i]) { - case 'x': + case 'x': fields.offsets[i] = 0; fieldSet[i] = exyzw; break; - case 'r': + case 'r': fields.offsets[i] = 0; fieldSet[i] = ergba; break; @@ -289,11 +289,11 @@ bool TParseContext::parseVectorFields(TSourceLoc loc, const TString& compString, fields.offsets[i] = 0; fieldSet[i] = estpq; break; - case 'y': + case 'y': fields.offsets[i] = 1; fieldSet[i] = exyzw; break; - case 'g': + case 'g': fields.offsets[i] = 1; fieldSet[i] = ergba; break; @@ -301,11 +301,11 @@ bool TParseContext::parseVectorFields(TSourceLoc loc, const TString& compString, fields.offsets[i] = 1; fieldSet[i] = estpq; break; - case 'z': + case 'z': fields.offsets[i] = 2; fieldSet[i] = exyzw; break; - case 'b': + case 'b': fields.offsets[i] = 2; fieldSet[i] = ergba; break; @@ -313,12 +313,12 @@ bool TParseContext::parseVectorFields(TSourceLoc loc, const TString& compString, fields.offsets[i] = 2; fieldSet[i] = estpq; break; - - case 'w': + + case 'w': fields.offsets[i] = 3; fieldSet[i] = exyzw; break; - case 'a': + case 'a': fields.offsets[i] = 3; fieldSet[i] = ergba; break; @@ -358,27 +358,27 @@ bool TParseContext::parseVectorFields(TSourceLoc loc, const TString& compString, // // Used to output syntax, parsing, and semantic errors. // -void C_DECL TParseContext::error(TSourceLoc loc, const char *szReason, const char *szToken, +void C_DECL TParseContext::error(TSourceLoc loc, const char *szReason, const char *szToken, const char *szExtraInfoFormat, ...) { const int maxSize = GlslangMaxTokenLength + 200; char szExtraInfo[maxSize]; va_list marker; - + va_start(marker, szExtraInfoFormat); - + safe_vsprintf(szExtraInfo, maxSize, szExtraInfoFormat, marker); - + infoSink.info.prefix(EPrefixError); infoSink.info.location(loc); infoSink.info << "'" << szToken << "' : " << szReason << " " << szExtraInfo << "\n"; - + va_end(marker); ++numErrors; } -void C_DECL TParseContext::warn(TSourceLoc loc, const char *szReason, const char *szToken, +void C_DECL TParseContext::warn(TSourceLoc loc, const char *szReason, const char *szToken, const char *szExtraInfoFormat, ...) { if (messages & EShMsgSuppressWarnings) @@ -387,15 +387,15 @@ void C_DECL TParseContext::warn(TSourceLoc loc, const char *szReason, const char const int maxSize = GlslangMaxTokenLength + 200; char szExtraInfo[maxSize]; va_list marker; - + va_start(marker, szExtraInfoFormat); - + safe_vsprintf(szExtraInfo, maxSize, szExtraInfoFormat, marker); - + infoSink.info.prefix(EPrefixWarning); infoSink.info.location(loc); infoSink.info << "'" << szToken << "' : " << szReason << " " << szExtraInfo << "\n"; - + va_end(marker); } @@ -650,7 +650,7 @@ TFunction* TParseContext::handleFunctionDeclarator(TSourceLoc loc, TFunction& fu // // Handle seeing a function prototype in the grammar. This includes what may -// become a full definition, as a full definition looks like a prototype +// become a full definition, as a full definition looks like a prototype // followed by a body. The body is handled after this function // returns, when present. // @@ -817,7 +817,7 @@ TIntermTyped* TParseContext::handleFunctionCall(TSourceLoc loc, TFunction* fnCal result->getAsAggregate()->setUserDefined(); intermediate.addToCallGraph(infoSink, currentCaller, fnCandidate->getMangledName()); } - + TStorageQualifier qual; TQualifierList& qualifierList = result->getAsAggregate()->getQualifierList(); for (int i = 0; i < fnCandidate->getParamCount(); ++i) { @@ -851,26 +851,42 @@ TIntermTyped* TParseContext::handleFunctionCall(TSourceLoc loc, TFunction* fnCal // TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, TPublicType& publicType) { - if (publicType.arraySizes) { + publicType.qualifier.precision = EpqNone; + TType type(publicType); + + if (type.isArray()) { profileRequires(loc, ENoProfile, 120, GL_3DL_array_objects, "arrayed constructor"); profileRequires(loc, EEsProfile, 300, 0, "arrayed constructor"); } - publicType.qualifier.precision = EpqNone; - if (publicType.userDef) { - TString tempString = ""; - TType type(publicType); - - return new TFunction(&tempString, type, EOpConstructStruct); - } - - TOperator op = EOpNull; - switch (publicType.basicType) { + TOperator op = mapTypeToConstructorOp(type); + + if (op == EOpNull) { + error(loc, "cannot construct this type", TType::getBasicString(publicType.basicType), ""); + op = EOpConstructFloat; + publicType.basicType = EbtFloat; + TType errorType(publicType); + type.shallowCopy(errorType); + } + + return new TFunction(&TString(""), type, op); +} + +// +// Given a type, find what operation would construct it. +// +TOperator TParseContext::mapTypeToConstructorOp(const TType& type) +{ + if (type.getStruct()) + return EOpConstructStruct; + + TOperator op; + switch (type.getBasicType()) { case EbtFloat: - if (publicType.matrixCols) { - switch (publicType.matrixCols) { + if (type.isMatrix()) { + switch (type.getMatrixCols()) { case 2: - switch (publicType.matrixRows) { + switch (type.getMatrixRows()) { case 2: op = EOpConstructMat2x2; break; case 3: op = EOpConstructMat2x3; break; case 4: op = EOpConstructMat2x4; break; @@ -878,7 +894,7 @@ TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, TPublicType& pub } break; case 3: - switch (publicType.matrixRows) { + switch (type.getMatrixRows()) { case 2: op = EOpConstructMat3x2; break; case 3: op = EOpConstructMat3x3; break; case 4: op = EOpConstructMat3x4; break; @@ -886,7 +902,7 @@ TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, TPublicType& pub } break; case 4: - switch (publicType.matrixRows) { + switch (type.getMatrixRows()) { case 2: op = EOpConstructMat4x2; break; case 3: op = EOpConstructMat4x3; break; case 4: op = EOpConstructMat4x4; break; @@ -896,7 +912,7 @@ TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, TPublicType& pub default: break; // some compilers want this } } else { - switch(publicType.vectorSize) { + switch(type.getVectorSize()) { case 1: op = EOpConstructFloat; break; case 2: op = EOpConstructVec2; break; case 3: op = EOpConstructVec3; break; @@ -906,10 +922,10 @@ TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, TPublicType& pub } break; case EbtDouble: - if (publicType.matrixCols) { - switch (publicType.matrixCols) { + if (type.getMatrixCols()) { + switch (type.getMatrixCols()) { case 2: - switch (publicType.matrixRows) { + switch (type.getMatrixRows()) { case 2: op = EOpConstructDMat2x2; break; case 3: op = EOpConstructDMat2x3; break; case 4: op = EOpConstructDMat2x4; break; @@ -917,7 +933,7 @@ TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, TPublicType& pub } break; case 3: - switch (publicType.matrixRows) { + switch (type.getMatrixRows()) { case 2: op = EOpConstructDMat3x2; break; case 3: op = EOpConstructDMat3x3; break; case 4: op = EOpConstructDMat3x4; break; @@ -925,7 +941,7 @@ TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, TPublicType& pub } break; case 4: - switch (publicType.matrixRows) { + switch (type.getMatrixRows()) { case 2: op = EOpConstructDMat4x2; break; case 3: op = EOpConstructDMat4x3; break; case 4: op = EOpConstructDMat4x4; break; @@ -934,7 +950,7 @@ TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, TPublicType& pub break; } } else { - switch(publicType.vectorSize) { + switch(type.getVectorSize()) { case 1: op = EOpConstructDouble; break; case 2: op = EOpConstructDVec2; break; case 3: op = EOpConstructDVec3; break; @@ -944,7 +960,7 @@ TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, TPublicType& pub } break; case EbtInt: - switch(publicType.vectorSize) { + switch(type.getVectorSize()) { case 1: op = EOpConstructInt; break; case 2: op = EOpConstructIVec2; break; case 3: op = EOpConstructIVec3; break; @@ -953,7 +969,7 @@ TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, TPublicType& pub } break; case EbtUint: - switch(publicType.vectorSize) { + switch(type.getVectorSize()) { case 1: op = EOpConstructUint; break; case 2: op = EOpConstructUVec2; break; case 3: op = EOpConstructUVec3; break; @@ -962,7 +978,7 @@ TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, TPublicType& pub } break; case EbtBool: - switch(publicType.vectorSize) { + switch(type.getVectorSize()) { case 1: op = EOpConstructBool; break; case 2: op = EOpConstructBVec2; break; case 3: op = EOpConstructBVec3; break; @@ -970,17 +986,12 @@ TFunction* TParseContext::handleConstructorCall(TSourceLoc loc, TPublicType& pub default: break; // some compilers want this } break; - default: break; // some compilers want this - } - if (op == EOpNull) { - error(loc, "cannot construct this type", TType::getBasicString(publicType.basicType), ""); - publicType.basicType = EbtFloat; - op = EOpConstructFloat; + default: + op = EOpNull; + break; } - TString tempString = ""; - TType type(publicType); - return new TFunction(&tempString, type, op); + return op; } // @@ -997,7 +1008,7 @@ void TParseContext::assignError(TSourceLoc loc, const char* op, TString left, TS // void TParseContext::unaryOpError(TSourceLoc loc, const char* op, TString operand) { - error(loc, " wrong operand type", op, + error(loc, " wrong operand type", op, "no operation '%s' exists that takes an operand of type %s (or there is no acceptable conversion)", op, operand.c_str()); } @@ -1009,7 +1020,7 @@ void TParseContext::binaryOpError(TSourceLoc loc, const char* op, TString left, { error(loc, " wrong operand types:", op, "no operation '%s' exists that takes a left-hand operand of type '%s' and " - "a right operand of type '%s' (or there is no acceptable conversion)", + "a right operand of type '%s' (or there is no acceptable conversion)", op, left.c_str(), right.c_str()); } @@ -1018,7 +1029,7 @@ void TParseContext::binaryOpError(TSourceLoc loc, const char* op, TString left, // it was not found as a variable in the symbol table. If so, give the error // message and insert a dummy variable in the symbol table to prevent future errors. // -void TParseContext::variableCheck(TIntermTyped*& nodePtr) +void TParseContext::variableCheck(TIntermTyped*& nodePtr) { TIntermSymbol* symbol = nodePtr->getAsSymbolNode(); if (! symbol) @@ -1028,7 +1039,7 @@ void TParseContext::variableCheck(TIntermTyped*& nodePtr) error(symbol->getLoc(), "undeclared identifier", symbol->getName().c_str(), ""); // Add to symbol table to prevent future error messages on the same name - + TVariable* fakeVariable = new TVariable(&symbol->getName(), TType(EbtFloat)); symbolTable.insert(*fakeVariable); @@ -1072,18 +1083,18 @@ bool TParseContext::lValueErrorCheck(TSourceLoc loc, const char* op, TIntermType TIntermTyped* rightNode = binaryNode->getRight(); TIntermAggregate *aggrNode = rightNode->getAsAggregate(); - - for (TIntermSequence::iterator p = aggrNode->getSequence().begin(); + + for (TIntermSequence::iterator p = aggrNode->getSequence().begin(); p != aggrNode->getSequence().end(); p++) { int value = (*p)->getAsTyped()->getAsConstantUnion()->getConstArray()[0].getIConst(); - offset[value]++; + offset[value]++; if (offset[value] > 1) { error(loc, " l-value of swizzle cannot have duplicate components", op, "", ""); return true; } } - } + } return errorReturn; default: @@ -1257,7 +1268,7 @@ bool TParseContext::constructorError(TSourceLoc loc, TIntermNode* node, TFunctio bool arrayArg = false; for (int i = 0; i < function.getParamCount(); ++i) { size += function[i].type->getObjectSize(); - + if (constructingMatrix && function[i].type->isMatrix()) matrixInMatrix = true; if (full) @@ -1269,7 +1280,7 @@ bool TParseContext::constructorError(TSourceLoc loc, TIntermNode* node, TFunctio if (function[i].type->isArray()) arrayArg = true; } - + if (constType) type.getQualifier().storage = EvqConst; @@ -1297,7 +1308,7 @@ bool TParseContext::constructorError(TSourceLoc loc, TIntermNode* node, TFunctio error(loc, "too many arguments", "constructor", ""); return true; } - + if (op == EOpConstructStruct && ! type.isArray() && type.getStruct()->size() != function.getParamCount()) { error(loc, "Number of constructor parameters does not match the number of structure fields", "constructor", ""); return true; @@ -1335,7 +1346,7 @@ bool TParseContext::voidErrorCheck(TSourceLoc loc, const TString& identifier, co if (basicType == EbtVoid) { error(loc, "illegal use of type 'void'", identifier.c_str(), ""); return true; - } + } return false; } @@ -1359,10 +1370,10 @@ bool TParseContext::samplerErrorCheck(TSourceLoc loc, const TPublicType& pType, if (pType.basicType == EbtStruct) { if (containsSampler(*pType.userDef)) { error(loc, reason, TType::getBasicString(pType.basicType), "(structure cannot contain a sampler or image)"); - + return true; } - + return false; } else if (pType.basicType == EbtSampler) { error(loc, reason, TType::getBasicString(pType.basicType), ""); @@ -1445,12 +1456,12 @@ void TParseContext::globalQualifierFix(TSourceLoc loc, TQualifier& qualifier, co if ((language != EShLangVertex && qualifier.storage == EvqVaryingIn && ! qualifier.flat) || (language != EShLangFragment && qualifier.storage == EvqVaryingOut && ! qualifier.flat)) { error(loc, "must be qualified as 'flat'", GetStorageQualifierString(qualifier.storage), TType::getBasicString(publicType.basicType)); - + return; } } - if (language == EShLangVertex && qualifier.storage == EvqVaryingIn && + if (language == EShLangVertex && qualifier.storage == EvqVaryingIn && (qualifier.isAuxiliary() || qualifier.isInterpolation() || qualifier.isMemory() || qualifier.invariant)) { error(loc, "vertex input cannot be further qualified", "", ""); @@ -1466,7 +1477,7 @@ void TParseContext::globalQualifierFix(TSourceLoc loc, TQualifier& qualifier, co // Also, when force is false, it will be assumed that 'src' follows // 'dst', for the purpose of error checking order for versions // that require specific orderings of qualifiers. -// +// void TParseContext::mergeQualifiers(TSourceLoc loc, TQualifier& dst, const TQualifier& src, bool force) { // Multiple auxiliary qualifiers (mostly done later by 'individual qualifiers') @@ -1551,7 +1562,7 @@ void TParseContext::setDefaultPrecision(TSourceLoc loc, TPublicType& publicType, defaultPrecision[basicType] = qualifier; if (basicType == EbtInt) defaultPrecision[EbtUint] = qualifier; - + return; // all is well } } @@ -1695,7 +1706,7 @@ void TParseContext::arrayDimCheck(TSourceLoc loc, const TType* type, TArraySizes } // -// Do all the semantic checking for declaring an array, with and +// Do all the semantic checking for declaring an array, with and // without a size, and make the right changes to the symbol table. // // size == 0 means no specified size. @@ -1738,12 +1749,12 @@ void TParseContext::declareArray(TSourceLoc loc, TString& identifier, const TTyp error(loc, "redeclaration of array with size", identifier.c_str(), ""); return; } - + if (! variable->getType().sameElementType(type)) { error(loc, "redeclaration of array with a different type", identifier.c_str(), ""); return; } - + variable->getWritableType().setArraySizes(type); } @@ -1811,13 +1822,13 @@ void TParseContext::nonInitConstCheck(TSourceLoc loc, TString& identifier, TType // // Will emit // -TVariable* TParseContext::redeclareBuiltin(TSourceLoc loc, const TString& identifier, const TType& type, bool& newDeclaration) +TVariable* TParseContext::redeclareBuiltin(TSourceLoc loc, const TString& identifier, bool& newDeclaration) { if (profile == EEsProfile || identifier.substr(0, 3) != TString("gl_") || symbolTable.atBuiltInLevel()) return 0; // Potentially redeclaring a built-in variable... - + if ((identifier == "gl_FragDepth" && version >= 420) || (identifier == "gl_PerVertex" && version >= 410) || (identifier == "gl_PerFragment" && version >= 410) || @@ -1853,10 +1864,10 @@ TVariable* TParseContext::redeclareBuiltin(TSourceLoc loc, const TString& identi // Now, modify the type of the copy, as per the type of the current redeclaration. // TODO: functionality: verify type change is allowed and make the change in type - + return variable; } - + return 0; } @@ -1980,19 +1991,19 @@ const TFunction* TParseContext::findFunction(TSourceLoc loc, TFunction* call, bo { TSymbol* symbol = symbolTable.find(call->getMangledName(), builtIn); - if (symbol == 0) { + if (symbol == 0) { error(loc, "no matching overloaded function found", call->getName().c_str(), ""); return 0; } - + const TFunction* function = symbol->getAsFunction(); if (! function) { error(loc, "function name expected", call->getName().c_str(), ""); return 0; } - + return function; } @@ -2016,14 +2027,14 @@ TIntermNode* TParseContext::declareVariable(TSourceLoc loc, TString& identifier, // Check for redeclaration of built-ins and/or attempting to declare a reserved name bool newDeclaration = false; // true if a new entry gets added to the symbol table - TVariable* variable = redeclareBuiltin(loc, identifier, type, newDeclaration); + TVariable* variable = redeclareBuiltin(loc, identifier, newDeclaration); if (! variable) reservedErrorCheck(loc, identifier); // Declare the variable if (arraySizes) { // for ES, since size isn't coming from an initializer, it has to be explicitly declared now - if (profile == EEsProfile && ! initializer) + if (profile == EEsProfile && ! initializer) arraySizeRequiredCheck(loc, arraySizes->getSize()); arrayDimCheck(loc, &type, arraySizes); @@ -2045,17 +2056,17 @@ TIntermNode* TParseContext::declareVariable(TSourceLoc loc, TString& identifier, // Deal with initializer TIntermNode* initNode = 0; if (variable && initializer) - initNode = executeInitializer(loc, identifier, type, initializer, variable); + initNode = executeInitializer(loc, identifier, initializer, variable); // see if it's a linker-level object to track - if (newDeclaration && symbolTable.atGlobalLevel()) + if (newDeclaration && symbolTable.atGlobalLevel()) intermediate.addSymbolLinkageNode(linkage, *variable); return initNode; } // -// Declare a non-array variable, the main point being there is no redeclaration +// Declare a non-array variable, the main point being there is no redeclaration // for resizing allowed. // // Return the successfully declared variable. @@ -2078,7 +2089,7 @@ TVariable* TParseContext::declareNonArray(TSourceLoc loc, TString& identifier, T // // Handle all types of initializers from the grammar. // -TIntermNode* TParseContext::executeInitializer(TSourceLoc loc, TString& identifier, TType& type, +TIntermNode* TParseContext::executeInitializer(TSourceLoc loc, TString& identifier, TIntermTyped* initializer, TVariable* variable) { // @@ -2092,10 +2103,10 @@ TIntermNode* TParseContext::executeInitializer(TSourceLoc loc, TString& identifi return 0; } - // Fix arrayness if variable is unsized, getting size for initializer - if (initializer->getType().isArray() && initializer->getType().getArraySize() > 0 && - type.isArray() && type.getArraySize() == 0) - type.changeArraySize(initializer->getType().getArraySize()); + // Fix arrayness if variable is unsized, getting size for initializer + if (initializer->getType().isArray() && initializer->getType().getArraySize() > 0 && + variable->getType().isArray() && variable->getType().getArraySize() == 0) + variable->getWritableType().changeArraySize(initializer->getType().getArraySize()); // // test for and propagate constant @@ -2106,8 +2117,8 @@ TIntermNode* TParseContext::executeInitializer(TSourceLoc loc, TString& identifi variable->getWritableType().getQualifier().storage = EvqTemporary; return 0; } - if (type != initializer->getType()) { - error(loc, " non-matching types for const initializer ", + if (variable->getType() != initializer->getType()) { + error(loc, " non-matching types for const initializer ", variable->getType().getStorageQualifierString(), ""); variable->getWritableType().getQualifier().storage = EvqTemporary; return 0; @@ -2139,8 +2150,8 @@ TIntermNode* TParseContext::executeInitializer(TSourceLoc loc, TString& identifi return 0; } -// This function is used to test for the correctness of the parameters passed to various constructor functions -// and also convert them to the right datatype if it is allowed and required. +// Test for the correctness of the parameters passed to various constructor functions +// and also convert them to the right datatype if it is allowed and required. // // Returns 0 for an error or the constructed node (aggregate or typed) for no error. // @@ -2150,11 +2161,11 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType& type return 0; TIntermAggregate* aggrNode = node->getAsAggregate(); - + TTypeList::iterator memberTypes; if (op == EOpConstructStruct) memberTypes = type.getStruct()->begin(); - + TType elementType; elementType.shallowCopy(type); if (type.isArray()) @@ -2171,7 +2182,7 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType& type TIntermTyped *newNode; if (singleArg) { - // If structure constructor or array constructor is being called + // If structure constructor or array constructor is being called // for only one parameter inside the structure, we need to call constructStruct function once. if (type.isArray()) newNode = constructStruct(node, elementType, 1, node->getLoc()); @@ -2185,21 +2196,21 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType& type return newNode; } - + // // Handle list of arguments. // TIntermSequence &sequenceVector = aggrNode->getSequence() ; // Stores the information about the parameter to the constructor // if the structure constructor contains more than one parameter, then construct // each parameter - - int paramCount = 0; // keeps a track of the constructor parameter number being checked - - // for each parameter to the constructor call, check to see if the right type is passed or convert them + + int paramCount = 0; // keeps a track of the constructor parameter number being checked + + // for each parameter to the constructor call, check to see if the right type is passed or convert them // to the right type if possible (and allowed). // for structure constructors, just check if the right type is passed, no conversion is allowed. - - for (TIntermSequence::iterator p = sequenceVector.begin(); + + for (TIntermSequence::iterator p = sequenceVector.begin(); p != sequenceVector.end(); p++, paramCount++) { if (type.isArray()) newNode = constructStruct(*p, elementType, paramCount+1, node->getLoc()); @@ -2207,9 +2218,9 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType& type newNode = constructStruct(*p, *(memberTypes[paramCount]).type, paramCount+1, node->getLoc()); else newNode = constructBuiltIn(type, op, *p, node->getLoc(), true); - + if (newNode) { - p = sequenceVector.erase(p); + p = sequenceVector.erase(p); p = sequenceVector.insert(p, newNode); } } @@ -2221,7 +2232,7 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType& type // Function for constructor implementation. Calls addUnaryMath with appropriate EOp value // for the parameter to the constructor (passed to this function). Essentially, it converts -// the parameter types correctly. If a constructor expects an int (like ivec2) and is passed a +// the parameter types correctly. If a constructor expects an int (like ivec2) and is passed a // float, then float is converted to int. // // Returns 0 for an error or the constructed node. @@ -2302,7 +2313,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T // // Now, if there still isn't an operation to do the construction, and we need one, add one. // - + // Otherwise, skip out early. if (subset || (newNode != node && newNode->getType() == type)) return newNode; @@ -2321,8 +2332,8 @@ TIntermTyped* TParseContext::constructStruct(TIntermNode* node, const TType& typ TIntermTyped* converted = intermediate.addConversion(EOpConstructStruct, type, node->getAsTyped()); if (! converted || converted->getType() != type) { error(loc, "", "constructor", "cannot convert parameter %d from '%s' to '%s'", paramCount, - node->getAsTyped()->getType().getCompleteTypeString().c_str(), type.getCompleteTypeString().c_str()); - + node->getAsTyped()->getType().getCompleteTypeString().c_str(), type.getCompleteTypeString().c_str()); + return 0; } @@ -2343,7 +2354,7 @@ void TParseContext::addBlock(TSourceLoc loc, TTypeList& typeList, const TString* return; if (profile == EEsProfile && arraySizes) - arraySizeRequiredCheck(loc, arraySizes->getSize()); + arraySizeRequiredCheck(loc, arraySizes->getSize()); if (currentBlockDefaults.storage == EvqUniform) { requireProfile(loc, ~ENoProfile, "uniform block"); @@ -2430,7 +2441,7 @@ void TParseContext::addQualifierToExisting(TSourceLoc loc, TQualifier qualifier, return; } - if (qualifier.isAuxiliary() || + if (qualifier.isAuxiliary() || qualifier.isMemory() || qualifier.isInterpolation() || qualifier.storage != EvqTemporary || @@ -2479,7 +2490,7 @@ void TParseContext::updateQualifierDefaults(TQualifier qualifier) void TParseContext::updateQualifierDefaults(TSourceLoc loc, TQualifier qualifier) { - if (qualifier.isAuxiliary() || + if (qualifier.isAuxiliary() || qualifier.isMemory() || qualifier.isInterpolation() || qualifier.precision != EpqNone) @@ -2505,7 +2516,7 @@ void TParseContext::updateTypedDefaults(TSourceLoc loc, TQualifier qualifier, co if (! id) { if (qualifier.hasLayout()) warn(loc, "cannot set qualifier defaults when using a type and no identifier", "", ""); - + return; } @@ -2559,11 +2570,11 @@ void TParseContext::wrapupSwitchSubsequence(TIntermAggregate* statements, TInter TIntermTyped* newExpression = branchNode->getAsBranchNode()->getExpression(); if (prevExpression == 0 && newExpression == 0) error(branchNode->getLoc(), "duplicate label", "default", ""); - else if (prevExpression != 0 && + else if (prevExpression != 0 && newExpression != 0 && - prevExpression->getAsConstantUnion() && + prevExpression->getAsConstantUnion() && newExpression->getAsConstantUnion() && - prevExpression->getAsConstantUnion()->getConstArray()[0].getIConst() == + prevExpression->getAsConstantUnion()->getConstArray()[0].getIConst() == newExpression->getAsConstantUnion()->getConstArray()[0].getIConst()) error(branchNode->getLoc(), "duplicated value", "case", ""); } @@ -2583,7 +2594,7 @@ TIntermNode* TParseContext::addSwitch(TSourceLoc loc, TIntermTyped* expression, wrapupSwitchSubsequence(lastStatements, 0); - if (expression == 0 || + if (expression == 0 || (expression->getBasicType() != EbtInt && expression->getBasicType() != EbtUint) || expression->getType().isArray() || expression->getType().isMatrix() || expression->getType().isVector()) error(loc, "condition must be a scalar integer expression", "switch", ""); @@ -2613,7 +2624,7 @@ TIntermNode* TParseContext::addSwitch(TSourceLoc loc, TIntermTyped* expression, // This function returns the tree representation for the vector field(s) being accessed from contant vector. // If only one component of vector is accessed (v.x or v[0] where v is a contant vector), then a contant node is // returned, else an aggregate node is returned (for v.xy). The input to this function could either be the symbol -// node or it could be the intermediate tree representation of accessing fields in a constant structure or column of +// node or it could be the intermediate tree representation of accessing fields in a constant structure or column of // a constant matrix. // TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTyped* node, TSourceLoc loc) @@ -2637,9 +2648,9 @@ TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTy error(loc, "", "[", "vector index out of range '%d'", fields.offsets[i]); fields.offsets[i] = 0; } - + constArray[i] = unionArray[fields.offsets[i]]; - } + } typedNode = intermediate.addConstantUnion(constArray, node->getType(), loc); return typedNode; @@ -2647,8 +2658,8 @@ TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTy // // This function returns the column being accessed from a constant matrix. The values are retrieved from -// the symbol table and parse-tree is built for a vector (each column of a matrix is a vector). The input -// to the function could either be a symbol node (m[0] where m is a constant matrix)that represents a +// the symbol table and parse-tree is built for a vector (each column of a matrix is a vector). The input +// to the function could either be a symbol node (m[0] where m is a constant matrix)that represents a // constant matrix or it could be the tree representation of the constant matrix (s.m1[0] where s is a constant structure) // TIntermTyped* TParseContext::addConstMatrixNode(int index, TIntermTyped* node, TSourceLoc loc) @@ -2678,8 +2689,8 @@ TIntermTyped* TParseContext::addConstMatrixNode(int index, TIntermTyped* node, T // // This function returns an element of an array accessed from a constant array. The values are retrieved from -// the symbol table and parse-tree is built for the type of the element. The input -// to the function could either be a symbol node (a[0] where a is a constant array)that represents a +// the symbol table and parse-tree is built for the type of the element. The input +// to the function could either be a symbol node (a[0] where a is a constant array)that represents a // constant array or it could be the tree representation of the constant array (s.a1[0] where s is a constant structure) // TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, TSourceLoc loc) @@ -2698,7 +2709,7 @@ TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, TS int arrayElementSize = arrayElementType.getObjectSize(); if (tempConstantNode) { - typedNode = intermediate.addConstantUnion(TConstUnionArray(tempConstantNode->getConstArray(), arrayElementSize * index, arrayElementSize), + typedNode = intermediate.addConstantUnion(TConstUnionArray(tempConstantNode->getConstArray(), arrayElementSize * index, arrayElementSize), tempConstantNode->getType(), loc); } else { error(loc, "Cannot offset into the array", "Error", ""); @@ -2711,7 +2722,7 @@ TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, TS // -// This function returns the value of a particular field inside a constant structure from the symbol table. +// This function returns the value of a particular field inside a constant structure from the symbol table. // If there is an embedded/nested struct, it appropriately calls addConstStructNested or addConstStructFromAggr // function and returns the parse-tree with the values of the embedded/nested struct. // @@ -2726,15 +2737,15 @@ TIntermTyped* TParseContext::addConstStruct(TString& identifier, TIntermTyped* n for ( index = 0; index < fields->size(); ++index) { instanceSize = (*fields)[index].type->getObjectSize(); - + if ((*fields)[index].type->getFieldName() == identifier) break; - + instanceOffset += instanceSize; } if (tempConstantNode) { - typedNode = intermediate.addConstantUnion(TConstUnionArray(tempConstantNode->getConstArray(), instanceOffset, instanceSize), + typedNode = intermediate.addConstantUnion(TConstUnionArray(tempConstantNode->getConstArray(), instanceOffset, instanceSize), tempConstantNode->getType(), loc); // type will be changed in the calling function } else { diff --git a/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h index 1d874ff1835066cd1d884007b8b92b28b1d7b0db..fdfe148684ec7104bda4c09c9f832b6c4cf0ad8e 100644 --- a/glslang/MachineIndependent/ParseHelper.h +++ b/glslang/MachineIndependent/ParseHelper.h @@ -111,7 +111,7 @@ public: void precisionQualifierCheck(TSourceLoc, TPublicType&); void parameterSamplerCheck(TSourceLoc, TStorageQualifier qualifier, const TType& type); bool containsSampler(const TType& type); - TVariable* redeclareBuiltin(TSourceLoc, const TString&, const TType&, bool& newDeclaration); + TVariable* redeclareBuiltin(TSourceLoc, const TString&, bool& newDeclaration); void paramCheck(TSourceLoc, TStorageQualifier qualifier, TType* type); void nestedBlockCheck(TSourceLoc); void nestedStructCheck(TSourceLoc); @@ -165,7 +165,8 @@ protected: void nonInitConstCheck(TSourceLoc, TString& identifier, TType& type); TVariable* declareNonArray(TSourceLoc, TString& identifier, TType&, bool& newDeclaration); void declareArray(TSourceLoc, TString& identifier, const TType&, TVariable*&, bool& newDeclaration); - TIntermNode* executeInitializer(TSourceLoc, TString& identifier, TType&, TIntermTyped* initializer, TVariable* variable); + TIntermNode* executeInitializer(TSourceLoc, TString& identifier, TIntermTyped* initializer, TVariable* variable); + TOperator mapTypeToConstructorOp(const TType&); public: // diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index f67803b0f4b8a8a7263aa645f3cd05974cc27f46..1421cefae0d5a66b09c52805afad36a38294d5be 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -389,7 +389,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo infoSink.info << "Warning, version " << version << " is not yet complete; most features are present, but a few are missing.\n"; break; default: - infoSink.info << "Warning, version " << version << " is not yet complete; some version-specific are present, but many are missing.\n"; + infoSink.info << "Warning, version " << version << " is not yet complete; some version-specific features are present, but many are missing.\n"; break; }