aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock10
-rw-r--r--components/canvas/webgl_mode/inprocess.rs5
-rw-r--r--components/canvas/webgl_thread.rs22
-rw-r--r--components/canvas_traits/webgl.rs3
-rw-r--r--components/webvr/Cargo.toml1
-rw-r--r--components/webvr/webvr_thread.rs13
-rw-r--r--components/webvr_traits/Cargo.toml2
7 files changed, 34 insertions, 22 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 04ec11c5cc9..bc7eb3b2151 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3337,15 +3337,16 @@ dependencies = [
"libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ovr-mobile-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "rust-webvr-api 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rust-webvr-api 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rust-webvr-api"
-version = "0.10.2"
+version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"android_injected_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -4862,6 +4863,7 @@ dependencies = [
"canvas_traits 0.0.1",
"crossbeam-channel 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.19.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gleam 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@@ -4877,7 +4879,7 @@ version = "0.0.1"
dependencies = [
"ipc-channel 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
- "rust-webvr-api 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rust-webvr-api 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -5357,7 +5359,7 @@ dependencies = [
"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5"
"checksum ron 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "da06feaa07f69125ab9ddc769b11de29090122170b402547f64b86fe16ebc399"
"checksum rust-webvr 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4251e156fc27e2ce17a747e3270ee6940c754145cead0cf5da29792328baf473"
-"checksum rust-webvr-api 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "95d96901d94bc4e43998cc77f804f6944acb993b61c8470fc3c9600650608148"
+"checksum rust-webvr-api 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f8ae20fc34d4b4f59d00be7fa2c06802ad90a0a33195a6f5f73832c6acc5b8fa"
"checksum rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3058a43ada2c2d0b92b3ae38007a2d0fa5e9db971be260e0171408a4ff471c95"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum rusttype 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b8eb11f5b0a98c8eca2fb1483f42646d8c340e83e46ab416f8a063a0fd0eeb20"
diff --git a/components/canvas/webgl_mode/inprocess.rs b/components/canvas/webgl_mode/inprocess.rs
index 6111851e58e..2ee1db72971 100644
--- a/components/canvas/webgl_mode/inprocess.rs
+++ b/components/canvas/webgl_mode/inprocess.rs
@@ -11,6 +11,7 @@ use canvas_traits::webgl::{WebGLSender, WebVRCommand, WebVRRenderHandler};
use euclid::Size2D;
use fnv::FnvHashMap;
use gleam::gl;
+use gleam::gl::Gl;
use servo_config::prefs::PREFS;
use std::rc::Rc;
@@ -112,8 +113,8 @@ impl WebGLExternalImageApi for WebGLExternalImages {
struct WebVRRenderWrapper(Box<dyn WebVRRenderHandler>);
impl WebVRRenderHandler for WebVRRenderWrapper {
- fn handle(&mut self, command: WebVRCommand, texture: Option<(u32, Size2D<i32>)>) {
- self.0.handle(command, texture);
+ fn handle(&mut self, gl: &dyn Gl, command: WebVRCommand, texture: Option<(u32, Size2D<i32>)>) {
+ self.0.handle(gl, command, texture);
}
}
diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs
index c3c27925e96..7447b4c6b55 100644
--- a/components/canvas/webgl_thread.rs
+++ b/components/canvas/webgl_thread.rs
@@ -210,15 +210,19 @@ impl<VR: WebVRRenderHandler + 'static> WebGLThread<VR> {
/// Handles a WebVRCommand for a specific WebGLContext
fn handle_webvr_command(&mut self, context_id: WebGLContextId, command: WebVRCommand) {
- Self::make_current_if_needed(context_id, &self.contexts, &mut self.bound_context_id);
- let texture = match command {
- WebVRCommand::SubmitFrame(..) => self.cached_context_info.get(&context_id),
- _ => None,
- };
- self.webvr_compositor
- .as_mut()
- .unwrap()
- .handle(command, texture.map(|t| (t.texture_id, t.size)));
+ if let Some(context) =
+ Self::make_current_if_needed(context_id, &self.contexts, &mut self.bound_context_id)
+ {
+ let texture = match command {
+ WebVRCommand::SubmitFrame(..) => self.cached_context_info.get(&context_id),
+ _ => None,
+ };
+ self.webvr_compositor.as_mut().unwrap().handle(
+ context.ctx.gl(),
+ command,
+ texture.map(|t| (t.texture_id, t.size)),
+ );
+ }
}
/// Handles a lock external callback received from webrender::ExternalImageHandler
diff --git a/components/canvas_traits/webgl.rs b/components/canvas_traits/webgl.rs
index cfa885daa0b..d3b16f59c78 100644
--- a/components/canvas_traits/webgl.rs
+++ b/components/canvas_traits/webgl.rs
@@ -4,6 +4,7 @@
use euclid::{Rect, Size2D};
use gleam::gl;
+use gleam::gl::Gl;
use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSharedMemory};
use offscreen_gl_context::{GLContextAttributes, GLLimits};
use pixels::PixelFormat;
@@ -521,7 +522,7 @@ pub enum WebVRCommand {
// Trait object that handles WebVR commands.
// Receives the texture id and size associated to the WebGLContext.
pub trait WebVRRenderHandler: Send {
- fn handle(&mut self, command: WebVRCommand, texture: Option<(u32, Size2D<i32>)>);
+ fn handle(&mut self, gl: &dyn Gl, command: WebVRCommand, texture: Option<(u32, Size2D<i32>)>);
}
/// WebGL commands required to implement DOMToTexture feature.
diff --git a/components/webvr/Cargo.toml b/components/webvr/Cargo.toml
index 54fee3d2716..e88fbb2682e 100644
--- a/components/webvr/Cargo.toml
+++ b/components/webvr/Cargo.toml
@@ -18,6 +18,7 @@ oculusvr = ['rust-webvr/oculusvr']
canvas_traits = {path = "../canvas_traits"}
crossbeam-channel = "0.3"
euclid = "0.19"
+gleam = "0.6"
ipc-channel = "0.11"
log = "0.4"
msg = {path = "../msg"}
diff --git a/components/webvr/webvr_thread.rs b/components/webvr/webvr_thread.rs
index 4ce25bccb50..59593c927d3 100644
--- a/components/webvr/webvr_thread.rs
+++ b/components/webvr/webvr_thread.rs
@@ -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) };
}
}
},
diff --git a/components/webvr_traits/Cargo.toml b/components/webvr_traits/Cargo.toml
index 6caceda3ac4..032729334f3 100644
--- a/components/webvr_traits/Cargo.toml
+++ b/components/webvr_traits/Cargo.toml
@@ -13,5 +13,5 @@ path = "lib.rs"
[dependencies]
ipc-channel = "0.11"
msg = {path = "../msg"}
-rust-webvr-api = {version = "0.10.2", features = ["ipc"]}
+rust-webvr-api = {version = "0.10.3", features = ["ipc"]}
serde = "1.0"