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:
Emilio Cobos Álvarez 2018-03-09 23:27:29 +01:00
parent 3fc5bf87d3
commit 21df4014db
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
8 changed files with 48 additions and 31 deletions

View file

@ -24,6 +24,9 @@ pub enum GLContextFactory {
impl GLContextFactory {
/// Creates a new GLContextFactory that uses the currently bound GL context to create shared contexts.
pub fn current_native_handle(proxy: &CompositorProxy) -> Option<GLContextFactory> {
// FIXME(emilio): This assumes a single GL backend per platform which is
// not true on Linux, we probably need a third `Egl` variant or abstract
// it a bit more...
NativeGLContext::current_handle().map(|handle| {
if cfg!(target_os = "windows") {
// Used to dispatch functions from the GLContext thread to the main thread's event loop.