Commit 1bb8528c by Olli Etuaho Committed by Commit Bot

Remove TFunctionSymbolInfo from TIntermAggregate

All the information stored in TFunctionSymbolInfo was duplicated from the TFunction that the aggregate node pointed to. BUG=angleproject:2267 TEST=angle_unittests Change-Id: I1f5574ab0416e5cae00c3dae6fc11d2fe1fa128c Reviewed-on: https://chromium-review.googlesource.com/827065Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent 340b5771
...@@ -119,7 +119,7 @@ class PullGradient : public TIntermTraverser ...@@ -119,7 +119,7 @@ class PullGradient : public TIntermTraverser
{ {
if (node->getOp() == EOpCallFunctionInAST) if (node->getOp() == EOpCallFunctionInAST)
{ {
size_t calleeIndex = mDag.findIndex(node->getFunctionSymbolInfo()); size_t calleeIndex = mDag.findIndex(node->getFunction()->uniqueId());
ASSERT(calleeIndex != CallDAG::InvalidIndex && calleeIndex < mIndex); ASSERT(calleeIndex != CallDAG::InvalidIndex && calleeIndex < mIndex);
if ((*mMetadataList)[calleeIndex].mUsesGradient) if ((*mMetadataList)[calleeIndex].mUsesGradient)
...@@ -129,7 +129,7 @@ class PullGradient : public TIntermTraverser ...@@ -129,7 +129,7 @@ class PullGradient : public TIntermTraverser
} }
else if (node->getOp() == EOpCallBuiltInFunction) else if (node->getOp() == EOpCallBuiltInFunction)
{ {
if (mGradientBuiltinFunctions.find(node->getFunctionSymbolInfo()->getName()) != if (mGradientBuiltinFunctions.find(*node->getFunction()->name()) !=
mGradientBuiltinFunctions.end()) mGradientBuiltinFunctions.end())
{ {
onGradient(); onGradient();
...@@ -288,7 +288,7 @@ class PullComputeDiscontinuousAndGradientLoops : public TIntermTraverser ...@@ -288,7 +288,7 @@ class PullComputeDiscontinuousAndGradientLoops : public TIntermTraverser
{ {
if (visit == PreVisit && node->getOp() == EOpCallFunctionInAST) if (visit == PreVisit && node->getOp() == EOpCallFunctionInAST)
{ {
size_t calleeIndex = mDag.findIndex(node->getFunctionSymbolInfo()); size_t calleeIndex = mDag.findIndex(node->getFunction()->uniqueId());
ASSERT(calleeIndex != CallDAG::InvalidIndex && calleeIndex < mIndex); ASSERT(calleeIndex != CallDAG::InvalidIndex && calleeIndex < mIndex);
if ((*mMetadataList)[calleeIndex].mHasGradientLoopInCallGraph) if ((*mMetadataList)[calleeIndex].mHasGradientLoopInCallGraph)
...@@ -367,7 +367,7 @@ class PushDiscontinuousLoops : public TIntermTraverser ...@@ -367,7 +367,7 @@ class PushDiscontinuousLoops : public TIntermTraverser
case EOpCallFunctionInAST: case EOpCallFunctionInAST:
if (visit == PreVisit && mNestedDiscont > 0) if (visit == PreVisit && mNestedDiscont > 0)
{ {
size_t calleeIndex = mDag.findIndex(node->getFunctionSymbolInfo()); size_t calleeIndex = mDag.findIndex(node->getFunction()->uniqueId());
ASSERT(calleeIndex != CallDAG::InvalidIndex && calleeIndex < mIndex); ASSERT(calleeIndex != CallDAG::InvalidIndex && calleeIndex < mIndex);
(*mMetadataList)[calleeIndex].mCalledInDiscontinuousLoop = true; (*mMetadataList)[calleeIndex].mCalledInDiscontinuousLoop = true;
......
...@@ -287,9 +287,9 @@ CallDAG::~CallDAG() ...@@ -287,9 +287,9 @@ CallDAG::~CallDAG()
const size_t CallDAG::InvalidIndex = std::numeric_limits<size_t>::max(); const size_t CallDAG::InvalidIndex = std::numeric_limits<size_t>::max();
size_t CallDAG::findIndex(const TFunctionSymbolInfo *functionInfo) const size_t CallDAG::findIndex(const TSymbolUniqueId &id) const
{ {
auto it = mFunctionIdToIndex.find(functionInfo->getId().get()); auto it = mFunctionIdToIndex.find(id.get());
if (it == mFunctionIdToIndex.end()) if (it == mFunctionIdToIndex.end())
{ {
...@@ -307,13 +307,6 @@ const CallDAG::Record &CallDAG::getRecordFromIndex(size_t index) const ...@@ -307,13 +307,6 @@ const CallDAG::Record &CallDAG::getRecordFromIndex(size_t index) const
return mRecords[index]; return mRecords[index];
} }
const CallDAG::Record &CallDAG::getRecord(const TIntermAggregate *function) const
{
size_t index = findIndex(function->getFunctionSymbolInfo());
ASSERT(index != InvalidIndex && index < mRecords.size());
return mRecords[index];
}
size_t CallDAG::size() const size_t CallDAG::size() const
{ {
return mRecords.size(); return mRecords.size();
......
...@@ -58,10 +58,9 @@ class CallDAG : angle::NonCopyable ...@@ -58,10 +58,9 @@ class CallDAG : angle::NonCopyable
InitResult init(TIntermNode *root, TDiagnostics *diagnostics); InitResult init(TIntermNode *root, TDiagnostics *diagnostics);
// Returns InvalidIndex if the function wasn't found // Returns InvalidIndex if the function wasn't found
size_t findIndex(const TFunctionSymbolInfo *functionInfo) const; size_t findIndex(const TSymbolUniqueId &id) const;
const Record &getRecordFromIndex(size_t index) const; const Record &getRecordFromIndex(size_t index) const;
const Record &getRecord(const TIntermAggregate *function) const;
size_t size() const; size_t size() const;
void clear(); void clear();
......
...@@ -1008,7 +1008,7 @@ class TCompiler::UnusedPredicate ...@@ -1008,7 +1008,7 @@ class TCompiler::UnusedPredicate
return false; return false;
} }
size_t callDagIndex = mCallDag->findIndex(functionInfo); size_t callDagIndex = mCallDag->findIndex(functionInfo->getId());
if (callDagIndex == CallDAG::InvalidIndex) if (callDagIndex == CallDAG::InvalidIndex)
{ {
// This happens only for unimplemented prototypes which are thus unused // This happens only for unimplemented prototypes which are thus unused
......
...@@ -148,6 +148,11 @@ TName::TName(const TString *name) : mName(name ? (*name) : ""), mIsInternal(fals ...@@ -148,6 +148,11 @@ TName::TName(const TString *name) : mName(name ? (*name) : ""), mIsInternal(fals
{ {
} }
TName::TName(const TSymbol *symbol)
: mName(*symbol->name()), mIsInternal(symbol->symbolType() == SymbolType::AngleInternal)
{
}
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// //
// Member functions of the nodes used for building the tree. // Member functions of the nodes used for building the tree.
...@@ -336,10 +341,7 @@ TIntermAggregate::TIntermAggregate(const TFunction *func, ...@@ -336,10 +341,7 @@ TIntermAggregate::TIntermAggregate(const TFunction *func,
{ {
mArguments.swap(*arguments); mArguments.swap(*arguments);
} }
if (mFunction) ASSERT(mFunction == nullptr || mFunction->symbolType() != SymbolType::Empty);
{
mFunctionInfo.setFromFunction(*mFunction);
}
setTypePrecisionAndQualifier(type); setTypePrecisionAndQualifier(type);
} }
...@@ -454,7 +456,7 @@ void TIntermAggregate::setBuiltInFunctionPrecision() ...@@ -454,7 +456,7 @@ void TIntermAggregate::setBuiltInFunctionPrecision()
} }
// ESSL 3.0 spec section 8: textureSize always gets highp precision. // ESSL 3.0 spec section 8: textureSize always gets highp precision.
// All other functions that take a sampler are assumed to be texture functions. // All other functions that take a sampler are assumed to be texture functions.
if (mFunctionInfo.getName().find("textureSize") == 0) if (mFunction->name()->find("textureSize") == 0)
mType.setPrecision(EbpHigh); mType.setPrecision(EbpHigh);
else else
mType.setPrecision(precision); mType.setPrecision(precision);
...@@ -468,7 +470,7 @@ TString TIntermAggregate::getSymbolTableMangledName() const ...@@ -468,7 +470,7 @@ TString TIntermAggregate::getSymbolTableMangledName() const
case EOpCallInternalRawFunction: case EOpCallInternalRawFunction:
case EOpCallBuiltInFunction: case EOpCallBuiltInFunction:
case EOpCallFunctionInAST: case EOpCallFunctionInAST:
return TFunction::GetMangledNameFromCall(mFunctionInfo.getName(), mArguments); return TFunction::GetMangledNameFromCall(*mFunction->name(), mArguments);
default: default:
TString opString = GetOperatorString(mOp); TString opString = GetOperatorString(mOp);
return TFunction::GetMangledNameFromCall(opString, mArguments); return TFunction::GetMangledNameFromCall(opString, mArguments);
...@@ -642,7 +644,6 @@ TIntermAggregate::TIntermAggregate(const TIntermAggregate &node) ...@@ -642,7 +644,6 @@ TIntermAggregate::TIntermAggregate(const TIntermAggregate &node)
: TIntermOperator(node), : TIntermOperator(node),
mUseEmulatedFunction(node.mUseEmulatedFunction), mUseEmulatedFunction(node.mUseEmulatedFunction),
mGotPrecisionFromChildren(node.mGotPrecisionFromChildren), mGotPrecisionFromChildren(node.mGotPrecisionFromChildren),
mFunctionInfo(node.mFunctionInfo),
mFunction(node.mFunction) mFunction(node.mFunction)
{ {
for (TIntermNode *arg : node.mArguments) for (TIntermNode *arg : node.mArguments)
...@@ -659,7 +660,6 @@ TIntermAggregate *TIntermAggregate::shallowCopy() const ...@@ -659,7 +660,6 @@ TIntermAggregate *TIntermAggregate::shallowCopy() const
TIntermSequence *copySeq = new TIntermSequence(); TIntermSequence *copySeq = new TIntermSequence();
copySeq->insert(copySeq->begin(), getSequence()->begin(), getSequence()->end()); copySeq->insert(copySeq->begin(), getSequence()->begin(), getSequence()->end());
TIntermAggregate *copyNode = new TIntermAggregate(mFunction, mType, mOp, copySeq); TIntermAggregate *copyNode = new TIntermAggregate(mFunction, mType, mOp, copySeq);
copyNode->mFunctionInfo = mFunctionInfo;
copyNode->setLine(mLine); copyNode->setLine(mLine);
return copyNode; return copyNode;
} }
......
...@@ -67,6 +67,7 @@ class TName ...@@ -67,6 +67,7 @@ class TName
public: public:
POOL_ALLOCATOR_NEW_DELETE(); POOL_ALLOCATOR_NEW_DELETE();
explicit TName(const TString *name); explicit TName(const TString *name);
explicit TName(const TSymbol *symbol);
TName() : mName(), mIsInternal(false) {} TName() : mName(), mIsInternal(false) {}
TName(const TName &) = default; TName(const TName &) = default;
TName &operator=(const TName &) = default; TName &operator=(const TName &) = default;
...@@ -542,11 +543,6 @@ class TFunctionSymbolInfo ...@@ -542,11 +543,6 @@ class TFunctionSymbolInfo
void setId(const TSymbolUniqueId &functionId); void setId(const TSymbolUniqueId &functionId);
const TSymbolUniqueId &getId() const; const TSymbolUniqueId &getId() const;
bool isImageFunction() const
{
return getName() == "imageSize" || getName() == "imageLoad" || getName() == "imageStore";
}
private: private:
TName mName; TName mName;
TSymbolUniqueId *mId; TSymbolUniqueId *mId;
...@@ -625,8 +621,6 @@ class TIntermAggregate : public TIntermOperator, public TIntermAggregateBase ...@@ -625,8 +621,6 @@ class TIntermAggregate : public TIntermOperator, public TIntermAggregateBase
// Returns true if changing parameter precision may affect the return value. // Returns true if changing parameter precision may affect the return value.
bool gotPrecisionFromChildren() const { return mGotPrecisionFromChildren; } bool gotPrecisionFromChildren() const { return mGotPrecisionFromChildren; }
const TFunctionSymbolInfo *getFunctionSymbolInfo() const { return &mFunctionInfo; }
const TFunction *getFunction() const { return mFunction; } const TFunction *getFunction() const { return mFunction; }
// Get the function name to display to the user in an error message. // Get the function name to display to the user in an error message.
...@@ -641,9 +635,6 @@ class TIntermAggregate : public TIntermOperator, public TIntermAggregateBase ...@@ -641,9 +635,6 @@ class TIntermAggregate : public TIntermOperator, public TIntermAggregateBase
bool mGotPrecisionFromChildren; bool mGotPrecisionFromChildren;
// TODO(oetuaho): Get rid of mFunctionInfo and just keep mFunction.
TFunctionSymbolInfo mFunctionInfo;
const TFunction *const mFunction; const TFunction *const mFunction;
private: private:
......
...@@ -185,14 +185,13 @@ void TLValueTrackingTraverser::addToFunctionMap(const TSymbolUniqueId &id, ...@@ -185,14 +185,13 @@ void TLValueTrackingTraverser::addToFunctionMap(const TSymbolUniqueId &id,
bool TLValueTrackingTraverser::isInFunctionMap(const TIntermAggregate *callNode) const bool TLValueTrackingTraverser::isInFunctionMap(const TIntermAggregate *callNode) const
{ {
ASSERT(callNode->getOp() == EOpCallFunctionInAST); ASSERT(callNode->getOp() == EOpCallFunctionInAST);
return (mFunctionMap.find(callNode->getFunctionSymbolInfo()->getId().get()) != return (mFunctionMap.find(callNode->getFunction()->uniqueId().get()) != mFunctionMap.end());
mFunctionMap.end());
} }
TIntermSequence *TLValueTrackingTraverser::getFunctionParameters(const TIntermAggregate *callNode) TIntermSequence *TLValueTrackingTraverser::getFunctionParameters(const TIntermAggregate *callNode)
{ {
ASSERT(isInFunctionMap(callNode)); ASSERT(isInFunctionMap(callNode));
return mFunctionMap[callNode->getFunctionSymbolInfo()->getId().get()]; return mFunctionMap[callNode->getFunction()->uniqueId().get()];
} }
void TLValueTrackingTraverser::setInFunctionCallOutParameter(bool inOutParameter) void TLValueTrackingTraverser::setInFunctionCallOutParameter(bool inOutParameter)
......
...@@ -938,11 +938,11 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -938,11 +938,11 @@ bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node)
{ {
if (node->getOp() == EOpCallBuiltInFunction) if (node->getOp() == EOpCallBuiltInFunction)
{ {
out << translateTextureFunction(node->getFunctionSymbolInfo()->getName()); out << translateTextureFunction(*node->getFunction()->name());
} }
else else
{ {
out << hashFunctionNameIfNeeded(*node->getFunctionSymbolInfo()); out << hashFunctionNameIfNeeded(node->getFunction());
} }
out << "("; out << "(";
} }
...@@ -1143,6 +1143,18 @@ TString TOutputGLSLBase::hashVariableName(const TName &name) ...@@ -1143,6 +1143,18 @@ TString TOutputGLSLBase::hashVariableName(const TName &name)
return hashName(name); return hashName(name);
} }
TString TOutputGLSLBase::hashFunctionNameIfNeeded(const TFunction *func)
{
if (func->isMain())
{
return *func->name();
}
else
{
return hashName(TName(func));
}
}
TString TOutputGLSLBase::hashFunctionNameIfNeeded(const TFunctionSymbolInfo &info) TString TOutputGLSLBase::hashFunctionNameIfNeeded(const TFunctionSymbolInfo &info)
{ {
if (info.isMain()) if (info.isMain())
......
...@@ -72,6 +72,7 @@ class TOutputGLSLBase : public TIntermTraverser ...@@ -72,6 +72,7 @@ class TOutputGLSLBase : public TIntermTraverser
// Same as hashName(), but without hashing built-in variables. // Same as hashName(), but without hashing built-in variables.
TString hashVariableName(const TName &name); TString hashVariableName(const TName &name);
// Same as hashName(), but without hashing internal functions or "main". // Same as hashName(), but without hashing internal functions or "main".
TString hashFunctionNameIfNeeded(const TFunction *func);
TString hashFunctionNameIfNeeded(const TFunctionSymbolInfo &info); TString hashFunctionNameIfNeeded(const TFunctionSymbolInfo &info);
// Used to translate function names for differences between ESSL and GLSL // Used to translate function names for differences between ESSL and GLSL
virtual TString translateTextureFunction(const TString &name) { return name; } virtual TString translateTextureFunction(const TString &name) { return name; }
......
...@@ -1723,7 +1723,7 @@ bool OutputHLSL::visitFunctionDefinition(Visit visit, TIntermFunctionDefinition ...@@ -1723,7 +1723,7 @@ bool OutputHLSL::visitFunctionDefinition(Visit visit, TIntermFunctionDefinition
ASSERT(mCurrentFunctionMetadata == nullptr); ASSERT(mCurrentFunctionMetadata == nullptr);
size_t index = mCallDag.findIndex(node->getFunctionSymbolInfo()); size_t index = mCallDag.findIndex(node->getFunctionSymbolInfo()->getId());
ASSERT(index != CallDAG::InvalidIndex); ASSERT(index != CallDAG::InvalidIndex);
mCurrentFunctionMetadata = &mASTMetadataList[index]; mCurrentFunctionMetadata = &mASTMetadataList[index];
...@@ -1851,7 +1851,7 @@ bool OutputHLSL::visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *n ...@@ -1851,7 +1851,7 @@ bool OutputHLSL::visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *n
TInfoSinkBase &out = getInfoSink(); TInfoSinkBase &out = getInfoSink();
ASSERT(visit == PreVisit); ASSERT(visit == PreVisit);
size_t index = mCallDag.findIndex(node->getFunctionSymbolInfo()); size_t index = mCallDag.findIndex(node->getFunctionSymbolInfo()->getId());
// Skip the prototype if it is not implemented (and thus not used) // Skip the prototype if it is not implemented (and thus not used)
if (index == CallDAG::InvalidIndex) if (index == CallDAG::InvalidIndex)
{ {
...@@ -1910,11 +1910,11 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -1910,11 +1910,11 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
{ {
UNIMPLEMENTED(); UNIMPLEMENTED();
} }
size_t index = mCallDag.findIndex(node->getFunctionSymbolInfo()); size_t index = mCallDag.findIndex(node->getFunction()->uniqueId());
ASSERT(index != CallDAG::InvalidIndex); ASSERT(index != CallDAG::InvalidIndex);
lod0 &= mASTMetadataList[index].mNeedsLod0; lod0 &= mASTMetadataList[index].mNeedsLod0;
out << DecorateFunctionIfNeeded(node->getFunctionSymbolInfo()->getNameObj()); out << DecorateFunctionIfNeeded(TName(node->getFunction()));
out << DisambiguateFunctionName(node->getSequence()); out << DisambiguateFunctionName(node->getSequence());
out << (lod0 ? "Lod0(" : "("); out << (lod0 ? "Lod0(" : "(");
} }
...@@ -1922,20 +1922,20 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -1922,20 +1922,20 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
{ {
// This path is used for internal functions that don't have their definitions in the // This path is used for internal functions that don't have their definitions in the
// AST, such as precision emulation functions. // AST, such as precision emulation functions.
out << DecorateFunctionIfNeeded(node->getFunctionSymbolInfo()->getNameObj()) << "("; out << DecorateFunctionIfNeeded(TName(node->getFunction())) << "(";
} }
else if (node->getFunctionSymbolInfo()->isImageFunction()) else if (node->getFunction()->isImageFunction())
{ {
TString name = node->getFunctionSymbolInfo()->getName(); const TString *name = node->getFunction()->name();
TType type = (*arguments)[0]->getAsTyped()->getType(); TType type = (*arguments)[0]->getAsTyped()->getType();
TString imageFunctionName = mImageFunctionHLSL->useImageFunction( TString imageFunctionName = mImageFunctionHLSL->useImageFunction(
name, type.getBasicType(), type.getLayoutQualifier().imageInternalFormat, *name, type.getBasicType(), type.getLayoutQualifier().imageInternalFormat,
type.getMemoryQualifier().readonly); type.getMemoryQualifier().readonly);
out << imageFunctionName << "("; out << imageFunctionName << "(";
} }
else else
{ {
const TString &name = node->getFunctionSymbolInfo()->getName(); const TString *name = node->getFunction()->name();
TBasicType samplerType = (*arguments)[0]->getAsTyped()->getType().getBasicType(); TBasicType samplerType = (*arguments)[0]->getAsTyped()->getType().getBasicType();
int coords = 0; // textureSize(gsampler2DMS) doesn't have a second argument. int coords = 0; // textureSize(gsampler2DMS) doesn't have a second argument.
if (arguments->size() > 1) if (arguments->size() > 1)
...@@ -1943,7 +1943,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -1943,7 +1943,7 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node)
coords = (*arguments)[1]->getAsTyped()->getNominalSize(); coords = (*arguments)[1]->getAsTyped()->getNominalSize();
} }
TString textureFunctionName = mTextureFunctionHLSL->useTextureFunction( TString textureFunctionName = mTextureFunctionHLSL->useTextureFunction(
name, samplerType, coords, arguments->size(), lod0, mShaderType); *name, samplerType, coords, arguments->size(), lod0, mShaderType);
out << textureFunctionName << "("; out << textureFunctionName << "(";
} }
......
...@@ -20,6 +20,14 @@ void OutputFunction(TInfoSinkBase &out, const char *str, const TFunctionSymbolIn ...@@ -20,6 +20,14 @@ void OutputFunction(TInfoSinkBase &out, const char *str, const TFunctionSymbolIn
<< info->getId().get() << ")"; << info->getId().get() << ")";
} }
void OutputFunction(TInfoSinkBase &out, const char *str, const TFunction *func)
{
const char *internal =
(func->symbolType() == SymbolType::AngleInternal) ? " (internal function)" : "";
out << str << internal << ": " << *func->name() << " (symbol id " << func->uniqueId().get()
<< ")";
}
// Two purposes: // Two purposes:
// 1. Show an example of how to iterate tree. Functions can also directly call traverse() on // 1. Show an example of how to iterate tree. Functions can also directly call traverse() on
// children themselves to have finer grained control over the process than shown here, though // children themselves to have finer grained control over the process than shown here, though
...@@ -379,14 +387,14 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -379,14 +387,14 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node)
switch (node->getOp()) switch (node->getOp())
{ {
case EOpCallFunctionInAST: case EOpCallFunctionInAST:
OutputFunction(mOut, "Call an user-defined function", node->getFunctionSymbolInfo()); OutputFunction(mOut, "Call an user-defined function", node->getFunction());
break; break;
case EOpCallInternalRawFunction: case EOpCallInternalRawFunction:
OutputFunction(mOut, "Call an internal function with raw implementation", OutputFunction(mOut, "Call an internal function with raw implementation",
node->getFunctionSymbolInfo()); node->getFunction());
break; break;
case EOpCallBuiltInFunction: case EOpCallBuiltInFunction:
OutputFunction(mOut, "Call a built-in function", node->getFunctionSymbolInfo()); OutputFunction(mOut, "Call a built-in function", node->getFunction());
break; break;
case EOpConstruct: case EOpConstruct:
......
...@@ -5483,7 +5483,7 @@ TIntermBranch *TParseContext::addBranch(TOperator op, ...@@ -5483,7 +5483,7 @@ TIntermBranch *TParseContext::addBranch(TOperator op,
void TParseContext::checkTextureGather(TIntermAggregate *functionCall) void TParseContext::checkTextureGather(TIntermAggregate *functionCall)
{ {
ASSERT(functionCall->getOp() == EOpCallBuiltInFunction); ASSERT(functionCall->getOp() == EOpCallBuiltInFunction);
const TString &name = functionCall->getFunctionSymbolInfo()->getName(); const TString &name = *functionCall->getFunction()->name();
bool isTextureGather = (name == "textureGather"); bool isTextureGather = (name == "textureGather");
bool isTextureGatherOffset = (name == "textureGatherOffset"); bool isTextureGatherOffset = (name == "textureGatherOffset");
if (isTextureGather || isTextureGatherOffset) if (isTextureGather || isTextureGatherOffset)
...@@ -5549,7 +5549,7 @@ void TParseContext::checkTextureGather(TIntermAggregate *functionCall) ...@@ -5549,7 +5549,7 @@ void TParseContext::checkTextureGather(TIntermAggregate *functionCall)
void TParseContext::checkTextureOffsetConst(TIntermAggregate *functionCall) void TParseContext::checkTextureOffsetConst(TIntermAggregate *functionCall)
{ {
ASSERT(functionCall->getOp() == EOpCallBuiltInFunction); ASSERT(functionCall->getOp() == EOpCallBuiltInFunction);
const TString &name = functionCall->getFunctionSymbolInfo()->getName(); const TString &name = *functionCall->getFunction()->name();
TIntermNode *offset = nullptr; TIntermNode *offset = nullptr;
TIntermSequence *arguments = functionCall->getSequence(); TIntermSequence *arguments = functionCall->getSequence();
bool useTextureGatherOffsetConstraints = false; bool useTextureGatherOffsetConstraints = false;
...@@ -5625,7 +5625,8 @@ void TParseContext::checkTextureOffsetConst(TIntermAggregate *functionCall) ...@@ -5625,7 +5625,8 @@ void TParseContext::checkTextureOffsetConst(TIntermAggregate *functionCall)
void TParseContext::checkAtomicMemoryBuiltinFunctions(TIntermAggregate *functionCall) void TParseContext::checkAtomicMemoryBuiltinFunctions(TIntermAggregate *functionCall)
{ {
const TString &name = functionCall->getFunctionSymbolInfo()->getName(); ASSERT(functionCall->getOp() == EOpCallBuiltInFunction);
const TString &name = *functionCall->getFunction()->name();
if (IsAtomicBuiltin(name)) if (IsAtomicBuiltin(name))
{ {
TIntermSequence *arguments = functionCall->getSequence(); TIntermSequence *arguments = functionCall->getSequence();
...@@ -5648,7 +5649,7 @@ void TParseContext::checkAtomicMemoryBuiltinFunctions(TIntermAggregate *function ...@@ -5648,7 +5649,7 @@ void TParseContext::checkAtomicMemoryBuiltinFunctions(TIntermAggregate *function
error(memNode->getLine(), error(memNode->getLine(),
"The value passed to the mem argument of an atomic memory function does not " "The value passed to the mem argument of an atomic memory function does not "
"correspond to a buffer or shared variable.", "correspond to a buffer or shared variable.",
functionCall->getFunctionSymbolInfo()->getName().c_str()); functionCall->getFunction()->name()->c_str());
} }
} }
...@@ -5656,7 +5657,7 @@ void TParseContext::checkAtomicMemoryBuiltinFunctions(TIntermAggregate *function ...@@ -5656,7 +5657,7 @@ void TParseContext::checkAtomicMemoryBuiltinFunctions(TIntermAggregate *function
void TParseContext::checkImageMemoryAccessForBuiltinFunctions(TIntermAggregate *functionCall) void TParseContext::checkImageMemoryAccessForBuiltinFunctions(TIntermAggregate *functionCall)
{ {
ASSERT(functionCall->getOp() == EOpCallBuiltInFunction); ASSERT(functionCall->getOp() == EOpCallBuiltInFunction);
const TString &name = functionCall->getFunctionSymbolInfo()->getName(); const TString &name = *functionCall->getFunction()->name();
if (name.compare(0, 5, "image") == 0) if (name.compare(0, 5, "image") == 0)
{ {
......
...@@ -72,7 +72,7 @@ bool Traverser::visitAggregate(Visit visit, TIntermAggregate *node) ...@@ -72,7 +72,7 @@ bool Traverser::visitAggregate(Visit visit, TIntermAggregate *node)
return true; return true;
} }
if (node->getFunctionSymbolInfo()->getName() != "texelFetchOffset") if (*node->getFunction()->name() != "texelFetchOffset")
{ {
return true; return true;
} }
......
...@@ -183,4 +183,15 @@ const TString &TFunction::GetMangledNameFromCall(const TString &functionName, ...@@ -183,4 +183,15 @@ const TString &TFunction::GetMangledNameFromCall(const TString &functionName,
return *NewPoolTString(newName.c_str()); return *NewPoolTString(newName.c_str());
} }
bool TFunction::isMain() const
{
return symbolType() == SymbolType::UserDefined && *name() == "main";
}
bool TFunction::isImageFunction() const
{
return symbolType() == SymbolType::BuiltIn &&
(*name() == "imageSize" || *name() == "imageLoad" || *name() == "imageStore");
}
} // namespace sh } // namespace sh
...@@ -225,6 +225,9 @@ class TFunction : public TSymbol ...@@ -225,6 +225,9 @@ class TFunction : public TSymbol
bool isKnownToNotHaveSideEffects() const { return mKnownToNotHaveSideEffects; } bool isKnownToNotHaveSideEffects() const { return mKnownToNotHaveSideEffects; }
bool isMain() const;
bool isImageFunction() const;
private: private:
void clearParameters(); void clearParameters();
......
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