Handle the new error case with VAOs introduced in GLES 3 involving a user VAO and non-null data pointers.

TRAC #23392

Signed-off-by: Shannon Woods
Signed-off-by: Geoff Lang
Authored-by: Jamie Madill
diff --git a/src/libGLESv2/libGLESv2.cpp b/src/libGLESv2/libGLESv2.cpp
index e860dd6..931d74e 100644
--- a/src/libGLESv2/libGLESv2.cpp
+++ b/src/libGLESv2/libGLESv2.cpp
@@ -8146,6 +8146,15 @@
 
         if (context)
         {
+            // [OpenGL ES 3.0.2] Section 2.8 page 24:
+            // An INVALID_OPERATION error is generated when a non-zero vertex array object
+            // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point,
+            // and the pointer argument is not NULL.
+            if (context->getVertexArrayHandle() != 0 && context->getArrayBufferHandle() == 0 && ptr != NULL)
+            {
+                return gl::error(GL_INVALID_OPERATION);
+            }
+
             context->setVertexAttribState(index, context->getArrayBuffer(), size, type,
                                           normalized == GL_TRUE, false, stride, ptr);
         }
@@ -9624,6 +9633,15 @@
 
         if (context)
         {
+            // [OpenGL ES 3.0.2] Section 2.8 page 24:
+            // An INVALID_OPERATION error is generated when a non-zero vertex array object
+            // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point,
+            // and the pointer argument is not NULL.
+            if (context->getVertexArrayHandle() != 0 && context->getArrayBufferHandle() == 0 && pointer != NULL)
+            {
+                return gl::error(GL_INVALID_OPERATION);
+            }
+
             context->setVertexAttribState(index, context->getArrayBuffer(), size, type, false, true,
                                           stride, pointer);
         }