Commit 02f20dd8 by Jamie Madill

Fix compile error regressions in OutputGLSL and OutputESSL.

These were broken back with the symbol table changes. TRAC #23857 Signed-off-by: Nicolas Capens Signed-off-by: Shannon Woods
parent 88f18f45
// //
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -10,8 +10,9 @@ TOutputESSL::TOutputESSL(TInfoSinkBase& objSink, ...@@ -10,8 +10,9 @@ TOutputESSL::TOutputESSL(TInfoSinkBase& objSink,
ShArrayIndexClampingStrategy clampingStrategy, ShArrayIndexClampingStrategy clampingStrategy,
ShHashFunction64 hashFunction, ShHashFunction64 hashFunction,
NameMap& nameMap, NameMap& nameMap,
TSymbolTable& symbolTable) TSymbolTable& symbolTable,
: TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable) int shaderVersion)
: TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable, shaderVersion)
{ {
} }
......
// //
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -16,7 +16,8 @@ public: ...@@ -16,7 +16,8 @@ public:
ShArrayIndexClampingStrategy clampingStrategy, ShArrayIndexClampingStrategy clampingStrategy,
ShHashFunction64 hashFunction, ShHashFunction64 hashFunction,
NameMap& nameMap, NameMap& nameMap,
TSymbolTable& symbolTable); TSymbolTable& symbolTable,
int shaderVersion);
protected: protected:
virtual bool writeVariablePrecision(TPrecision precision); virtual bool writeVariablePrecision(TPrecision precision);
......
// //
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -10,8 +10,9 @@ TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink, ...@@ -10,8 +10,9 @@ TOutputGLSL::TOutputGLSL(TInfoSinkBase& objSink,
ShArrayIndexClampingStrategy clampingStrategy, ShArrayIndexClampingStrategy clampingStrategy,
ShHashFunction64 hashFunction, ShHashFunction64 hashFunction,
NameMap& nameMap, NameMap& nameMap,
TSymbolTable& symbolTable) TSymbolTable& symbolTable,
: TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable) int shaderVersion)
: TOutputGLSLBase(objSink, clampingStrategy, hashFunction, nameMap, symbolTable, shaderVersion)
{ {
} }
......
// //
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -16,11 +16,12 @@ public: ...@@ -16,11 +16,12 @@ public:
ShArrayIndexClampingStrategy clampingStrategy, ShArrayIndexClampingStrategy clampingStrategy,
ShHashFunction64 hashFunction, ShHashFunction64 hashFunction,
NameMap& nameMap, NameMap& nameMap,
TSymbolTable& symbolTable); TSymbolTable& symbolTable,
int shaderVersion);
protected: protected:
virtual bool writeVariablePrecision(TPrecision); virtual bool writeVariablePrecision(TPrecision);
virtual bool visitSymbol(TIntermSymbol* node); virtual void visitSymbol(TIntermSymbol* node);
}; };
#endif // CROSSCOMPILERGLSL_OUTPUTGLSL_H_ #endif // CROSSCOMPILERGLSL_OUTPUTGLSL_H_
// //
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -43,14 +43,16 @@ TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase& objSink, ...@@ -43,14 +43,16 @@ TOutputGLSLBase::TOutputGLSLBase(TInfoSinkBase& objSink,
ShArrayIndexClampingStrategy clampingStrategy, ShArrayIndexClampingStrategy clampingStrategy,
ShHashFunction64 hashFunction, ShHashFunction64 hashFunction,
NameMap& nameMap, NameMap& nameMap,
TSymbolTable& symbolTable) TSymbolTable& symbolTable,
int shaderVersion)
: TIntermTraverser(true, true, true), : TIntermTraverser(true, true, true),
mObjSink(objSink), mObjSink(objSink),
mDeclaringVariables(false), mDeclaringVariables(false),
mClampingStrategy(clampingStrategy), mClampingStrategy(clampingStrategy),
mHashFunction(hashFunction), mHashFunction(hashFunction),
mNameMap(nameMap), mNameMap(nameMap),
mSymbolTable(symbolTable) mSymbolTable(symbolTable),
mShaderVersion(shaderVersion)
{ {
} }
...@@ -256,7 +258,7 @@ bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary* node) ...@@ -256,7 +258,7 @@ bool TOutputGLSLBase::visitBinary(Visit visit, TIntermBinary* node)
const TField* field = structure->fields()[index->getIConst(0)]; const TField* field = structure->fields()[index->getIConst(0)];
TString fieldName = field->name(); TString fieldName = field->name();
if (!mSymbolTable.findBuiltIn(structure->name())) if (!mSymbolTable.findBuiltIn(structure->name(), mShaderVersion))
fieldName = hashName(fieldName); fieldName = hashName(fieldName);
out << fieldName; out << fieldName;
...@@ -777,7 +779,7 @@ TString TOutputGLSLBase::hashName(const TString& name) ...@@ -777,7 +779,7 @@ TString TOutputGLSLBase::hashName(const TString& name)
TString TOutputGLSLBase::hashVariableName(const TString& name) TString TOutputGLSLBase::hashVariableName(const TString& name)
{ {
if (mSymbolTable.findBuiltIn(name) != NULL) if (mSymbolTable.findBuiltIn(name, mShaderVersion) != NULL)
return name; return name;
return hashName(name); return hashName(name);
} }
...@@ -785,7 +787,7 @@ TString TOutputGLSLBase::hashVariableName(const TString& name) ...@@ -785,7 +787,7 @@ TString TOutputGLSLBase::hashVariableName(const TString& name)
TString TOutputGLSLBase::hashFunctionName(const TString& mangled_name) TString TOutputGLSLBase::hashFunctionName(const TString& mangled_name)
{ {
TString name = TFunction::unmangleName(mangled_name); TString name = TFunction::unmangleName(mangled_name);
if (mSymbolTable.findBuiltIn(mangled_name) != NULL || name == "main") if (mSymbolTable.findBuiltIn(mangled_name, mShaderVersion) != NULL || name == "main")
return name; return name;
return hashName(name); return hashName(name);
} }
......
// //
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -20,7 +20,8 @@ public: ...@@ -20,7 +20,8 @@ public:
ShArrayIndexClampingStrategy clampingStrategy, ShArrayIndexClampingStrategy clampingStrategy,
ShHashFunction64 hashFunction, ShHashFunction64 hashFunction,
NameMap& nameMap, NameMap& nameMap,
TSymbolTable& symbolTable); TSymbolTable& symbolTable,
int shaderVersion);
protected: protected:
TInfoSinkBase& objSink() { return mObjSink; } TInfoSinkBase& objSink() { return mObjSink; }
...@@ -74,6 +75,8 @@ private: ...@@ -74,6 +75,8 @@ private:
NameMap& mNameMap; NameMap& mNameMap;
TSymbolTable& mSymbolTable; TSymbolTable& mSymbolTable;
const int mShaderVersion;
}; };
#endif // CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_ #endif // CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_
// //
// Copyright (c) 2002-2011 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -26,7 +26,7 @@ void TranslatorESSL::translate(TIntermNode* root) { ...@@ -26,7 +26,7 @@ void TranslatorESSL::translate(TIntermNode* root) {
getArrayBoundsClamper().OutputClampingFunctionDefinition(sink); getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
// Write translated shader. // Write translated shader.
TOutputESSL outputESSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable()); TOutputESSL outputESSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable(), getShaderVersion());
root->traverse(&outputESSL); root->traverse(&outputESSL);
} }
......
// //
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -39,6 +39,6 @@ void TranslatorGLSL::translate(TIntermNode* root) { ...@@ -39,6 +39,6 @@ void TranslatorGLSL::translate(TIntermNode* root) {
getArrayBoundsClamper().OutputClampingFunctionDefinition(sink); getArrayBoundsClamper().OutputClampingFunctionDefinition(sink);
// Write translated shader. // Write translated shader.
TOutputGLSL outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable()); TOutputGLSL outputGLSL(sink, getArrayIndexClampingStrategy(), getHashFunction(), getNameMap(), getSymbolTable(), getShaderVersion());
root->traverse(&outputGLSL); root->traverse(&outputGLSL);
} }
// //
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. // Copyright (c) 2002-2013 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
// - matrix constructors taking matrix as argument. // - matrix constructors taking matrix as argument.
// - array as "out" function parameters // - array as "out" function parameters
// //
// TODO: ES3 equivalent versions of GLSL
class TVersionGLSL : public TIntermTraverser { class TVersionGLSL : public TIntermTraverser {
public: public:
TVersionGLSL(ShShaderType type); TVersionGLSL(ShShaderType type);
......
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