ES31: Fix incorrect error code in DispatchComputeIndirect

INVALID_VALUE error should be generated not INVALID_OPERATION if indirect
is not a multiple of the size, in basic machine units, of uint.

Meanwhile, we put the validation of indirect before indirect buffer so that
the corresponding deqp cases can pass.

BUG=angleproject:2324

Change-Id: I223ec1893a6dd613f84e51a98f02d5f79482952f
Reviewed-on: https://chromium-review.googlesource.com/929900
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Yunchao He <yunchao.he@intel.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES31.cpp b/src/libANGLE/validationES31.cpp
index 30504b7..a7e0083 100644
--- a/src/libANGLE/validationES31.cpp
+++ b/src/libANGLE/validationES31.cpp
@@ -1431,13 +1431,6 @@
         return false;
     }
 
-    gl::Buffer *dispatchIndirectBuffer = state.getTargetBuffer(BufferBinding::DispatchIndirect);
-    if (!dispatchIndirectBuffer)
-    {
-        ANGLE_VALIDATION_ERR(context, InvalidOperation(), DispatchIndirectBufferNotBound);
-        return false;
-    }
-
     if (indirect < 0)
     {
         ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset);
@@ -1446,7 +1439,14 @@
 
     if ((indirect & (sizeof(GLuint) - 1)) != 0)
     {
-        ANGLE_VALIDATION_ERR(context, InvalidOperation(), OffsetMustBeMultipleOfUint);
+        ANGLE_VALIDATION_ERR(context, InvalidValue(), OffsetMustBeMultipleOfUint);
+        return false;
+    }
+
+    gl::Buffer *dispatchIndirectBuffer = state.getTargetBuffer(BufferBinding::DispatchIndirect);
+    if (!dispatchIndirectBuffer)
+    {
+        ANGLE_VALIDATION_ERR(context, InvalidOperation(), DispatchIndirectBufferNotBound);
         return false;
     }