diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2018-04-16 16:22:42 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2018-04-16 16:23:07 +0200 |
commit | 7f1590dac07b7208c54e6caf263956afc637ea11 (patch) | |
tree | 9ee90082c393df81d4a342c338d0ad721b141ca2 | |
parent | 1c9bbce38c51c5226f407f456f29136b78d60807 (diff) | |
download | servo-7f1590dac07b7208c54e6caf263956afc637ea11.tar.gz servo-7f1590dac07b7208c54e6caf263956afc637ea11.zip |
Check mode first in gl.drawElements
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 5deace85746..6529e94de6b 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -2143,6 +2143,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11 fn DrawElements(&self, mode: u32, count: i32, type_: u32, offset: i64) { + match mode { + constants::POINTS | constants::LINE_STRIP | + constants::LINE_LOOP | constants::LINES | + constants::TRIANGLE_STRIP | constants::TRIANGLE_FAN | + constants::TRIANGLES => {}, + _ => return self.webgl_error(InvalidEnum), + } + // From the GLES 2.0.25 spec, page 21: // // "type must be one of UNSIGNED_BYTE or UNSIGNED_SHORT" @@ -2194,16 +2202,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { return; } - match mode { - constants::POINTS | constants::LINE_STRIP | - constants::LINE_LOOP | constants::LINES | - constants::TRIANGLE_STRIP | constants::TRIANGLE_FAN | - constants::TRIANGLES => { - self.send_command(WebGLCommand::DrawElements(mode, count, type_, offset)); - self.mark_as_dirty(); - }, - _ => self.webgl_error(InvalidEnum), - } + self.send_command(WebGLCommand::DrawElements(mode, count, type_, offset)); + self.mark_as_dirty(); } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 |