Allow binding the null buffer in vertexAttribPointer if offset is 0

This commit is contained in:
Anthony Ramine 2018-08-25 14:33:40 +02:00
parent 0ba66f9f12
commit 7f9d560f28
3 changed files with 10 additions and 11 deletions

View file

@ -124,8 +124,15 @@ impl WebGLVertexArrayObjectOES {
} }
let context = self.upcast::<WebGLObject>().context(); let context = self.upcast::<WebGLObject>().context();
let buffer = context.array_buffer().ok_or(WebGLError::InvalidOperation)?; let buffer = context.array_buffer();
buffer.increment_attached_counter(); match buffer {
Some(ref buffer) => buffer.increment_attached_counter(),
None if offset != 0 => {
// https://github.com/KhronosGroup/WebGL/pull/2228
return Err(WebGLError::InvalidOperation)
},
_ => {},
}
context.send_command(WebGLCommand::VertexAttribPointer( context.send_command(WebGLCommand::VertexAttribPointer(
index, index,
size, size,
@ -146,7 +153,7 @@ impl WebGLVertexArrayObjectOES {
normalized, normalized,
stride: stride as u8, stride: stride as u8,
offset: offset as u32, offset: offset as u32,
buffer: Some(Dom::from_ref(&*buffer)), buffer: buffer.map(|b| Dom::from_ref(&*b)),
divisor: data.divisor, divisor: data.divisor,
}; };

View file

@ -1,4 +0,0 @@
[gl-vertexattribpointer.html]
[WebGL test #3: getError expected: NO_ERROR. Was INVALID_OPERATION : vertexAttribPointer should succeed if no buffer is bound and `offset` is zero.]
expected: FAIL

View file

@ -1,4 +0,0 @@
[vertexAttribPointerBadArgs.html]
[WebGL test #0: testVertexAttribPointerVBO]
expected: FAIL