Fix the error for invalid arrays passed to gl.vertexAttrib*v()

This commit is contained in:
Anthony Ramine 2018-08-25 14:07:59 +02:00
parent 273aac87e4
commit 0ba66f9f12
2 changed files with 8 additions and 29 deletions

View file

@ -3643,7 +3643,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
};
if values.len() < 1 {
return self.webgl_error(InvalidOperation);
// https://github.com/KhronosGroup/WebGL/issues/2700
return self.webgl_error(InvalidValue);
}
self.vertex_attrib(indx, values[0], 0f32, 0f32, 1f32);
}
@ -3660,7 +3661,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
};
if values.len() < 2 {
return self.webgl_error(InvalidOperation);
// https://github.com/KhronosGroup/WebGL/issues/2700
return self.webgl_error(InvalidValue);
}
self.vertex_attrib(indx, values[0], values[1], 0f32, 1f32);
}
@ -3677,7 +3679,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
};
if values.len() < 3 {
return self.webgl_error(InvalidOperation);
// https://github.com/KhronosGroup/WebGL/issues/2700
return self.webgl_error(InvalidValue);
}
self.vertex_attrib(indx, values[0], values[1], values[2], 1f32);
}
@ -3694,7 +3697,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
Float32ArrayOrUnrestrictedFloatSequence::UnrestrictedFloatSequence(v) => v,
};
if values.len() < 4 {
return self.webgl_error(InvalidOperation);
// https://github.com/KhronosGroup/WebGL/issues/2700
return self.webgl_error(InvalidValue);
}
self.vertex_attrib(indx, values[0], values[1], values[2], values[3]);
}