aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-08-10 05:40:19 -0500
committerGitHub <noreply@github.com>2016-08-10 05:40:19 -0500
commitf2b861fb24e2322d21c1a990ef25e49d2965b0ce (patch)
treeec11370bde707457c8686214cb995d8c46a10b74
parentc726eb3a82b28f60923a1332eac8277e73df3252 (diff)
parent12a96caaf19e39611d8f1fff96d9925ca9e134f8 (diff)
downloadservo-f2b861fb24e2322d21c1a990ef25e49d2965b0ce.tar.gz
servo-f2b861fb24e2322d21c1a990ef25e49d2965b0ce.zip
Auto merge of #12794 - anholt:webgl-depthrange-validate, r=emilio
webgl: Validate that depthRange near <= far. <!-- Please describe your changes on the following line: --> Add a check for one of the subcases of webgl-specific.html. I added a longer comment citing the spec than is common in the file -- we've found these kinds of citations really useful in Mesa, but if we want to keep it to the spec link, I could change it. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Fixes a subtest of webgl-specific.html. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12794) <!-- Reviewable:end -->
-rw-r--r--components/script/dom/webglrenderingcontext.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index dbb774ad87b..a7418921e8a 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -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()