Revert "D3D11: Use clamp wrap mode for Integer textures."

dEQP-GLES3 texture failures:

http://build.chromium.org/p/chromium.gpu.fyi/builders/Win7%20Release%20dEQP%20%28NVIDIA%29/builds/4510/steps/angle_deqp_gles3_tests/logs/stdio

dEQP-GLES3.functional.shaders.texture_functions.texture.isampler*
dEQP-GLES3.functional.shaders.texture_functions.texture.usampler*

BUG=angleproject:1244

This reverts commit 7a6a1ffeb275a8b565701305c8b42857ff2bf0b0.

Change-Id: I0e25e7aed0e0d78015d5b8f5a7b9a81e0a5fca4e
Reviewed-on: https://chromium-review.googlesource.com/316641
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/compiler/translator/OutputHLSL.cpp b/src/compiler/translator/OutputHLSL.cpp
index 36c423c..634f3df 100644
--- a/src/compiler/translator/OutputHLSL.cpp
+++ b/src/compiler/translator/OutputHLSL.cpp
@@ -1116,9 +1116,7 @@
             TString addressx = "";
             TString addressy = "";
             TString addressz = "";
-            TString closex   = "";
-            TString closey   = "";
-            TString closez   = "";
+            TString close = "";
 
             if (IsIntegerSampler(textureFunction->sampler) ||
                 textureFunction->method == TextureFunction::FETCH)
@@ -1133,23 +1131,23 @@
                 // Convert from normalized floating-point to integer
                 if (textureFunction->method != TextureFunction::FETCH)
                 {
-                    // We hard-code the clamp wrap mode for integer textures.
-                    // TODO(jmadill): Figure out how to integer texture wrap modes.
-                    addressx = "int(clamp(round((width *";
-                    addressy = "int(clamp(round((height * ";
-                    closex   = ") - 0.5f), 0.0f, width - 1.0f))";
-                    closey   = ") - 0.5f), 0.0f, height - 1.0f))";
+                    addressx = "int(floor(width * frac((";
+                    addressy = "int(floor(height * frac((";
 
                     if (IsSamplerArray(textureFunction->sampler))
                     {
                         addressz = "int(max(0, min(layers - 1, floor(0.5 + ";
-                        closez   = "))))";
                     }
-                    else if (IsSampler3D(textureFunction->sampler))
+                    else if (IsSamplerCube(textureFunction->sampler))
                     {
-                        addressz = "int(clamp(round((depth * ";
-                        closez   = ") - 0.5f), 0.0f, depth - 1.0f))";
+                        addressz = "((((";
                     }
+                    else
+                    {
+                        addressz = "int(floor(depth * frac((";
+                    }
+
+                    close = "))))";
                 }
             }
             else
@@ -1175,7 +1173,7 @@
                 }
             }
 
-            out << addressx + ("t.x" + proj) + closex + ", " + addressy + ("t.y" + proj) + closey;
+            out << addressx + ("t.x" + proj) + close + ", " + addressy + ("t.y" + proj) + close;
 
             if (mOutputType == SH_HLSL9_OUTPUT)
             {
@@ -1215,7 +1213,7 @@
                     }
                     else
                     {
-                        out << ", " + addressz + ("t.z" + proj) + closez;
+                        out << ", " + addressz + ("t.z" + proj) + close;
                     }
                 }