Bug 1325500 - Require size=4 for packed int types. - r=daoshengmu
MozReview-Commit-ID: DXtxRGTjR8x
--- a/dom/canvas/WebGLContextValidate.cpp
+++ b/dom/canvas/WebGLContextValidate.cpp
@@ -357,16 +357,26 @@ WebGLContext::ValidateAttribPointer(bool
MOZ_ASSERT(IsPowerOfTwo(requiredAlignment));
GLsizei requiredAlignmentMask = requiredAlignment - 1;
if (size < 1 || size > 4) {
ErrorInvalidValue("%s: invalid element size", info);
return false;
}
+ switch (type) {
+ case LOCAL_GL_INT_2_10_10_10_REV:
+ case LOCAL_GL_UNSIGNED_INT_2_10_10_10_REV:
+ if (size != 4) {
+ ErrorInvalidOperation("%s: size must be 4 for this type.", info);
+ return false;
+ }
+ break;
+ }
+
// see WebGL spec section 6.6 "Vertex Attribute Data Stride"
if (stride < 0 || stride > 255) {
ErrorInvalidValue("%s: negative or too large stride", info);
return false;
}
if (byteOffset < 0) {
ErrorInvalidValue("%s: negative offset", info);