Fix HLSL varying struct linking.

We would always expand a struct name to always include its symbol
ID. This fixes the workaround to only affect scoped structs.
We can leave global structs, which are by definition uniquely named,
without decorating them with a symbol ID.

This fixes several tests in dEQP's shader.linkage.varying.struct.

Re-land with GLSL translator bug fixed.

BUG=angle:910

Change-Id: I23a932bd1dadea5e9aafabde697e6a2af9a43f2b
Reviewed-on: https://chromium-review.googlesource.com/249134
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Zhenyao Mo <zmo@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/UtilsHLSL.cpp b/src/compiler/translator/UtilsHLSL.cpp
index de0c36c..94e19ac 100644
--- a/src/compiler/translator/UtilsHLSL.cpp
+++ b/src/compiler/translator/UtilsHLSL.cpp
@@ -175,6 +175,13 @@
         return "";
     }
 
+    // For structures at global scope we use a consistent
+    // translation so that we can link between shader stages.
+    if (structure.atGlobalScope())
+    {
+        return Decorate(structure.name());
+    }
+
     return "ss" + str(structure.uniqueId()) + "_" + structure.name();
 }