mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
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 -->
This commit is contained in:
commit
f2b861fb24
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
|
||||
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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue