Add support for non-square matrix uniforms. Depends on implementing shader support for the same.

TRAC #22839

Signed-off-by: Geoff Lang
Signed-off-by: Shanon Woods
Author: Jamie Madill

git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2138 736b8ea6-26fd-11df-bfd4-992fa37f6226
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index 48e0015..bd2501a 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -7411,6 +7411,16 @@
 
     try
     {
+        if (count < 0)
+        {
+            return gl::error(GL_INVALID_VALUE);
+        }
+
+        if (location == -1)
+        {
+            return;
+        }
+
         gl::Context *context = gl::getNonLostContext();
 
         if (context)
@@ -7419,9 +7429,18 @@
             {
                 return gl::error(GL_INVALID_OPERATION);
             }
-        }
 
-        UNIMPLEMENTED();
+            gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+            if (!programBinary)
+            {
+                return gl::error(GL_INVALID_OPERATION);
+            }
+
+            if (!programBinary->setUniformMatrix2x3fv(location, count, value))
+            {
+                return gl::error(GL_INVALID_OPERATION);
+            }
+        }
     }
     catch(std::bad_alloc&)
     {
@@ -7436,6 +7455,16 @@
 
     try
     {
+        if (count < 0)
+        {
+            return gl::error(GL_INVALID_VALUE);
+        }
+
+        if (location == -1)
+        {
+            return;
+        }
+
         gl::Context *context = gl::getNonLostContext();
 
         if (context)
@@ -7444,9 +7473,18 @@
             {
                 return gl::error(GL_INVALID_OPERATION);
             }
-        }
 
-        UNIMPLEMENTED();
+            gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+            if (!programBinary)
+            {
+                return gl::error(GL_INVALID_OPERATION);
+            }
+
+            if (!programBinary->setUniformMatrix3x2fv(location, count, value))
+            {
+                return gl::error(GL_INVALID_OPERATION);
+            }
+        }
     }
     catch(std::bad_alloc&)
     {
@@ -7461,6 +7499,16 @@
 
     try
     {
+        if (count < 0)
+        {
+            return gl::error(GL_INVALID_VALUE);
+        }
+
+        if (location == -1)
+        {
+            return;
+        }
+
         gl::Context *context = gl::getNonLostContext();
 
         if (context)
@@ -7469,9 +7517,18 @@
             {
                 return gl::error(GL_INVALID_OPERATION);
             }
-        }
 
-        UNIMPLEMENTED();
+            gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+            if (!programBinary)
+            {
+                return gl::error(GL_INVALID_OPERATION);
+            }
+
+            if (!programBinary->setUniformMatrix2x4fv(location, count, value))
+            {
+                return gl::error(GL_INVALID_OPERATION);
+            }
+        }
     }
     catch(std::bad_alloc&)
     {
@@ -7486,6 +7543,16 @@
 
     try
     {
+        if (count < 0)
+        {
+            return gl::error(GL_INVALID_VALUE);
+        }
+
+        if (location == -1)
+        {
+            return;
+        }
+
         gl::Context *context = gl::getNonLostContext();
 
         if (context)
@@ -7494,9 +7561,18 @@
             {
                 return gl::error(GL_INVALID_OPERATION);
             }
-        }
 
-        UNIMPLEMENTED();
+            gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+            if (!programBinary)
+            {
+                return gl::error(GL_INVALID_OPERATION);
+            }
+
+            if (!programBinary->setUniformMatrix4x2fv(location, count, value))
+            {
+                return gl::error(GL_INVALID_OPERATION);
+            }
+        }
     }
     catch(std::bad_alloc&)
     {
@@ -7511,6 +7587,16 @@
 
     try
     {
+        if (count < 0)
+        {
+            return gl::error(GL_INVALID_VALUE);
+        }
+
+        if (location == -1)
+        {
+            return;
+        }
+
         gl::Context *context = gl::getNonLostContext();
 
         if (context)
@@ -7519,9 +7605,18 @@
             {
                 return gl::error(GL_INVALID_OPERATION);
             }
-        }
 
-        UNIMPLEMENTED();
+            gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+            if (!programBinary)
+            {
+                return gl::error(GL_INVALID_OPERATION);
+            }
+
+            if (!programBinary->setUniformMatrix3x4fv(location, count, value))
+            {
+                return gl::error(GL_INVALID_OPERATION);
+            }
+        }
     }
     catch(std::bad_alloc&)
     {
@@ -7536,6 +7631,16 @@
 
     try
     {
+        if (count < 0)
+        {
+            return gl::error(GL_INVALID_VALUE);
+        }
+
+        if (location == -1)
+        {
+            return;
+        }
+
         gl::Context *context = gl::getNonLostContext();
 
         if (context)
@@ -7544,9 +7649,18 @@
             {
                 return gl::error(GL_INVALID_OPERATION);
             }
-        }
 
-        UNIMPLEMENTED();
+            gl::ProgramBinary *programBinary = context->getCurrentProgramBinary();
+            if (!programBinary)
+            {
+                return gl::error(GL_INVALID_OPERATION);
+            }
+
+            if (!programBinary->setUniformMatrix4x3fv(location, count, value))
+            {
+                return gl::error(GL_INVALID_OPERATION);
+            }
+        }
     }
     catch(std::bad_alloc&)
     {