Properly allow more than FUNC_ADD in blendEquationSeparate

This commit is contained in:
Anthony Ramine 2018-04-04 15:43:09 +02:00
parent 15272d2c3b
commit fc6335c01d

View file

@ -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));
}