Remove sh::Uniform::registerIndex and elementIndex.

With the previous cleanups, these fields aren't needed any longer.
We can also clean up some unused methods and simplify existing code.

BUG=angle:466

Change-Id: I96df8d152324bda5e6868b5eccdf52bdc09155e9
Reviewed-on: https://chromium-review.googlesource.com/207256
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Nicolas Capens <capn@chromium.org>
diff --git a/src/compiler/translator/UniformHLSL.cpp b/src/compiler/translator/UniformHLSL.cpp
index 7d09c96..ecc8516 100644
--- a/src/compiler/translator/UniformHLSL.cpp
+++ b/src/compiler/translator/UniformHLSL.cpp
@@ -123,12 +123,13 @@
 {
     unsigned int registerIndex = (IsSampler(type.getBasicType()) ? mSamplerRegister : mUniformRegister);
 
-    declareUniformToList(type, name, registerIndex, &mActiveUniforms);
+    GetVariableTraverser<Uniform> traverser(&mActiveUniforms);
+    traverser.traverse(type, name);
 
     const sh::Uniform &activeUniform = mActiveUniforms.back();
-    unsigned int registerCount = HLSLVariableRegisterCount(activeUniform, mOutputType);
     mUniformRegisterMap[activeUniform.name] = registerIndex;
 
+    unsigned int registerCount = HLSLVariableRegisterCount(activeUniform, mOutputType);
     if (IsSampler(type.getBasicType()))
     {
         mSamplerRegister += registerCount;
@@ -141,43 +142,6 @@
     return registerIndex;
 }
 
-class DeclareUniformsTraverser : public GetVariableTraverser<Uniform>
-{
-  public:
-    DeclareUniformsTraverser(std::vector<Uniform> *output,
-                             unsigned int registerIndex,
-                             ShShaderOutput outputType)
-        : GetVariableTraverser(output),
-          mRegisterIndex(registerIndex),
-          mOutputType(outputType)
-    {}
-
-  private:
-    virtual void visitVariable(Uniform *uniform)
-    {
-        if (!uniform->isStruct())
-        {
-            uniform->registerIndex = mRegisterIndex;
-            uniform->elementIndex = 0;
-        }
-        else
-        {
-            // Assign register offset information.
-            // This will override the offsets in any nested structures.
-            HLSLVariableGetRegisterInfo(mRegisterIndex, uniform, mOutputType);
-        }
-    }
-
-    unsigned int mRegisterIndex;
-    ShShaderOutput mOutputType;
-};
-
-void UniformHLSL::declareUniformToList(const TType &type, const TString &name, int registerIndex, std::vector<Uniform> *output)
-{
-    DeclareUniformsTraverser traverser(output, registerIndex, mOutputType);
-    traverser.traverse(type, name);
-}
-
 TString UniformHLSL::uniformsHeader(ShShaderOutput outputType, const ReferencedSymbols &referencedUniforms)
 {
     TString uniforms;
diff --git a/src/compiler/translator/UniformHLSL.h b/src/compiler/translator/UniformHLSL.h
index d21a599..835b1ef 100644
--- a/src/compiler/translator/UniformHLSL.h
+++ b/src/compiler/translator/UniformHLSL.h
@@ -48,7 +48,6 @@
 
     // Returns the uniform's register index
     unsigned int declareUniformAndAssignRegister(const TType &type, const TString &name);
-    void declareUniformToList(const TType &type, const TString &name, int registerIndex, std::vector<Uniform> *output);
 
     unsigned int mUniformRegister;
     unsigned int mInterfaceBlockRegister;
diff --git a/src/compiler/translator/util.h b/src/compiler/translator/util.h
index b9f02f8..5c214dd 100644
--- a/src/compiler/translator/util.h
+++ b/src/compiler/translator/util.h
@@ -39,13 +39,12 @@
 class GetVariableTraverser
 {
   public:
+    GetVariableTraverser(std::vector<VarT> *output);
     void traverse(const TType &type, const TString &name);
 
   protected:
-    GetVariableTraverser(std::vector<VarT> *output);
-
-    // Must be overloaded
-    virtual void visitVariable(VarT *newVar) = 0;
+    // May be overloaded
+    virtual void visitVariable(VarT *newVar) {}
 
   private:
     std::stack<std::vector<VarT> *> mOutputStack;