Fix non statically used fragment input structs on HLSL

Add static use information to struct fields that mirrors the static
use information on the struct itself. This way dynamically generated
HLSL doesn't need special handling for initializing fragment inputs
if they are structs.

This fixes a problem with the previous code where dynamically
generated HLSL ended up trying to initialize structs that are not
declared in the HLSL output because they were not being referenced.

BUG=angleproject:2104
TEST=angle_end2end_tests

Change-Id: I21283ce4fe26515d62d95e61f8155dc9a9b44cf1
diff --git a/src/compiler/translator/VariableInfo.cpp b/src/compiler/translator/VariableInfo.cpp
index 83eba11..4d1bba5 100644
--- a/src/compiler/translator/VariableInfo.cpp
+++ b/src/compiler/translator/VariableInfo.cpp
@@ -66,6 +66,24 @@
     return nullptr;
 }
 
+// Note that this shouldn't be called for interface blocks - static use information is collected for
+// individual fields in case of interface blocks.
+void MarkStaticallyUsed(ShaderVariable *variable)
+{
+    if (!variable->staticUse)
+    {
+        if (variable->isStruct())
+        {
+            // Conservatively assume all fields are statically used as well.
+            for (auto &field : variable->fields)
+            {
+                MarkStaticallyUsed(&field);
+            }
+        }
+        variable->staticUse = true;
+    }
+}
+
 // Traverses the intermediate tree to collect all attributes, uniforms, varyings, fragment outputs,
 // and interface blocks.
 class CollectVariablesTraverser : public TIntermTraverser
@@ -406,7 +424,7 @@
     }
     if (var)
     {
-        var->staticUse = true;
+        MarkStaticallyUsed(var);
     }
 }