mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
Pass the GL context to the VRDisplay when rendering
This commit is contained in:
parent
42ebf46172
commit
8ddde7eacc
7 changed files with 34 additions and 22 deletions
|
@ -5,6 +5,7 @@
|
|||
use canvas_traits::webgl;
|
||||
use crossbeam_channel::{unbounded, Receiver, Sender};
|
||||
use euclid::Size2D;
|
||||
use gleam::gl::Gl;
|
||||
use ipc_channel::ipc;
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
|
@ -376,7 +377,12 @@ impl WebVRCompositorHandler {
|
|||
|
||||
impl webgl::WebVRRenderHandler for WebVRCompositorHandler {
|
||||
#[allow(unsafe_code)]
|
||||
fn handle(&mut self, cmd: webgl::WebVRCommand, texture: Option<(u32, Size2D<i32>)>) {
|
||||
fn handle(
|
||||
&mut self,
|
||||
gl: &dyn Gl,
|
||||
cmd: webgl::WebVRCommand,
|
||||
texture: Option<(u32, Size2D<i32>)>,
|
||||
) {
|
||||
match cmd {
|
||||
webgl::WebVRCommand::Create(compositor_id) => {
|
||||
if let Some(compositor) = self.create_compositor(compositor_id) {
|
||||
|
@ -400,10 +406,7 @@ impl webgl::WebVRRenderHandler for WebVRCompositorHandler {
|
|||
right_bounds: right_bounds,
|
||||
texture_size: Some((size.width as u32, size.height as u32)),
|
||||
};
|
||||
unsafe {
|
||||
(*compositor.0).render_layer(&layer);
|
||||
(*compositor.0).submit_frame();
|
||||
}
|
||||
unsafe { (*compositor.0).submit_layer(gl, &layer) };
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue