Commit 3afe67dc by John Kessenich

Non-functional: Remove use of the unused structure 'remapper', and other minor…

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
parent 7ea2f9c3
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
......@@ -12,6 +12,7 @@ versionsErrors.vert
120.frag
130.frag
140.frag
150.geom
precision.frag
precision.vert
nonSquare.vert
......
......@@ -68,7 +68,7 @@ enum TStorageQualifier {
EvqVaryingIn, // pipeline input, read only
EvqVaryingOut, // pipeline ouput, read/write
EvqUniform, // read only, shader with app
EVqBuffer, // read only, shader with app
EvqBuffer, // read only, shader with app
// parameters
EvqIn,
......
......@@ -452,6 +452,9 @@ public:
if (unionArray == rhs.unionArray)
return true;
if (! unionArray || ! rhs.unionArray)
return false;
return *unionArray == *rhs.unionArray;
}
bool operator!=(const TConstUnionArray& rhs) const { return ! operator==(rhs); }
......
......@@ -300,7 +300,7 @@ public:
{
switch (storage) {
case EvqUniform:
case EVqBuffer:
case EvqBuffer:
return true;
default:
return false;
......@@ -479,7 +479,7 @@ public:
typeName = copyOf.typeName;
}
void deepCopy(const TType& copyOf, const TStructureMap& remapper)
void deepCopy(const TType& copyOf)
{
shallowCopy(copyOf);
......@@ -489,18 +489,14 @@ public:
}
if (structure) {
structure = NewPoolTTypeList();
TStructureMapIterator iter;
if ((iter = remapper.find(structure)) == remapper.end()) {
// create the new structure here
structure = NewPoolTTypeList();
for (unsigned int i = 0; i < copyOf.structure->size(); ++i) {
TTypeLoc typeLoc;
typeLoc.loc = (*copyOf.structure)[i].loc;
typeLoc.type = (*copyOf.structure)[i].type->clone(remapper);
structure->push_back(typeLoc);
}
} else {
structure = iter->second;
for (unsigned int i = 0; i < copyOf.structure->size(); ++i) {
TTypeLoc typeLoc;
typeLoc.loc = (*copyOf.structure)[i].loc;
typeLoc.type = new TType();
typeLoc.type->deepCopy(*(*copyOf.structure)[i].type);
structure->push_back(typeLoc);
}
}
......@@ -509,6 +505,14 @@ public:
if (typeName)
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,
// establishing some charastics for all subsequent names, while this type
......@@ -525,14 +529,6 @@ public:
setTypeName(parentType.userDef->getTypeName());
}
TType* clone(const TStructureMap& remapper)
{
TType *newType = new TType();
newType->deepCopy(*this, remapper);
return newType;
}
virtual void dereference()
{
if (arraySizes)
......@@ -578,8 +574,12 @@ public:
virtual int getMatrixCols() const { return matrixCols; }
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 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
{
if (isArray())
......@@ -593,11 +593,18 @@ public:
return false;
}
int getArraySize() const { return arraySizes->sizes.front(); }
void setArraySizes(TArraySizes* s)
void shareArraySizes(const TType& type)
{
// copy; we don't want distinct types sharing the same descriptor
if (! arraySizes)
arraySizes = NewPoolTArraySizes();
// 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)
{
// For when we don't want distinct types sharing the same descriptor.
arraySizes = NewPoolTArraySizes();
*arraySizes = *s;
}
void setArraySizes(const TType& type) { setArraySizes(type.arraySizes); }
......@@ -605,8 +612,6 @@ public:
void changeArraySize(int s) { arraySizes->sizes.front() = s; }
void setMaxArraySize (int s) { arraySizes->maxArraySize = s; }
int getMaxArraySize () const { return arraySizes->maxArraySize; }
virtual bool isVector() const { return vectorSize > 1; }
virtual bool isScalar() const { return vectorSize == 1; }
const char* getBasicString() const
{
return TType::getBasicString(basicType);
......
......@@ -1757,7 +1757,7 @@ void TParseContext::declareArray(TSourceLoc loc, TString& identifier, const TTyp
return;
}
variable->getWritableType().setArraySizes(type);
variable->getWritableType().shareArraySizes(type);
}
bool TParseContext::arraySetMaxSize(TSourceLoc loc, TIntermSymbol *node, int size)
......@@ -2171,7 +2171,7 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType& type
TType elementType;
elementType.shallowCopy(type);
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;
if (aggrNode) {
......@@ -2202,7 +2202,7 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType& type
//
// 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
// each parameter
......@@ -2221,10 +2221,10 @@ TIntermTyped* TParseContext::addConstructor(TIntermNode* node, const TType& type
else
newNode = constructBuiltIn(type, op, *p, node->getLoc(), true);
if (newNode) {
p = sequenceVector.erase(p);
p = sequenceVector.insert(p, newNode);
}
if (newNode)
*p = newNode;
else
return 0;
}
TIntermTyped* constructor = intermediate.setAggregateOperator(aggrNode, op, type, loc);
......@@ -2700,8 +2700,8 @@ TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, TS
TIntermTyped* typedNode;
TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
TType arrayElementType;
arrayElementType.shallowCopy(node->getType());
arrayElementType.dereference(); // TODO: arrays of arrays: shallow copy won't work if sharing same array structure and then doing a dereference
arrayElementType.shallowCopy(node->getType()); // TODO: arrays of arrays: combine this with deref.
arrayElementType.dereference();
if (index >= node->getType().getArraySize() || index < 0) {
error(loc, "", "[", "array index '%d' out of range", index);
......
......@@ -226,9 +226,9 @@ TSymbol::TSymbol(const TSymbol& copyOf)
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;
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;
}
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) {
TParameter 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;
op = copyOf.op;
defined = copyOf.defined;
}
TFunction* TFunction::clone(TStructureMap& remapper)
TFunction* TFunction::clone()
{
TFunction *function = new TFunction(*this, remapper);
TFunction *function = new TFunction(*this);
return function;
}
TAnonMember* TAnonMember::clone(TStructureMap& remapper)
TAnonMember* TAnonMember::clone()
{
// need to implement this once built-in symbols include interface blocks
assert(0);
......@@ -276,13 +276,13 @@ TAnonMember* TAnonMember::clone(TStructureMap& remapper)
return 0;
}
TSymbolTableLevel* TSymbolTableLevel::clone(TStructureMap& remapper)
TSymbolTableLevel* TSymbolTableLevel::clone()
{
TSymbolTableLevel *symTableLevel = new TSymbolTableLevel();
symTableLevel->anonId = anonId;
tLevel::iterator iter;
for (iter = level.begin(); iter != level.end(); ++iter)
symTableLevel->insert(*iter->second->clone(remapper));
symTableLevel->insert(*iter->second->clone());
return symTableLevel;
}
......@@ -291,11 +291,10 @@ void TSymbolTable::copyTable(const TSymbolTable& copyOf)
{
assert(adoptedLevels == copyOf.adoptedLevels);
TStructureMap remapper;
uniqueId = copyOf.uniqueId;
noBuiltInRedeclarations = copyOf.noBuiltInRedeclarations;
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
......@@ -81,7 +81,7 @@ class TSymbol {
public:
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
explicit TSymbol(const TString *n) : name(n), writable(true) { }
virtual TSymbol* clone(TStructureMap& remapper) = 0;
virtual TSymbol* clone() = 0;
virtual ~TSymbol() { }
const TString& getName() const { return *name; }
......@@ -126,7 +126,7 @@ protected:
class TVariable : public TSymbol {
public:
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* getAsVariable() { return this; }
......@@ -142,7 +142,6 @@ public:
protected:
explicit TVariable(const TVariable&);
TVariable(const TVariable&, TStructureMap& remapper);
TVariable& operator=(const TVariable&);
TType type;
......@@ -159,13 +158,13 @@ protected:
struct TParameter {
TString *name;
TType* type;
void copyParam(const TParameter& param, const TStructureMap& remapper)
void copyParam(const TParameter& param)
{
if (param.name)
name = NewPoolTString(param.name->c_str());
else
name = 0;
type = param.type->clone(remapper);
type = param.type->clone();
}
};
......@@ -183,7 +182,7 @@ public:
mangledName(*name + '('),
op(tOp),
defined(false) { returnType.shallowCopy(retType); }
virtual TFunction* clone(TStructureMap& remapper);
virtual TFunction* clone();
virtual ~TFunction();
virtual TFunction* getAsFunction() { return this; }
......@@ -210,8 +209,7 @@ public:
virtual void dump(TInfoSink &infoSink) const;
protected:
explicit TFunction(TFunction&);
TFunction(const TFunction&, const TStructureMap& remapper);
explicit TFunction(const TFunction&);
TFunction& operator=(TFunction&);
typedef TVector<TParameter> TParamList;
......@@ -225,7 +223,7 @@ protected:
class TAnonMember : public TSymbol {
public:
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() { }
const TAnonMember* getAsAnonMember() const { return this; }
......@@ -346,7 +344,7 @@ public:
void relateToOperator(const char* name, TOperator op);
void dump(TInfoSink &infoSink) const;
TSymbolTableLevel* clone(TStructureMap& remapper);
TSymbolTableLevel* clone();
void readOnly();
protected:
......@@ -445,7 +443,7 @@ public:
//
TVariable* copyUp(TVariable* shared)
{
TVariable* variable = shared->clone(remapper);
TVariable* variable = shared->clone();
variable->setUniqueId(shared->getUniqueId());
table[currentLevel()]->insert(*variable);
......@@ -497,7 +495,6 @@ protected:
int uniqueId; // for unique identification in code generation
bool noBuiltInRedeclarations;
unsigned int adoptedLevels;
TStructureMap remapper; // for now, dummy for copyUp(), which is not yet used for structures
};
} // end namespace glslang
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment