mirror of
https://github.com/servo/servo.git
synced 2025-07-13 18:33:40 +01:00
webgl: Validate that depthRange near <= far.
Fixes a subtest of webgl-specific.html.
This commit is contained in:
parent
944cbbff8b
commit
12a96caaf1
1 changed files with 9 additions and 0 deletions
|
@ -987,6 +987,15 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
|
||||||
|
|
||||||
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
|
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
|
||||||
fn DepthRange(&self, near: f32, far: f32) {
|
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
|
self.ipc_renderer
|
||||||
.send(CanvasMsg::WebGL(WebGLCommand::DepthRange(near as f64, far as f64)))
|
.send(CanvasMsg::WebGL(WebGLCommand::DepthRange(near as f64, far as f64)))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue