Re-land "Compute packed varyings in ProgramD3D only."

Instead of storing varying information in the shader, use a temporary
set when linking a D3D program. This also means we won't have to
modify information in the Shader object when linking a D3D program.

This completes the refactoring for PackedVaryings.

Re-land with fix for missing init of PackedVarying::vertexOnly.

BUG=angleproject:1123

Change-Id: If110809c3817d88b0370ac575d739d7385b067d9
Reviewed-on: https://chromium-review.googlesource.com/296731
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/util/shader_utils.cpp b/util/shader_utils.cpp
index f311304..3d79a43 100644
--- a/util/shader_utils.cpp
+++ b/util/shader_utils.cpp
@@ -69,7 +69,11 @@
     return CompileShader(type, source);
 }
 
-GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource)
+GLuint CompileProgramWithTransformFeedback(
+    const std::string &vsSource,
+    const std::string &fsSource,
+    const std::vector<std::string> &transformFeedbackVaryings,
+    GLenum bufferMode)
 {
     GLuint program = glCreateProgram();
 
@@ -90,6 +94,19 @@
     glAttachShader(program, fs);
     glDeleteShader(fs);
 
+    if (transformFeedbackVaryings.size() > 0)
+    {
+        std::vector<const char *> constCharTFVaryings;
+
+        for (const std::string &transformFeedbackVarying : transformFeedbackVaryings)
+        {
+            constCharTFVaryings.push_back(transformFeedbackVarying.c_str());
+        }
+
+        glTransformFeedbackVaryings(program, static_cast<GLsizei>(transformFeedbackVaryings.size()),
+                                    &constCharTFVaryings[0], bufferMode);
+    }
+
     glLinkProgram(program);
 
     GLint linkStatus;
@@ -112,6 +129,12 @@
     return program;
 }
 
+GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource)
+{
+    std::vector<std::string> emptyVector;
+    return CompileProgramWithTransformFeedback(vsSource, fsSource, emptyVector, GL_NONE);
+}
+
 GLuint CompileProgramFromFiles(const std::string &vsPath, const std::string &fsPath)
 {
     std::string vsSource = ReadFileToString(vsPath);