Add the proper API errors for pixel unpack buffers.

1. For overflowing the currently bound pixel unpack buffer in TexImage and TexSubImage calls.
2. Enforce unpack buffer offset alignment for TexImage and TexSubImage calls.
We'll have to check for currently mapped buffers when we implement map.

TRAC #23842

Signed-off-by: Geoff Lang
Signed-off-by: Shannon Woods
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index cce6c36..7347fbf 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -979,7 +979,7 @@
 
             if (context->getClientVersion() >= 3 &&
                 !ValidateES3TexImageParameters(context, target, level, internalformat, true, false,
-                                               0, 0, 0, width, height, 1, 0, GL_NONE, GL_NONE))
+                                               0, 0, 0, width, height, 1, 0, GL_NONE, GL_NONE, data))
             {
                 return;
             }
@@ -1044,7 +1044,7 @@
 
             if (context->getClientVersion() >= 3 &&
                 !ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true,
-                                               xoffset, yoffset, 0, width, height, 1, 0, GL_NONE, GL_NONE))
+                                               xoffset, yoffset, 0, width, height, 1, 0, GL_NONE, GL_NONE, data))
             {
                 return;
             }
@@ -5142,7 +5142,7 @@
 
             if (context->getClientVersion() >= 3 &&
                 !ValidateES3TexImageParameters(context, target, level, internalformat, false, false,
-                                               0, 0, 0, width, height, 1, border, format, type))
+                                               0, 0, 0, width, height, 1, border, format, type, pixels))
             {
                 return;
             }
@@ -5399,7 +5399,7 @@
 
             if (context->getClientVersion() >= 3 &&
                 !ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true,
-                                               0, 0, 0, width, height, 1, 0, format, type))
+                                               0, 0, 0, width, height, 1, 0, format, type, pixels))
             {
                 return;
             }
@@ -6392,7 +6392,7 @@
 
             // validateES3TexImageFormat sets the error code if there is an error
             if (!ValidateES3TexImageParameters(context, target, level, internalformat, false, false,
-                                               0, 0, 0, width, height, depth, border, format, type))
+                                               0, 0, 0, width, height, depth, border, format, type, pixels))
             {
                 return;
             }
@@ -6450,7 +6450,7 @@
             // validateES3TexImageFormat sets the error code if there is an error
             if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, false, true,
                                                xoffset, yoffset, zoffset, width, height, depth, 0,
-                                               format, type))
+                                               format, type, pixels))
             {
                 return;
             }
@@ -6555,7 +6555,7 @@
 
             // validateES3TexImageFormat sets the error code if there is an error
             if (!ValidateES3TexImageParameters(context, target, level, internalformat, true, false,
-                                               0, 0, 0, width, height, depth, border, GL_NONE, GL_NONE))
+                                               0, 0, 0, width, height, depth, border, GL_NONE, GL_NONE, data))
             {
                 return;
             }
@@ -6617,7 +6617,7 @@
 
             // validateES3TexImageFormat sets the error code if there is an error
             if (!ValidateES3TexImageParameters(context, target, level, GL_NONE, true, true,
-                                               0, 0, 0, width, height, depth, 0, GL_NONE, GL_NONE))
+                                               0, 0, 0, width, height, depth, 0, GL_NONE, GL_NONE, data))
             {
                 return;
             }