Skip to content

Commit

Permalink
Properly allow more than FUNC_ADD in blendEquationSeparate
Browse files Browse the repository at this point in the history
  • Loading branch information
nox committed Apr 4, 2018
1 parent 15272d2 commit fc6335c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions components/script/dom/webglrenderingcontext.rs
Expand Up @@ -1482,17 +1482,25 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
constants::FUNC_SUBTRACT |
constants::FUNC_REVERSE_SUBTRACT => {
self.send_command(WebGLCommand::BlendEquation(mode))
},
_ => self.webgl_error(InvalidEnum)
}
_ => self.webgl_error(InvalidEnum),
}
}

// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
fn BlendEquationSeparate(&self, mode_rgb: u32, mode_alpha: u32) {
if mode_rgb != constants::FUNC_ADD || mode_alpha != constants::FUNC_ADD {
return self.webgl_error(InvalidEnum);
match mode_rgb {
constants::FUNC_ADD |
constants::FUNC_SUBTRACT |
constants::FUNC_REVERSE_SUBTRACT => {},
_ => return self.webgl_error(InvalidEnum),
}
match mode_alpha {
constants::FUNC_ADD |
constants::FUNC_SUBTRACT |
constants::FUNC_REVERSE_SUBTRACT => {},
_ => return self.webgl_error(InvalidEnum),
}

self.send_command(WebGLCommand::BlendEquationSeparate(mode_rgb, mode_alpha));
}

Expand Down

0 comments on commit fc6335c

Please sign in to comment.