webgl: Validate that depthRange near <= far.

Fixes a subtest of webgl-specific.html.
This commit is contained in:
Eric Anholt 2016-08-09 23:23:42 -07:00
parent 944cbbff8b
commit 12a96caaf1

View file

@ -987,6 +987,15 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
fn DepthRange(&self, near: f32, far: f32) {
// From the WebGL 1.0 spec, 6.12: Viewport Depth Range:
//
// "A call to depthRange will generate an
// INVALID_OPERATION error if zNear is greater than
// zFar."
if near > far {
return self.webgl_error(InvalidOperation);
}
self.ipc_renderer
.send(CanvasMsg::WebGL(WebGLCommand::DepthRange(near as f64, far as f64)))
.unwrap()