Add GetShaderPrecisionFormat argument validation

This patch adds a check on the shader_type argument. If it is not one either
FRAGMENT_SHADER or VERTEX_SHADER, we return INVALID_ENUM.
This commit is contained in:
Josh Abraham 2018-11-17 08:18:12 -05:00
parent 369983211d
commit 4b5b3c3adb

View file

@ -2588,6 +2588,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
shader_type: u32,
precision_type: u32,
) -> Option<DomRoot<WebGLShaderPrecisionFormat>> {
match shader_type {
constants::FRAGMENT_SHADER | constants::VERTEX_SHADER => (),
_ => {
self.webgl_error(InvalidEnum);
return None;
},
}
match precision_type {
constants::LOW_FLOAT |
constants::MEDIUM_FLOAT |