Auto merge of #21313 - jdm:glstuff, r=nox

Framebuffer and renderbuffer fixes

This commits address two separate panics that occur when running the framebuffer-object-attachment.html test. The test still panics due to another framebuffer completion status problem, so the overall test results don't demonstrate any improvement.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #21252
- [x] There are tests for these changes

<!-- 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/21313)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2018-08-02 09:26:35 -04:00 committed by GitHub
commit bde8a1e239
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 181 additions and 54 deletions

View file

@ -71,6 +71,12 @@ use std::cmp;
use std::ptr::{self, NonNull};
use webrender_api;
pub fn is_gles() -> bool {
// TODO: align this with the actual kind of graphics context in use, rather than
// making assumptions based on platform
cfg!(any(target_os = "android", target_os = "ios"))
}
type ImagePixelResult = Result<(Vec<u8>, Size2D<i32>, bool), ()>;
pub const MAX_UNIFORM_AND_ATTRIBUTE_LEN: usize = 256;
@ -2702,10 +2708,17 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
return NullValue();
}
let (sender, receiver) = webgl_channel().unwrap();
self.send_command(WebGLCommand::GetRenderbufferParameter(target, pname, sender));
let result = if pname == constants::RENDERBUFFER_INTERNAL_FORMAT {
let rb = self.bound_renderbuffer.get().unwrap();
rb.internal_format() as i32
} else {
let (sender, receiver) = webgl_channel().unwrap();
self.send_command(WebGLCommand::GetRenderbufferParameter(target, pname, sender));
receiver.recv().unwrap()
};
Int32Value(receiver.recv().unwrap())
Int32Value(result)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9