mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Implement a missing INVALID_OPERATION check in DrawArrays
This commit is contained in:
parent
2a9c2bc8fd
commit
3229c62282
3 changed files with 24 additions and 23 deletions
|
@ -2137,24 +2137,28 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
constants::POINTS | constants::LINE_STRIP |
|
constants::POINTS | constants::LINE_STRIP |
|
||||||
constants::LINE_LOOP | constants::LINES |
|
constants::LINE_LOOP | constants::LINES |
|
||||||
constants::TRIANGLE_STRIP | constants::TRIANGLE_FAN |
|
constants::TRIANGLE_STRIP | constants::TRIANGLE_FAN |
|
||||||
constants::TRIANGLES => {
|
constants::TRIANGLES => {},
|
||||||
if self.current_program.get().is_none() {
|
_ => {
|
||||||
return self.webgl_error(InvalidOperation);
|
return self.webgl_error(InvalidEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if first < 0 || count < 0 {
|
|
||||||
return self.webgl_error(InvalidValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if !self.validate_framebuffer_complete() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.send_command(WebGLCommand::DrawArrays(mode, first, count));
|
|
||||||
self.mark_as_dirty();
|
|
||||||
},
|
|
||||||
_ => self.webgl_error(InvalidEnum),
|
|
||||||
}
|
}
|
||||||
|
if first < 0 || count < 0 {
|
||||||
|
return self.webgl_error(InvalidValue);
|
||||||
|
}
|
||||||
|
if self.current_program.get().is_none() {
|
||||||
|
return self.webgl_error(InvalidOperation);
|
||||||
|
}
|
||||||
|
if let Some(array_buffer) = self.bound_buffer_array.get() {
|
||||||
|
if count > 0 && (first as u64 + count as u64 > array_buffer.capacity() as u64) {
|
||||||
|
return self.webgl_error(InvalidOperation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !self.validate_framebuffer_complete() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.send_command(WebGLCommand::DrawArrays(mode, first, count));
|
||||||
|
self.mark_as_dirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[drawArraysOutOfBounds.html]
|
|
||||||
type: testharness
|
|
||||||
[WebGL test #0: testDrawArraysEmpty]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
[draw-arrays-out-of-bounds.html]
|
[draw-arrays-out-of-bounds.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
expected: TIMEOUT
|
[WebGL test #12: getError expected: INVALID_OPERATION. Was NO_ERROR : after evaluating: gl.drawArrays(gl.TRIANGLES, 3, 2)]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue