aboutsummaryrefslogtreecommitdiffstats
path: root/components/canvas/gl_context.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2018-03-09 23:27:29 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2018-03-09 23:27:29 +0100
commit21df4014db5ff11581fcdd328d2dd1f7226a4544 (patch)
tree41c071a3edd9320bb045ff055359d11a63a4439a /components/canvas/gl_context.rs
parent3fc5bf87d3fd605da7510a5a0240dac0157a9743 (diff)
downloadservo-21df4014db5ff11581fcdd328d2dd1f7226a4544.tar.gz
servo-21df4014db5ff11581fcdd328d2dd1f7226a4544.zip
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.
Diffstat (limited to 'components/canvas/gl_context.rs')
-rw-r--r--components/canvas/gl_context.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/components/canvas/gl_context.rs b/components/canvas/gl_context.rs
index e0d686f622a..7720f8f678a 100644
--- a/components/canvas/gl_context.rs
+++ b/components/canvas/gl_context.rs
@@ -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.