Commit 78174db7 by Olli Etuaho

Replace EvqInternal with a separate flag to make it more flexible

The internal flag disables decorating a given symbol in output, effectively placing it to a different namespace than user-defined symbols. This enables the compiler to insert symbols to the tree when transforming it to be suitable for HLSL output without running into name conflicts. In this patch the flag is separated from the qualifiers since sometimes different qualifiers need to be used with these internal symbols. TEST=angle_unittests, angle_end2end_tests, WebGL conformance tests BUG=angleproject:941 Change-Id: I7036bed98fdb1478a383bb959ca03b42c3cb8100 Reviewed-on: https://chromium-review.googlesource.com/266690Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Tested-by: 's avatarOlli Etuaho <oetuaho@nvidia.com>
parent 822fa84e
......@@ -286,7 +286,6 @@ enum TQualifier
{
EvqTemporary, // For temporaries (within a function), read/write
EvqGlobal, // For globals read/write
EvqInternal, // For internal use, not visible to the user
EvqConst, // User defined constants and non-output parameters in functions
EvqAttribute, // Readonly
EvqVaryingIn, // readonly, fragment shaders only
......
......@@ -212,7 +212,8 @@ class TIntermSymbol : public TIntermTyped
// per compile it is essential to use "symbol = sym" to assign to symbol
TIntermSymbol(int id, const TString &symbol, const TType &type)
: TIntermTyped(type),
mId(id)
mId(id),
mInternal(false)
{
mSymbol = symbol;
}
......@@ -224,12 +225,16 @@ class TIntermSymbol : public TIntermTyped
void setId(int newId) { mId = newId; }
bool isInternal() const { return mInternal; }
void setInternal(bool isInternal) { mInternal = isInternal; }
virtual void traverse(TIntermTraverser *);
virtual TIntermSymbol *getAsSymbolNode() { return this; }
virtual bool replaceChildNode(TIntermNode *, TIntermNode *) { return false; }
protected:
int mId;
bool mInternal;
TString mSymbol;
};
......
......@@ -1389,7 +1389,7 @@ void OutputHLSL::visitSymbol(TIntermSymbol *node)
mUsesFragDepth = true;
out << "gl_Depth";
}
else if (qualifier == EvqInternal)
else if (node->isInternal())
{
out << name;
}
......
......@@ -34,8 +34,10 @@ class ElseBlockRewriter : public TIntermTraverser
TIntermSymbol *MakeNewTemporary(const TString &name, TBasicType type)
{
TType variableType(type, EbpHigh, EvqInternal);
return new TIntermSymbol(-1, name, variableType);
TType variableType(type, EbpHigh, EvqTemporary);
TIntermSymbol *node = new TIntermSymbol(-1, name, variableType);
node->setInternal(true);
return node;
}
TIntermBinary *MakeNewBinary(TOperator op, TIntermTyped *left, TIntermTyped *right, const TType &resultType)
......
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