Fix glGetActiveUniform for samplers
TRAC #13522
Original patch by Jim Hauxwell, fixed for full test suite conformance.
Signed-off-by: Daniel Koch

Author:    Nicolas Capens

git-svn-id: https://angleproject.googlecode.com/svn/trunk@421 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/Program.cpp b/src/libGLESv2/Program.cpp
index 4479396..ef96603 100644
--- a/src/libGLESv2/Program.cpp
+++ b/src/libGLESv2/Program.cpp
@@ -595,7 +595,9 @@
     Uniform *targetUniform = mUniforms[mUniformIndex[location].index];
     targetUniform->dirty = true;
 
-    if (targetUniform->type == GL_INT)
+    if (targetUniform->type == GL_INT ||
+        targetUniform->type == GL_SAMPLER_2D ||
+        targetUniform->type == GL_SAMPLER_CUBE)
     {
         int arraySize = targetUniform->arraySize;
 
@@ -949,6 +951,8 @@
               case GL_FLOAT_MAT2: applyUniformMatrix2fv(location, arraySize, f); break;
               case GL_FLOAT_MAT3: applyUniformMatrix3fv(location, arraySize, f); break;
               case GL_FLOAT_MAT4: applyUniformMatrix4fv(location, arraySize, f); break;
+              case GL_SAMPLER_2D:
+              case GL_SAMPLER_CUBE:
               case GL_INT:        applyUniform1iv(location, arraySize, i);       break;
               case GL_INT_VEC2:   applyUniform2iv(location, arraySize, i);       break;
               case GL_INT_VEC3:   applyUniform3iv(location, arraySize, i);       break;
@@ -1737,10 +1741,16 @@
         switch (constantDescription.Type)
         {
           case D3DXPT_SAMPLER2D:
+            switch (constantDescription.Columns)
+            {
+              case 1: return new Uniform(GL_SAMPLER_2D, name, constantDescription.Elements);
+              default: UNREACHABLE();
+            }
+            break;
           case D3DXPT_SAMPLERCUBE:
             switch (constantDescription.Columns)
             {
-              case 1: return new Uniform(GL_INT, name, constantDescription.Elements);
+              case 1: return new Uniform(GL_SAMPLER_CUBE, name, constantDescription.Elements);
               default: UNREACHABLE();
             }
             break;
diff --git a/src/libGLESv2/utilities.cpp b/src/libGLESv2/utilities.cpp
index d85d090..d0fe398 100644
--- a/src/libGLESv2/utilities.cpp
+++ b/src/libGLESv2/utilities.cpp
@@ -25,6 +25,8 @@
       case GL_BOOL:
       case GL_FLOAT:
       case GL_INT:
+      case GL_SAMPLER_2D:
+      case GL_SAMPLER_CUBE:
           return 1;
       case GL_BOOL_VEC2:
       case GL_FLOAT_VEC2:
@@ -68,6 +70,8 @@
       case GL_FLOAT_MAT4:
           return GL_FLOAT;
       case GL_INT:
+      case GL_SAMPLER_2D:
+      case GL_SAMPLER_CUBE:
       case GL_INT_VEC2:
       case GL_INT_VEC3:
       case GL_INT_VEC4: