Implement user-defined name hashing.

ANGLEBUG=315
Review URL: https://codereview.appspot.com/6818109

git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1469 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/OutputGLSLBase.h b/src/compiler/OutputGLSLBase.h
index efd0b5f..01e9d4a 100644
--- a/src/compiler/OutputGLSLBase.h
+++ b/src/compiler/OutputGLSLBase.h
@@ -16,7 +16,10 @@
 class TOutputGLSLBase : public TIntermTraverser
 {
 public:
-    TOutputGLSLBase(TInfoSinkBase& objSink);
+    TOutputGLSLBase(TInfoSinkBase& objSink,
+                    ShHashFunction64 hashFunction,
+                    NameMap& nameMap,
+                    TSymbolTable& symbolTable);
 
 protected:
     TInfoSinkBase& objSink() { return mObjSink; }
@@ -25,6 +28,7 @@
     virtual bool writeVariablePrecision(TPrecision precision) = 0;
     void writeFunctionParameters(const TIntermSequence& args);
     const ConstantUnion* writeConstantUnion(const TType& type, const ConstantUnion* pConstUnion);
+    TString getTypeName(const TType& type);
 
     virtual void visitSymbol(TIntermSymbol* node);
     virtual void visitConstantUnion(TIntermConstantUnion* node);
@@ -37,6 +41,15 @@
 
     void visitCodeBlock(TIntermNode* node);
 
+
+    // Return the original name if hash function pointer is NULL;
+    // otherwise return the hashed name.
+    TString hashName(const TString& name);
+    // Same as hashName(), but without hashing built-in variables.
+    TString hashVariableName(const TString& name);
+    // Same as hashName(), but without hashing built-in functions.
+    TString hashFunctionName(const TString& mangled_name);
+
 private:
     TInfoSinkBase& mObjSink;
     bool mDeclaringVariables;
@@ -48,6 +61,12 @@
     DeclaredStructs mDeclaredStructs;
 
     ForLoopUnroll mLoopUnroll;
+
+    // name hashing.
+    ShHashFunction64 mHashFunction;
+    NameMap& mNameMap;
+
+    TSymbolTable& mSymbolTable;
 };
 
 #endif  // CROSSCOMPILERGLSL_OUTPUTGLSLBASE_H_