mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Properly clamp arguments to WebGLRenderingContext.depthRange
This commit is contained in:
parent
7b4d66b621
commit
fb290e9c9e
3 changed files with 6 additions and 10 deletions
|
@ -1925,16 +1925,11 @@ 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."
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#VIEWPORT_DEPTH_RANGE
|
||||
if near > far {
|
||||
return self.webgl_error(InvalidOperation);
|
||||
}
|
||||
|
||||
self.send_command(WebGLCommand::DepthRange(near as f64, far as f64))
|
||||
self.send_command(WebGLCommand::DepthRange(near, far))
|
||||
}
|
||||
|
||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue