Skip to content

Commit

Permalink
Create the WindowGLContext at create_constellation()
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyusa authored and ferjm committed Jul 4, 2019
1 parent eb38572 commit db4fff1
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions components/servo/lib.rs
Expand Up @@ -306,21 +306,11 @@ where
None
};

let gl_context = window.get_gl_context();
let glplayer_threads = match gl_context {
GlContext::Unknown => None,
_ => {
let (glplayer_threads, image_handler) = GLPlayerThreads::new();
webrender.set_external_image_handler(image_handler);
Some(glplayer_threads)
},
};

let player_context = WindowGLContext {
gl_context,
gl_context: window.get_gl_context(),
native_display: window.get_native_display(),
gl_api: window.get_gl_api(),
glplayer_chan: glplayer_threads.as_ref().map(|threads| threads.pipeline()),
glplayer_chan: None,
};

// Create the constellation, which maintains the engine
Expand All @@ -341,7 +331,6 @@ where
window.gl(),
webvr_services,
webxr_registry,
glplayer_threads,
player_context,
);

Expand Down Expand Up @@ -653,7 +642,6 @@ fn create_constellation(
window_gl: Rc<dyn gl::Gl>,
webvr_services: Option<VRServiceManager>,
webxr_registry: webxr_api::Registry,
glplayer_threads: Option<GLPlayerThreads>,
player_context: WindowGLContext,
) -> (Sender<ConstellationMsg>, SWManagerSenders) {
// Global configuration options, parsed from the command line.
Expand Down Expand Up @@ -720,6 +708,20 @@ fn create_constellation(
webgl_threads
});

let glplayer_threads = match player_context.gl_context {
GlContext::Unknown => None,
_ => {
let (glplayer_threads, image_handler) = GLPlayerThreads::new();
webrender.set_external_image_handler(image_handler);
Some(glplayer_threads)
},
};

let player_context = WindowGLContext {
glplayer_chan: glplayer_threads.as_ref().map(|threads| threads.pipeline()),
..player_context
};

let initial_state = InitialConstellationState {
compositor_proxy,
embedder_proxy,
Expand Down

0 comments on commit db4fff1

Please sign in to comment.