Apply WebGL validation to glVertexAttribIPointer.

TEST=deqp/functional/gles3/shaderstatequery.html
BUG=angleproject:1523
BUG=chromium:668223

Change-Id: I24230144f8529d84cdbde3d5a8ad9178481550a9
Reviewed-on: https://chromium-review.googlesource.com/458680
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/libANGLE/validationES2.cpp b/src/libANGLE/validationES2.cpp
index ebe6352..c17e0f8 100644
--- a/src/libANGLE/validationES2.cpp
+++ b/src/libANGLE/validationES2.cpp
@@ -3988,38 +3988,8 @@
             return false;
         }
 
-        // WebGL 1.0 [Section 6.11] Vertex Attribute Data Stride
-        // The WebGL API supports vertex attribute data strides up to 255 bytes. A call to
-        // vertexAttribPointer will generate an INVALID_VALUE error if the value for the stride
-        // parameter exceeds 255.
-        constexpr GLsizei kMaxWebGLStride = 255;
-        if (stride > kMaxWebGLStride)
+        if (!ValidateWebGLVertexAttribPointer(context, type, normalized, stride, ptr, false))
         {
-            context->handleError(
-                Error(GL_INVALID_VALUE, "Stride is over the maximum stride allowed by WebGL."));
-            return false;
-        }
-
-        // WebGL 1.0 [Section 6.4] Buffer Offset and Stride Requirements
-        // The offset arguments to drawElements and vertexAttribPointer, and the stride argument to
-        // vertexAttribPointer, must be a multiple of the size of the data type passed to the call,
-        // or an INVALID_OPERATION error is generated.
-        VertexFormatType internalType = GetVertexFormatType(type, normalized, 1, false);
-        size_t typeSize = GetVertexFormatTypeSize(internalType);
-
-        ASSERT(isPow2(typeSize) && typeSize > 0);
-        size_t sizeMask = (typeSize - 1);
-        if ((reinterpret_cast<intptr_t>(ptr) & sizeMask) != 0)
-        {
-            context->handleError(
-                Error(GL_INVALID_OPERATION, "Offset is not a multiple of the type size."));
-            return false;
-        }
-
-        if ((stride & sizeMask) != 0)
-        {
-            context->handleError(
-                Error(GL_INVALID_OPERATION, "Stride is not a multiple of the type size."));
             return false;
         }
     }