Non-functional: Remove use of the unused structure 'remapper', and other minor internal improvements. Triggered by some bigger changes in the works. Also, turned on an existing test that was not included in the test list.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@23426 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich
2013-10-09 00:20:26 +00:00
parent 7ea2f9c39f
commit 3afe67dcc2
8 changed files with 86 additions and 64 deletions

View File

@@ -0,0 +1,17 @@
Warning, version 150 is not yet complete; some version-specific features are present, but many are missing.
ERROR: 0:7: 'EmitStreamVertex' : no matching overloaded function found
ERROR: 0:8: 'EndStreamPrimitive' : no matching overloaded function found
ERROR: 2 compilation errors. No code generated.
ERROR: node is still EOpNull!
0:3 Function Definition: main( (void)
0:3 Function Parameters:
0:5 Sequence
0:5 EmitVertex (void)
0:6 EndPrimitive (void)
0:7 Constant:
0:7 0.000000
0:8 Constant:
0:8 0.000000
0:? Linker Objects

View File

@@ -12,6 +12,7 @@ versionsErrors.vert
120.frag 120.frag
130.frag 130.frag
140.frag 140.frag
150.geom
precision.frag precision.frag
precision.vert precision.vert
nonSquare.vert nonSquare.vert

View File

@@ -68,7 +68,7 @@ enum TStorageQualifier {
EvqVaryingIn, // pipeline input, read only EvqVaryingIn, // pipeline input, read only
EvqVaryingOut, // pipeline ouput, read/write EvqVaryingOut, // pipeline ouput, read/write
EvqUniform, // read only, shader with app EvqUniform, // read only, shader with app
EVqBuffer, // read only, shader with app EvqBuffer, // read only, shader with app
// parameters // parameters
EvqIn, EvqIn,

View File

@@ -452,6 +452,9 @@ public:
if (unionArray == rhs.unionArray) if (unionArray == rhs.unionArray)
return true; return true;
if (! unionArray || ! rhs.unionArray)
return false;
return *unionArray == *rhs.unionArray; return *unionArray == *rhs.unionArray;
} }
bool operator!=(const TConstUnionArray& rhs) const { return ! operator==(rhs); } bool operator!=(const TConstUnionArray& rhs) const { return ! operator==(rhs); }

View File

