Generate unique HLSL texture function names for external textures.

Because 2D and external textures have the same HLSL texture type, they were
generating texture functions with the same name.  This causes conflicts when
both 2D and external textures are used in the same shader.

BUG=angleproject:1534
BUG=645532

Change-Id: I4b324014b7d9b4851d358730cf4e31fc8461584c
Reviewed-on: https://chromium-review.googlesource.com/388551
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/compiler/translator/TextureFunctionHLSL.cpp b/src/compiler/translator/TextureFunctionHLSL.cpp
index 6580f25..a071900 100644
--- a/src/compiler/translator/TextureFunctionHLSL.cpp
+++ b/src/compiler/translator/TextureFunctionHLSL.cpp
@@ -1113,32 +1113,8 @@
 
 bool TextureFunctionHLSL::TextureFunction::operator<(const TextureFunction &rhs) const
 {
-    if (sampler < rhs.sampler)
-        return true;
-    if (sampler > rhs.sampler)
-        return false;
-
-    if (coords < rhs.coords)
-        return true;
-    if (coords > rhs.coords)
-        return false;
-
-    if (!proj && rhs.proj)
-        return true;
-    if (proj && !rhs.proj)
-        return false;
-
-    if (!offset && rhs.offset)
-        return true;
-    if (offset && !rhs.offset)
-        return false;
-
-    if (method < rhs.method)
-        return true;
-    if (method > rhs.method)
-        return false;
-
-    return false;
+    return std::tie(sampler, coords, proj, offset, method) <
+           std::tie(rhs.sampler, rhs.coords, rhs.proj, rhs.offset, rhs.method);
 }
 
 TString TextureFunctionHLSL::useTextureFunction(const TString &name,
diff --git a/src/compiler/translator/UtilsHLSL.cpp b/src/compiler/translator/UtilsHLSL.cpp
index b3a065f..221d5d9 100644
--- a/src/compiler/translator/UtilsHLSL.cpp
+++ b/src/compiler/translator/UtilsHLSL.cpp
@@ -173,6 +173,8 @@
             return "Cube_int4_";
         case EbtUSamplerCube:
             return "Cube_uint4_";
+        case EbtSamplerExternalOES:
+            return "_External";
         default:
             // All other types are identified by their group suffix
             return TextureGroupSuffix(type);