Fix an off-by-one error with limits.max_vertex_attribs

This commit is contained in:
Anthony Ramine 2018-03-20 14:23:34 +01:00
parent 4aaac61a87
commit 2a9c2bc8fd

View file

@ -471,7 +471,7 @@ impl WebGLRenderingContext {
} }
fn vertex_attrib(&self, indx: u32, x: f32, y: f32, z: f32, w: f32) { fn vertex_attrib(&self, indx: u32, x: f32, y: f32, z: f32, w: f32) {
if indx > self.limits.max_vertex_attribs { if indx >= self.limits.max_vertex_attribs {
return self.webgl_error(InvalidValue); return self.webgl_error(InvalidValue);
} }
@ -2223,7 +2223,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn EnableVertexAttribArray(&self, attrib_id: u32) { fn EnableVertexAttribArray(&self, attrib_id: u32) {
if attrib_id > self.limits.max_vertex_attribs { if attrib_id >= self.limits.max_vertex_attribs {
return self.webgl_error(InvalidValue); return self.webgl_error(InvalidValue);
} }
@ -2232,7 +2232,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn DisableVertexAttribArray(&self, attrib_id: u32) { fn DisableVertexAttribArray(&self, attrib_id: u32) {
if attrib_id > self.limits.max_vertex_attribs { if attrib_id >= self.limits.max_vertex_attribs {
return self.webgl_error(InvalidValue); return self.webgl_error(InvalidValue);
} }
@ -3238,7 +3238,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn VertexAttribPointer(&self, attrib_id: u32, size: i32, data_type: u32, fn VertexAttribPointer(&self, attrib_id: u32, size: i32, data_type: u32,
normalized: bool, stride: i32, offset: i64) { normalized: bool, stride: i32, offset: i64) {
if attrib_id > self.limits.max_vertex_attribs { if attrib_id >= self.limits.max_vertex_attribs {
return self.webgl_error(InvalidValue); return self.webgl_error(InvalidValue);
} }