Implemented basic GLSL ES 3.0 texture intrinsics.

TRAC #22954
Signed-off-by: Jamie Madill
Signed-off-by: Shannon Woods
Author: Nicolas Capens

git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2273 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/compiler/OutputHLSL.cpp b/src/compiler/OutputHLSL.cpp
index dd72edd..cc4f852 100644
--- a/src/compiler/OutputHLSL.cpp
+++ b/src/compiler/OutputHLSL.cpp
@@ -1775,6 +1775,7 @@
         {
             TString name = TFunction::unmangleName(node->getName());
             bool lod0 = mInsideDiscontinuousLoop || mOutputLod0Function;
+            TIntermSequence &arguments = node->getSequence();
 
             if (node->isUserDefined())
             {
@@ -1782,15 +1783,17 @@
             }
             else
             {
-                if (name == "texture2D")
+                TBasicType samplerType = arguments[0]->getAsTyped()->getType().getBasicType();
+
+                if (name == "texture2D" || (name == "texture" && samplerType == EbtSampler2D))
                 {
                     if (!lod0)
                     {
-                        if (node->getSequence().size() == 2)
+                        if (arguments.size() == 2)
                         {
                             mUsesTexture2D = true;
                         }
-                        else if (node->getSequence().size() == 3)
+                        else if (arguments.size() == 3)
                         {
                             mUsesTexture2D_bias = true;
                         }
@@ -1800,11 +1803,11 @@
                     }
                     else
                     {
-                        if (node->getSequence().size() == 2)
+                        if (arguments.size() == 2)
                         {
                             mUsesTexture2DLod0 = true;
                         }
-                        else if (node->getSequence().size() == 3)
+                        else if (arguments.size() == 3)
                         {
                             mUsesTexture2DLod0_bias = true;
                         }
@@ -1813,15 +1816,15 @@
                         out << "gl_texture2DLod0(";
                     }
                 }
-                else if (name == "texture2DProj")
+                else if (name == "texture2DProj" || (name == "textureProj" && samplerType == EbtSampler2D))
                 {
                     if (!lod0)
                     {
-                        if (node->getSequence().size() == 2)
+                        if (arguments.size() == 2)
                         {
                             mUsesTexture2DProj = true;
                         }
-                        else if (node->getSequence().size() == 3)
+                        else if (arguments.size() == 3)
                         {
                             mUsesTexture2DProj_bias = true;
                         }
@@ -1831,11 +1834,11 @@
                     }
                     else
                     {
-                        if (node->getSequence().size() == 2)
+                        if (arguments.size() == 2)
                         {
                             mUsesTexture2DProjLod0 = true;
                         }
-                        else if (node->getSequence().size() == 3)
+                        else if (arguments.size() == 3)
                         {
                             mUsesTexture2DProjLod0_bias = true;
                         }
@@ -1844,15 +1847,15 @@
                         out << "gl_texture2DProjLod0(";
                     }
                 }
-                else if (name == "textureCube")
+                else if (name == "textureCube" || (name == "texture" && samplerType == EbtSamplerCube))
                 {
                     if (!lod0)
                     {
-                        if (node->getSequence().size() == 2)
+                        if (arguments.size() == 2)
                         {
                             mUsesTextureCube = true;
                         }
-                        else if (node->getSequence().size() == 3)
+                        else if (arguments.size() == 3)
                         {
                             mUsesTextureCube_bias = true;
                         }
@@ -1862,11 +1865,11 @@
                     }
                     else
                     {
-                        if (node->getSequence().size() == 2)
+                        if (arguments.size() == 2)
                         {
                             mUsesTextureCubeLod0 = true;
                         }
-                        else if (node->getSequence().size() == 3)
+                        else if (arguments.size() == 3)
                         {
                             mUsesTextureCubeLod0_bias = true;
                         }
@@ -1875,9 +1878,9 @@
                         out << "gl_textureCubeLod0(";
                     }
                 }
-                else if (name == "texture2DLod")
+                else if (name == "texture2DLod" || (name == "textureLod" && samplerType == EbtSampler2D))
                 {
-                    if (node->getSequence().size() == 3)
+                    if (arguments.size() == 3)
                     {
                         mUsesTexture2DLod = true;
                     }
@@ -1885,9 +1888,9 @@
 
                     out << "gl_texture2DLod(";
                 }
-                else if (name == "texture2DProjLod")
+                else if (name == "texture2DProjLod" || (name == "textureProjLod" && samplerType == EbtSampler2D))
                 {
-                    if (node->getSequence().size() == 3)
+                    if (arguments.size() == 3)
                     {
                         mUsesTexture2DProjLod = true;
                     }
@@ -1895,9 +1898,9 @@
 
                     out << "gl_texture2DProjLod(";
                 }
-                else if (name == "textureCubeLod")
+                else if (name == "textureCubeLod" || (name == "textureLod" && samplerType == EbtSamplerCube))
                 {
-                    if (node->getSequence().size() == 3)
+                    if (arguments.size() == 3)
                     {
                         mUsesTextureCubeLod = true;
                     }
@@ -1907,9 +1910,7 @@
                 }
                 else UNREACHABLE();
             }
-
-            TIntermSequence &arguments = node->getSequence();
-
+            
             for (TIntermSequence::iterator arg = arguments.begin(); arg != arguments.end(); arg++)
             {
                 if (mOutputType == SH_HLSL11_OUTPUT && IsSampler((*arg)->getAsTyped()->getBasicType()))