Fix decorating ViewID_OVR in HLSL output

ViewID_OVR should not be decorated in HLSL output since it is an
internal variable. Make sure that DecorateVariableIfNeeded() is used
for varyings instead of just Decorate() so that the internalness is
checked correctly and ViewID_OVR doesn't get decorated.

This avoids possible name conflicts between the internal ViewID_OVR
and any user-defined variables named ViewID_OVR.

BUG=angleproject:2062
TEST=angle_end2end_tests, angle_unittests

Change-Id: I9ed9876d4b2c760e7a11b0b270a2190993e840e5
Reviewed-on: https://chromium-review.googlesource.com/1143398
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index a9610f4..5e8e2cb 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -453,12 +453,11 @@
     for (const auto &varying : mReferencedVaryings)
     {
         const TType &type           = varying.second->getType();
-        const ImmutableString &name = varying.second->name();
 
         // Program linking depends on this exact format
         out << "static " << InterpolationString(type.getQualifier()) << " " << TypeString(type)
-            << " " << Decorate(name) << ArrayString(type) << " = " << zeroInitializer(type)
-            << ";\n";
+            << " " << DecorateVariableIfNeeded(*varying.second) << ArrayString(type) << " = "
+            << zeroInitializer(type) << ";\n";
     }
 }
 
@@ -958,8 +957,8 @@
         else if (IsVarying(qualifier))
         {
             mReferencedVaryings[uniqueId.get()] = &variable;
-            out << Decorate(name);
-            if (name == "ViewID_OVR")
+            out << DecorateVariableIfNeeded(variable);
+            if (variable.symbolType() == SymbolType::AngleInternal && name == "ViewID_OVR")
             {
                 mUsesViewID = true;
             }