summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/compiler/translator/SymbolTable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/angle/src/compiler/translator/SymbolTable.cpp')
-rwxr-xr-xgfx/angle/src/compiler/translator/SymbolTable.cpp72
1 files changed, 4 insertions, 68 deletions
diff --git a/gfx/angle/src/compiler/translator/SymbolTable.cpp b/gfx/angle/src/compiler/translator/SymbolTable.cpp
index 188f810e3..059c5c76a 100755
--- a/gfx/angle/src/compiler/translator/SymbolTable.cpp
+++ b/gfx/angle/src/compiler/translator/SymbolTable.cpp
@@ -19,38 +19,15 @@
#include <stdio.h>
#include <algorithm>
-namespace sh
-{
-
int TSymbolTable::uniqueIdCounter = 0;
-TSymbol::TSymbol(const TString *n) : uniqueId(TSymbolTable::nextUniqueId()), name(n)
-{
-}
-
//
// Functions have buried pointers to delete.
//
TFunction::~TFunction()
{
- clearParameters();
-}
-
-void TFunction::clearParameters()
-{
for (TParamList::iterator i = parameters.begin(); i != parameters.end(); ++i)
delete (*i).type;
- parameters.clear();
- mangledName = nullptr;
-}
-
-void TFunction::swapParameters(const TFunction &parametersSource)
-{
- clearParameters();
- for (auto parameter : parametersSource.parameters)
- {
- addParameter(parameter);
- }
}
const TString *TFunction::buildMangledName() const
@@ -76,6 +53,8 @@ TSymbolTableLevel::~TSymbolTableLevel()
bool TSymbolTableLevel::insert(TSymbol *symbol)
{
+ symbol->setUniqueId(TSymbolTable::nextUniqueId());
+
// returning true means symbol was added to the table
tInsertResult result = level.insert(tLevelPair(symbol->getMangledName(), symbol));
@@ -84,6 +63,8 @@ bool TSymbolTableLevel::insert(TSymbol *symbol)
bool TSymbolTableLevel::insertUnmangled(TFunction *function)
{
+ function->setUniqueId(TSymbolTable::nextUniqueId());
+
// returning true means symbol was added to the table
tInsertResult result = level.insert(tLevelPair(function->getName(), function));
@@ -126,12 +107,6 @@ TSymbol *TSymbolTable::find(const TString &name, int shaderVersion,
return symbol;
}
-TSymbol *TSymbolTable::findGlobal(const TString &name) const
-{
- ASSERT(table.size() > GLOBAL_LEVEL);
- return table[GLOBAL_LEVEL]->find(name);
-}
-
TSymbol *TSymbolTable::findBuiltIn(
const TString &name, int shaderVersion) const
{
@@ -258,43 +233,6 @@ void TSymbolTable::insertBuiltIn(ESymbolLevel level, TOperator op, const char *e
insertBuiltIn(level, gvec4 ? TCache::getType(EbtInt, 4) : rvalue, name, TCache::getType(EbtISampler2DArray), ptype2, ptype3, ptype4, ptype5);
insertBuiltIn(level, gvec4 ? TCache::getType(EbtUInt, 4) : rvalue, name, TCache::getType(EbtUSampler2DArray), ptype2, ptype3, ptype4, ptype5);
}
- else if (IsGImage(ptype1->getBasicType()))
- {
- insertUnmangledBuiltIn(name);
-
- const TType *floatType = TCache::getType(EbtFloat, 4);
- const TType *intType = TCache::getType(EbtInt, 4);
- const TType *unsignedType = TCache::getType(EbtUInt, 4);
-
- const TType *floatImage =
- TCache::getType(convertGImageToFloatImage(ptype1->getBasicType()));
- const TType *intImage = TCache::getType(convertGImageToIntImage(ptype1->getBasicType()));
- const TType *unsignedImage =
- TCache::getType(convertGImageToUnsignedImage(ptype1->getBasicType()));
-
- // GLSL ES 3.10, Revision 4, 8.12 Image Functions
- if (rvalue->getBasicType() == EbtGVec4)
- {
- // imageLoad
- insertBuiltIn(level, floatType, name, floatImage, ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, intType, name, intImage, ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, unsignedType, name, unsignedImage, ptype2, ptype3, ptype4, ptype5);
- }
- else if (rvalue->getBasicType() == EbtVoid)
- {
- // imageStore
- insertBuiltIn(level, rvalue, name, floatImage, ptype2, floatType, ptype4, ptype5);
- insertBuiltIn(level, rvalue, name, intImage, ptype2, intType, ptype4, ptype5);
- insertBuiltIn(level, rvalue, name, unsignedImage, ptype2, unsignedType, ptype4, ptype5);
- }
- else
- {
- // imageSize
- insertBuiltIn(level, rvalue, name, floatImage, ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, rvalue, name, intImage, ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, rvalue, name, unsignedImage, ptype2, ptype3, ptype4, ptype5);
- }
- }
else if (IsGenType(rvalue) || IsGenType(ptype1) || IsGenType(ptype2) || IsGenType(ptype3))
{
ASSERT(!ptype4 && !ptype5);
@@ -367,5 +305,3 @@ TPrecision TSymbolTable::getDefaultPrecision(TBasicType type) const
}
return prec;
}
-
-} // namespace sh