@@ -300,7 +300,7 @@ public:
{ {
switch (storage) { switch (storage) {
case EvqUniform: case EvqUniform:
case EVqBuffer: case EvqBuffer:
return true; return true;
default: default:
return false; return false;
@@ -479,7 +479,7 @@ public:
typeName = copyOf.typeName; typeName = copyOf.typeName;
} }
void deepCopy(const TType& copyOf, const TStructureMap& remapper) void deepCopy(const TType& copyOf)
{ {
shallowCopy(copyOf); shallowCopy(copyOf);
@@ -489,19 +489,15 @@ public:
} }
if (structure) { if (structure) {
TStructureMapIterator iter;
if ((iter = remapper.find(structure)) == remapper.end()) {
// create the new structure here
structure = NewPoolTTypeList(); structure = NewPoolTTypeList();
TStructureMapIterator iter;
for (unsigned int i = 0; i < copyOf.structure->size(); ++i) { for (unsigned int i = 0; i < copyOf.structure->size(); ++i) {
TTypeLoc typeLoc; TTypeLoc typeLoc;
typeLoc.loc = (*copyOf.structure)[i].loc; typeLoc.loc = (*copyOf.structure)[i].loc;
typeLoc.type = (*copyOf.structure)[i].type->clone(remapper); typeLoc.type = new TType();
typeLoc.type->deepCopy(*(*copyOf.structure)[i].type);
structure->push_back(typeLoc); structure->push_back(typeLoc);
} }
} else {
structure = iter->second;
}
} }
if (fieldName) if (fieldName)
@@ -510,6 +506,14 @@ public:
typeName = NewPoolTString(copyOf.typeName->c_str()); typeName = NewPoolTString(copyOf.typeName->c_str());
} }
TType* clone()
{
TType *newType = new TType();
newType->deepCopy(*this);
return newType;
}
// Merge type from parent, where a parentType is at the beginning of a declaration, // Merge type from parent, where a parentType is at the beginning of a declaration,
// establishing some charastics for all subsequent names, while this type // establishing some charastics for all subsequent names, while this type
// is on the individual names. // is on the individual names.
@@ -525,14 +529,6 @@ public:
setTypeName(parentType.userDef->getTypeName()); setTypeName(parentType.userDef->getTypeName());
} }
TType* clone(const TStructureMap& remapper)
{
TType *newType = new TType();
newType->deepCopy(*this, remapper);
return newType;
}
virtual void dereference() virtual void dereference()
{ {
if (arraySizes) if (arraySizes)
@@ -578,8 +574,12 @@ public:
virtual int getMatrixCols() const { return matrixCols; } virtual int getMatrixCols() const { return matrixCols; }
virtual int getMatrixRows() const { return matrixRows; } virtual int getMatrixRows() const { return matrixRows; }
virtual bool isScalar() const { return vectorSize == 1 && ! getStruct() && ! isArray(); }
virtual bool isVector() const { return vectorSize > 1; }
virtual bool isMatrix() const { return matrixCols ? true : false; } virtual bool isMatrix() const { return matrixCols ? true : false; }
virtual bool isArray() const { return arraySizes != 0; } virtual bool isArray() const { return arraySizes != 0; }
// Recursively check the structure for any arrays, needed for some error checks
virtual bool containsArray() const virtual bool containsArray() const
{ {
if (isArray()) if (isArray())
@@ -593,10 +593,17 @@ public:
return false; return false;
} }
int getArraySize() const { return arraySizes->sizes.front(); } int getArraySize() const { return arraySizes->sizes.front(); }
void shareArraySizes(const TType& type)
{
// For when we are sharing existing array descriptors.
// This allows all references to the same unsized array
// to be updated at once, by having all of them share the
// array description.
*arraySizes = *type.arraySizes;
}
void setArraySizes(TArraySizes* s) void setArraySizes(TArraySizes* s)
{ {
// copy; we don't want distinct types sharing the same descriptor // For when we don't want distinct types sharing the same descriptor.
if (! arraySizes)
arraySizes = NewPoolTArraySizes(); arraySizes = NewPoolTArraySizes();
*arraySizes = *s; *arraySizes = *s;
} }
@@ -605,8 +612,6 @@ public:
void changeArraySize(int s) { arraySizes->sizes.front() = s; } void changeArraySize(int s) { arraySizes->sizes.front() = s; }
void setMaxArraySize (int s) { arraySizes->maxArraySize = s; } void setMaxArraySize (int s) { arraySizes->maxArraySize = s; }
int getMaxArraySize () const { return arraySizes->maxArraySize; } int getMaxArraySize () const { return arraySizes->maxArraySize; }
virtual bool isVector() const { return vectorSize > 1; }
virtual bool isScalar() const { return vectorSize == 1; }
const char* getBasicString() const const char* getBasicString() const
{ {
return TType::getBasicString(basicType); return TType::getBasicString(basicType);

View File

@@ -1757,7 +1757,7 @@ void TParseContext::declareArray(TSourceLoc loc, TString& identifier, const TTyp
return; return;
} }
variable->getWritableType().setArraySizes(type); variable->getWritableType().shareArraySizes(type);
} }
bool TParseContext::arraySetMaxSize(TSourceLoc loc, TIntermSymbol *node, int size) bool TParseContext::arraySetMaxSize(TSourceLoc loc, TIntermSymbol *node, int size)
@@ -2171,7 +2171,7 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType& type
TType elementType; TType elementType;
elementType.shallowCopy(type); elementType.shallowCopy(type);
if (type.isArray()) if (type.isArray())
elementType.dereference(); // TODO: arrays of arrays: shallow copy won't work if sharing same array structure and then doing a dereference elementType.dereference(); // TODO: arrays of arrays: combine this with shallowCopy
bool singleArg; bool singleArg;
if (aggrNode) { if (aggrNode) {
@@ -2202,7 +2202,7 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType& type
// //
// Handle list of arguments. // Handle list of arguments.
// //
TIntermSequence &sequenceVector = aggrNode->getSequence() ; // Stores the information about the parameter to the constructor TIntermSequence &sequenceVector = aggrNode->getSequence(); // Stores the information about the parameter to the constructor
// if the structure constructor contains more than one parameter, then construct // if the structure constructor contains more than one parameter, then construct
// each parameter // each parameter
@@ -2221,10 +2221,10 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType& type
else else
newNode = constructBuiltIn(type, op, *p, node->getLoc(), true); newNode = constructBuiltIn(type, op, *p, node->getLoc(), true);
if (newNode) { if (newNode)
p = sequenceVector.erase(p); *p = newNode;
p = sequenceVector.insert(p, newNode); else
} return 0;
} }
TIntermTyped* constructor = intermediate.setAggregateOperator(aggrNode, op, type, loc); TIntermTyped* constructor = intermediate.setAggregateOperator(aggrNode, op, type, loc);
@@ -2700,8 +2700,8 @@ TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, TS
TIntermTyped* typedNode; TIntermTyped* typedNode;
TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion(); TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
TType arrayElementType; TType arrayElementType;
arrayElementType.shallowCopy(node->getType()); arrayElementType.shallowCopy(node->getType()); // TODO: arrays of arrays: combine this with deref.
arrayElementType.dereference(); // TODO: arrays of arrays: shallow copy won't work if sharing same array structure and then doing a dereference arrayElementType.dereference();
if (index >= node->getType().getArraySize() || index < 0) { if (index >= node->getType().getArraySize() || index < 0) {
error(loc, "", "[", "array index '%d' out of range", index); error(loc, "", "[", "array index '%d' out of range", index);

View File

@@ -226,9 +226,9 @@ TSymbol::TSymbol(const TSymbol& copyOf)
writable = true; writable = true;
} }
TVariable::TVariable(const TVariable& copyOf, TStructureMap& remapper) : TSymbol(copyOf) TVariable::TVariable(const TVariable& copyOf) : TSymbol(copyOf)
{ {
type.deepCopy(copyOf.type, remapper); type.deepCopy(copyOf.type);
userType = copyOf.userType; userType = copyOf.userType;
if (! copyOf.unionArray.empty()) { if (! copyOf.unionArray.empty()) {
@@ -240,35 +240,35 @@ TVariable::TVariable(const TVariable& copyOf, TStructureMap& remapper) : TSymbol
} }
} }
TVariable* TVariable::clone(TStructureMap& remapper) TVariable* TVariable::clone()
{ {
TVariable *variable = new TVariable(*this, remapper); TVariable *variable = new TVariable(*this);
return variable; return variable;
} }
TFunction::TFunction(const TFunction& copyOf, const TStructureMap& remapper) : TSymbol(copyOf) TFunction::TFunction(const TFunction& copyOf) : TSymbol(copyOf)
{ {
for (unsigned int i = 0; i < copyOf.parameters.size(); ++i) { for (unsigned int i = 0; i < copyOf.parameters.size(); ++i) {
TParameter param; TParameter param;
parameters.push_back(param); parameters.push_back(param);
parameters.back().copyParam(copyOf.parameters[i], remapper); parameters.back().copyParam(copyOf.parameters[i]);
} }
returnType.deepCopy(copyOf.returnType, remapper); returnType.deepCopy(copyOf.returnType);
mangledName = copyOf.mangledName; mangledName = copyOf.mangledName;
op = copyOf.op; op = copyOf.op;
defined = copyOf.defined; defined = copyOf.defined;
} }
TFunction* TFunction::clone(TStructureMap& remapper) TFunction* TFunction::clone()
{ {
TFunction *function = new TFunction(*this, remapper); TFunction *function = new TFunction(*this);
return function; return function;
} }
TAnonMember* TAnonMember::clone(TStructureMap& remapper) TAnonMember* TAnonMember::clone()
{ {
// need to implement this once built-in symbols include interface blocks // need to implement this once built-in symbols include interface blocks
assert(0); assert(0);
@@ -276,13 +276,13 @@ TAnonMember* TAnonMember::clone(TStructureMap& remapper)
return 0; return 0;
} }
TSymbolTableLevel* TSymbolTableLevel::clone(TStructureMap& remapper) TSymbolTableLevel* TSymbolTableLevel::clone()
{ {
TSymbolTableLevel *symTableLevel = new TSymbolTableLevel(); TSymbolTableLevel *symTableLevel = new TSymbolTableLevel();
symTableLevel->anonId = anonId; symTableLevel->anonId = anonId;
tLevel::iterator iter; tLevel::iterator iter;
for (iter = level.begin(); iter != level.end(); ++iter) for (iter = level.begin(); iter != level.end(); ++iter)
symTableLevel->insert(*iter->second->clone(remapper)); symTableLevel->insert(*iter->second->clone());
return symTableLevel; return symTableLevel;
} }
@@ -291,11 +291,10 @@ void TSymbolTable::copyTable(const TSymbolTable& copyOf)
{ {
assert(adoptedLevels == copyOf.adoptedLevels); assert(adoptedLevels == copyOf.adoptedLevels);
TStructureMap remapper;
uniqueId = copyOf.uniqueId; uniqueId = copyOf.uniqueId;
noBuiltInRedeclarations = copyOf.noBuiltInRedeclarations; noBuiltInRedeclarations = copyOf.noBuiltInRedeclarations;
for (unsigned int i = copyOf.adoptedLevels; i < copyOf.table.size(); ++i) for (unsigned int i = copyOf.adoptedLevels; i < copyOf.table.size(); ++i)
table.push_back(copyOf.table[i]->clone(remapper)); table.push_back(copyOf.table[i]->clone());
} }
} // end namespace glslang } // end namespace glslang

View File

@@ -81,7 +81,7 @@ class TSymbol {
public: public:
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator()) POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
explicit TSymbol(const TString *n) : name(n), writable(true) { } explicit TSymbol(const TString *n) : name(n), writable(true) { }
virtual TSymbol* clone(TStructureMap& remapper) = 0; virtual TSymbol* clone() = 0;
virtual ~TSymbol() { } virtual ~TSymbol() { }
const TString& getName() const { return *name; } const TString& getName() const { return *name; }
@@ -126,7 +126,7 @@ protected:
class TVariable : public TSymbol { class TVariable : public TSymbol {
public: public:
TVariable(const TString *name, const TType& t, bool uT = false ) : TSymbol(name), userType(uT) { type.shallowCopy(t); } TVariable(const TString *name, const TType& t, bool uT = false ) : TSymbol(name), userType(uT) { type.shallowCopy(t); }
virtual TVariable* clone(TStructureMap& remapper); virtual TVariable* clone();
virtual ~TVariable() { } virtual ~TVariable() { }
virtual TVariable* getAsVariable() { return this; } virtual TVariable* getAsVariable() { return this; }
@@ -142,7 +142,6 @@ public:
protected: protected:
explicit TVariable(const TVariable&); explicit TVariable(const TVariable&);
TVariable(const TVariable&, TStructureMap& remapper);
TVariable& operator=(const TVariable&); TVariable& operator=(const TVariable&);
TType type; TType type;
@@ -159,13 +158,13 @@ protected:
struct TParameter { struct TParameter {
TString *name; TString *name;
TType* type; TType* type;
void copyParam(const TParameter& param, const TStructureMap& remapper) void copyParam(const TParameter& param)
{ {
if (param.name) if (param.name)
name = NewPoolTString(param.name->c_str()); name = NewPoolTString(param.name->c_str());
else else
name = 0; name = 0;
type = param.type->clone(remapper); type = param.type->clone();
} }
}; };
@@ -183,7 +182,7 @@ public:
mangledName(*name + '('), mangledName(*name + '('),
op(tOp), op(tOp),
defined(false) { returnType.shallowCopy(retType); } defined(false) { returnType.shallowCopy(retType); }
virtual TFunction* clone(TStructureMap& remapper); virtual TFunction* clone();
virtual ~TFunction(); virtual ~TFunction();
virtual TFunction* getAsFunction() { return this; } virtual TFunction* getAsFunction() { return this; }
@@ -210,8 +209,7 @@ public:
virtual void dump(TInfoSink &infoSink) const; virtual void dump(TInfoSink &infoSink) const;
protected: protected:
explicit TFunction(TFunction&); explicit TFunction(const TFunction&);
TFunction(const TFunction&, const TStructureMap& remapper);
TFunction& operator=(TFunction&); TFunction& operator=(TFunction&);
typedef TVector<TParameter> TParamList; typedef TVector<TParameter> TParamList;
@@ -225,7 +223,7 @@ protected:
class TAnonMember : public TSymbol { class TAnonMember : public TSymbol {
public: public:
TAnonMember(const TString* n, unsigned int m, TSymbol& a) : TSymbol(n), anonContainer(a), memberNumber(m) { } TAnonMember(const TString* n, unsigned int m, TSymbol& a) : TSymbol(n), anonContainer(a), memberNumber(m) { }
virtual TAnonMember* clone(TStructureMap& remapper); virtual TAnonMember* clone();
virtual ~TAnonMember() { } virtual ~TAnonMember() { }
const TAnonMember* getAsAnonMember() const { return this; } const TAnonMember* getAsAnonMember() const { return this; }
@@ -346,7 +344,7 @@ public:
void relateToOperator(const char* name, TOperator op); void relateToOperator(const char* name, TOperator op);
void dump(TInfoSink &infoSink) const; void dump(TInfoSink &infoSink) const;
TSymbolTableLevel* clone(TStructureMap& remapper); TSymbolTableLevel* clone();
void readOnly(); void readOnly();
protected: protected:
@@ -445,7 +443,7 @@ public:
// //
TVariable* copyUp(TVariable* shared) TVariable* copyUp(TVariable* shared)
{ {
TVariable* variable = shared->clone(remapper); TVariable* variable = shared->clone();
variable->setUniqueId(shared->getUniqueId()); variable->setUniqueId(shared->getUniqueId());
table[currentLevel()]->insert(*variable); table[currentLevel()]->insert(*variable);
@@ -497,7 +495,6 @@ protected:
int uniqueId; // for unique identification in code generation int uniqueId; // for unique identification in code generation
bool noBuiltInRedeclarations; bool noBuiltInRedeclarations;
unsigned int adoptedLevels; unsigned int adoptedLevels;
TStructureMap remapper; // for now, dummy for copyUp(), which is not yet used for structures
}; };
} // end namespace glslang } // end namespace glslang