Auto merge of #20754 - anholt:webgl-fixes, r=emilio

Webgl fixes

<!-- Please describe your changes on the following line: -->
Add gl.getParameter() support for webgl unpack settings, and remove some unreachable and incorrect error-generation code

---
<!-- 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
- [x] These changes fix #20372
- [x] These changes fix #20553
- [x] These changes fix #20554

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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/20754)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-05-18 22:26:18 -04:00 committed by GitHub
commit a4b298c002
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 13 deletions

View file

@ -1326,6 +1326,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
"WebGL GLSL ES 1.0".to_jsval(cx, rval.handle_mut());
return rval.get();
}
constants::UNPACK_FLIP_Y_WEBGL => {
let unpack = self.texture_unpacking_settings.get();
return BooleanValue(unpack.contains(TextureUnpacking::FLIP_Y_AXIS));
}
constants::UNPACK_PREMULTIPLY_ALPHA_WEBGL => {
let unpack = self.texture_unpacking_settings.get();
return BooleanValue(unpack.contains(TextureUnpacking::PREMULTIPLY_ALPHA));
}
_ => {}
}
@ -1412,13 +1420,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
let (sender, receiver) = webgl_channel().unwrap();
self.send_command(WebGLCommand::GetTexParameter(target, pname, sender));
match receiver.recv().unwrap() {
value if value != 0 => Int32Value(value),
_ => {
self.webgl_error(InvalidEnum);
NullValue()
}
}
Int32Value(receiver.recv().unwrap())
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3