Non-functional changes: Typo in error message and in comment, remove unneeded arguments, separate constructor-op mapping from handling constructors.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23389 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-10-05 19:03:50 +00:00
parent 816e9bc90b
commit 98c2ef25de
28 changed files with 182 additions and 170 deletions

View file

@ -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)

View file

@ -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:

View file

@ -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.

View file

@ -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:

View file

@ -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:

View file

@ -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.

View file

@ -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:

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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:

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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);

View file

@ -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);
TOperator op = mapTypeToConstructorOp(type);
return new TFunction(&tempString, type, EOpConstructStruct);
if (op == EOpNull) {
error(loc, "cannot construct this type", TType::getBasicString(publicType.basicType), "");
op = EOpConstructFloat;
publicType.basicType = EbtFloat;
TType errorType(publicType);
type.shallowCopy(errorType);
}
TOperator op = EOpNull;
switch (publicType.basicType) {
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
default:
op = EOpNull;
break;
}
if (op == EOpNull) {
error(loc, "cannot construct this type", TType::getBasicString(publicType.basicType), "");
publicType.basicType = EbtFloat;
op = EOpConstructFloat;
}
TString tempString = "";
TType type(publicType);
return new TFunction(&tempString, type, op);
return op;
}
//
@ -1811,7 +1822,7 @@ 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;
@ -2016,7 +2027,7 @@ 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);
@ -2045,7 +2056,7 @@ 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())
@ -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)
{
//
@ -2094,8 +2105,8 @@ TIntermNode* TParseContext::executeInitializer(TSourceLoc loc, TString& identifi
// 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());
variable->getType().isArray() && variable->getType().getArraySize() == 0)
variable->getWritableType().changeArraySize(initializer->getType().getArraySize());
//
// test for and propagate constant
@ -2106,7 +2117,7 @@ TIntermNode* TParseContext::executeInitializer(TSourceLoc loc, TString& identifi
variable->getWritableType().getQualifier().storage = EvqTemporary;
return 0;
}
if (type != initializer->getType()) {
if (variable->getType() != initializer->getType()) {
error(loc, " non-matching types for const initializer ",
variable->getType().getStorageQualifierString(), "");
variable->getWritableType().getQualifier().storage = EvqTemporary;
@ -2139,7 +2150,7 @@ 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
// 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.

View file

@ -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:
//

View file

@ -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;
}