mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
constellation: Make setting up the WebGL state fallible.
This fixes a regression caused by the glutin update. We now are creating EGL contexts in Linux Wayland, instead of X context, so the GLContextFactory assumption of one GL back-end per platform is broken. This just works around it, for now, but in general I think not relying on available WebGL state is a good thing, and we do that already for WebVR anyway.
This commit is contained in:
parent
3fc5bf87d3
commit
21df4014db
8 changed files with 48 additions and 31 deletions
|
@ -224,8 +224,12 @@ impl WebGLRenderingContext {
|
|||
return Err("WebGL context creation error forced by pref `webgl.testing.context_creation_error`".into());
|
||||
}
|
||||
|
||||
let webgl_chan = match window.webgl_chan() {
|
||||
Some(chan) => chan,
|
||||
None => return Err("WebGL initialization failed early on".into()),
|
||||
};
|
||||
|
||||
let (sender, receiver) = webgl_channel().unwrap();
|
||||
let webgl_chan = window.webgl_chan();
|
||||
webgl_chan.send(WebGLMsg::CreateContext(webgl_version, size, attrs, sender))
|
||||
.unwrap();
|
||||
let result = receiver.recv().unwrap();
|
||||
|
|
|
@ -257,9 +257,9 @@ pub struct Window {
|
|||
|
||||
test_runner: MutNullableDom<TestRunner>,
|
||||
|
||||
/// A handle for communicating messages to the webvr thread, if available.
|
||||
/// A handle for communicating messages to the WebGL thread, if available.
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
webgl_chan: WebGLChan,
|
||||
webgl_chan: Option<WebGLChan>,
|
||||
|
||||
/// A handle for communicating messages to the webvr thread, if available.
|
||||
#[ignore_malloc_size_of = "channels are hard"]
|
||||
|
@ -402,7 +402,7 @@ impl Window {
|
|||
self.current_viewport.clone().get()
|
||||
}
|
||||
|
||||
pub fn webgl_chan(&self) -> WebGLChan {
|
||||
pub fn webgl_chan(&self) -> Option<WebGLChan> {
|
||||
self.webgl_chan.clone()
|
||||
}
|
||||
|
||||
|
@ -1756,7 +1756,7 @@ impl Window {
|
|||
origin: MutableOrigin,
|
||||
navigation_start: u64,
|
||||
navigation_start_precise: u64,
|
||||
webgl_chan: WebGLChan,
|
||||
webgl_chan: Option<WebGLChan>,
|
||||
webvr_chan: Option<IpcSender<WebVRMsg>>,
|
||||
microtask_queue: Rc<MicrotaskQueue>,
|
||||
webrender_document: DocumentId,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue