Move shader variables into the base impl.

These variable types apply across shader types. Either we'll want a
way to cache them after we query them, or we'll do a pre-parse pass
similar to our current Chromium GLSL to GLSL pre-pass where we store
the variables in ANGLE. In either case, they're shared across GL
implementations so make sense as queries from gl::Shader.

BUG=angle:731

Change-Id: I23f5541423abb4af87a2bc2fc1e9f4047fd2ff90
Reviewed-on: https://chromium-review.googlesource.com/214870
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libGLESv2/renderer/d3d/DynamicHLSL.cpp b/src/libGLESv2/renderer/d3d/DynamicHLSL.cpp
index a83ed54..7086f47 100644
--- a/src/libGLESv2/renderer/d3d/DynamicHLSL.cpp
+++ b/src/libGLESv2/renderer/d3d/DynamicHLSL.cpp
@@ -218,9 +218,11 @@
 
     std::set<std::string> packedVaryings;
 
-    for (unsigned int varyingIndex = 0; varyingIndex < fragmentShader->mVaryings.size(); varyingIndex++)
+    std::vector<gl::PackedVarying> &fragmentVaryings = fragmentShader->getVaryings();
+    std::vector<gl::PackedVarying> &vertexVaryings = vertexShader->getVaryings();
+    for (unsigned int varyingIndex = 0; varyingIndex < fragmentVaryings.size(); varyingIndex++)
     {
-        PackedVarying *varying = &fragmentShader->mVaryings[varyingIndex];
+        PackedVarying *varying = &fragmentVaryings[varyingIndex];
         if (packVarying(varying, maxVaryingVectors, packing))
         {
             packedVaryings.insert(varying->name);
@@ -238,9 +240,9 @@
         if (packedVaryings.find(transformFeedbackVarying) == packedVaryings.end())
         {
             bool found = false;
-            for (unsigned int varyingIndex = 0; varyingIndex < vertexShader->mVaryings.size(); varyingIndex++)
+            for (unsigned int varyingIndex = 0; varyingIndex < vertexVaryings.size(); varyingIndex++)
             {
-                PackedVarying *varying = &vertexShader->mVaryings[varyingIndex];
+                PackedVarying *varying = &vertexVaryings[varyingIndex];
                 if (transformFeedbackVarying == varying->name)
                 {
                     if (!packVarying(varying, maxVaryingVectors, packing))
@@ -281,9 +283,10 @@
     std::string varyingSemantic = getVaryingSemantic(shader->mUsesPointSize);
     std::string varyingHLSL;
 
-    for (unsigned int varyingIndex = 0; varyingIndex < shader->mVaryings.size(); varyingIndex++)
+    std::vector<gl::PackedVarying> &varyings = shader->getVaryings();
+    for (unsigned int varyingIndex = 0; varyingIndex < varyings.size(); varyingIndex++)
     {
-        const PackedVarying &varying = shader->mVaryings[varyingIndex];
+        const PackedVarying &varying = varyings[varyingIndex];
         if (varying.registerAssigned())
         {
             GLenum transposedType = TransposeMatrixType(varying.type);
@@ -608,7 +611,7 @@
                                           std::vector<LinkedVarying> *linkedVaryings) const
 {
     const std::string &varyingSemantic = getVaryingSemantic(vertexShader->mUsesPointSize);
-    const std::vector<PackedVarying> &varyings = vertexShader->mVaryings;
+    const std::vector<PackedVarying> &varyings = vertexShader->getVaryings();
 
     for (unsigned int varyingIndex = 0; varyingIndex < varyings.size(); varyingIndex++)
     {
@@ -723,9 +726,10 @@
         vertexHLSL += "    output.gl_FragCoord = gl_Position;\n";
     }
 
-    for (unsigned int vertVaryingIndex = 0; vertVaryingIndex < vertexShader->mVaryings.size(); vertVaryingIndex++)
+    const std::vector<PackedVarying> &vertexVaryings = vertexShader->getVaryings();
+    for (unsigned int vertVaryingIndex = 0; vertVaryingIndex < vertexVaryings.size(); vertVaryingIndex++)
     {
-        const PackedVarying &varying = vertexShader->mVaryings[vertVaryingIndex];
+        const PackedVarying &varying = vertexVaryings[vertVaryingIndex];
         if (varying.registerAssigned())
         {
             for (unsigned int elementIndex = 0; elementIndex < varying.elementCount(); elementIndex++)
@@ -813,7 +817,7 @@
     {
         defineOutputVariables(fragmentShader, programOutputVars);
 
-        const std::vector<sh::Attribute> &shaderOutputVars = fragmentShader->getOutputVariables();
+        const std::vector<sh::Attribute> &shaderOutputVars = fragmentShader->getActiveOutputVariables();
         for (auto locationIt = programOutputVars->begin(); locationIt != programOutputVars->end(); locationIt++)
         {
             const VariableLocation &outputLocation = locationIt->second;
@@ -897,9 +901,10 @@
         }
     }
 
-    for (unsigned int varyingIndex = 0; varyingIndex < fragmentShader->mVaryings.size(); varyingIndex++)
+    const std::vector<PackedVarying> &fragmentVaryings = fragmentShader->getVaryings();
+    for (unsigned int varyingIndex = 0; varyingIndex < fragmentVaryings.size(); varyingIndex++)
     {
-        const PackedVarying &varying = fragmentShader->mVaryings[varyingIndex];
+        const PackedVarying &varying = fragmentVaryings[varyingIndex];
         if (varying.registerAssigned())
         {
             for (unsigned int elementIndex = 0; elementIndex < varying.elementCount(); elementIndex++)
@@ -953,7 +958,7 @@
 
 void DynamicHLSL::defineOutputVariables(rx::FragmentShaderD3D *fragmentShader, std::map<int, VariableLocation> *programOutputVars) const
 {
-    const std::vector<sh::Attribute> &shaderOutputVars = fragmentShader->getOutputVariables();
+    const std::vector<sh::Attribute> &shaderOutputVars = fragmentShader->getActiveOutputVariables();
 
     for (unsigned int outputVariableIndex = 0; outputVariableIndex < shaderOutputVars.size(); outputVariableIndex++)
     {