Skip to content

Commit

Permalink
Remove WebVR
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Jeffrey committed Apr 9, 2020
1 parent d8781c1 commit c611e46
Show file tree
Hide file tree
Showing 74 changed files with 97 additions and 3,178 deletions.
80 changes: 2 additions & 78 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions components/canvas/webgl_mode/inprocess.rs
Expand Up @@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

use crate::webgl_thread::{SurfaceProviders, WebGLThread, WebGLThreadInit, WebGlExecutor};
use canvas_traits::webgl::{webgl_channel, WebVRRenderHandler};
use canvas_traits::webgl::webgl_channel;
use canvas_traits::webgl::{WebGLContextId, WebGLMsg, WebGLThreads};
use euclid::default::Size2D;
use fnv::FnvHashMap;
Expand Down Expand Up @@ -41,7 +41,6 @@ impl WebGLComm {
context: Context,
webrender_gl: Rc<dyn gleam::gl::Gl>,
webrender_api_sender: webrender_api::RenderApiSender,
webvr_compositor: Option<Box<dyn WebVRRenderHandler>>,
external_images: Arc<Mutex<WebrenderExternalImageRegistry>>,
api_type: GlType,
) -> WebGLComm {
Expand All @@ -55,7 +54,6 @@ impl WebGLComm {
// This implementation creates a single `WebGLThread` for all the pipelines.
let init = WebGLThreadInit {
webrender_api_sender,
webvr_compositor,
external_images,
sender: sender.clone(),
receiver,
Expand Down
17 changes: 0 additions & 17 deletions components/canvas/webgl_thread.rs
Expand Up @@ -42,8 +42,6 @@ use canvas_traits::webgl::WebGLTextureId;
use canvas_traits::webgl::WebGLTransparentFramebufferId;
use canvas_traits::webgl::WebGLVersion;
use canvas_traits::webgl::WebGLVertexArrayId;
use canvas_traits::webgl::WebVRCommand;
use canvas_traits::webgl::WebVRRenderHandler;
use canvas_traits::webgl::YAxisTreatment;
use euclid::default::Size2D;
use fnv::FnvHashMap;
Expand Down Expand Up @@ -130,10 +128,6 @@ pub(crate) struct WebGLThread {
cached_context_info: FnvHashMap<WebGLContextId, WebGLContextInfo>,
/// Current bound context.
bound_context_id: Option<WebGLContextId>,
/// Handler user to send WebVR commands.
// TODO: replace webvr implementation with one built on top of webxr
#[allow(dead_code)]
webvr_compositor: Option<Box<dyn WebVRRenderHandler>>,
/// Texture ids and sizes used in DOM to texture outputs.
dom_outputs: FnvHashMap<webrender_api::PipelineId, DOMToTextureData>,
/// List of registered webrender external images.
Expand Down Expand Up @@ -164,7 +158,6 @@ pub type SurfaceProvider = Box<dyn surfman_chains::SurfaceProvider + Send>;
pub(crate) struct WebGLThreadInit {
pub webxr_surface_providers: SurfaceProviders,
pub webrender_api_sender: webrender_api::RenderApiSender,
pub webvr_compositor: Option<Box<dyn WebVRRenderHandler>>,
pub external_images: Arc<Mutex<WebrenderExternalImageRegistry>>,
pub sender: WebGLSender<WebGLMsg>,
pub receiver: WebGLReceiver<WebGLMsg>,
Expand All @@ -184,7 +177,6 @@ impl WebGLThread {
pub(crate) fn new(
WebGLThreadInit {
webrender_api_sender,
webvr_compositor,
external_images,
sender,
receiver,
Expand All @@ -203,7 +195,6 @@ impl WebGLThread {
contexts: Default::default(),
cached_context_info: Default::default(),
bound_context_id: None,
webvr_compositor,
dom_outputs: Default::default(),
external_images,
sender,
Expand Down Expand Up @@ -320,9 +311,6 @@ impl WebGLThread {
WebGLMsg::WebGLCommand(ctx_id, command, backtrace) => {
self.handle_webgl_command(ctx_id, command, backtrace);
},
WebGLMsg::WebVRCommand(ctx_id, command) => {
self.handle_webvr_command(ctx_id, command);
},
WebGLMsg::CreateWebXRSwapChain(ctx_id, size, sender, id) => {
let _ = sender.send(self.create_webxr_swap_chain(ctx_id, size, id));
},
Expand Down Expand Up @@ -398,11 +386,6 @@ impl WebGLThread {
}
}

/// Handles a WebVRCommand for a specific WebGLContext
fn handle_webvr_command(&mut self, _context_id: WebGLContextId, _command: WebVRCommand) {
// TODO(pcwalton): Reenable.
}

/// Creates a new WebGLContext
#[allow(unsafe_code)]
fn create_webgl_context(
Expand Down
1 change: 0 additions & 1 deletion components/canvas_traits/Cargo.toml
Expand Up @@ -29,5 +29,4 @@ servo_config = {path = "../config"}
sparkle = "0.1"
time = { version = "0.1.0", optional = true }
webrender_api = {git = "https://github.com/servo/webrender"}
webvr_traits = {path = "../webvr_traits"}
webxr-api = {git = "https://github.com/servo/webxr", features = ["ipc"]}
41 changes: 0 additions & 41 deletions components/canvas_traits/webgl.rs
Expand Up @@ -7,13 +7,11 @@ use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSharedMemory};
use pixels::PixelFormat;
use serde::{Deserialize, Serialize};
use sparkle::gl;
use sparkle::gl::Gl;
use std::borrow::Cow;
use std::fmt;
use std::num::{NonZeroU32, NonZeroU64};
use std::ops::Deref;
use webrender_api::{DocumentId, ImageKey, PipelineId};
use webvr_traits::WebVRPoseInformation;
use webxr_api::SessionId;
use webxr_api::SwapChainId as WebXRSwapChainId;

Expand Down Expand Up @@ -72,8 +70,6 @@ pub enum WebGLMsg {
RemoveContext(WebGLContextId),
/// Runs a WebGLCommand in a specific WebGLContext.
WebGLCommand(WebGLContextId, WebGLCommand, WebGLCommandBacktrace),
/// Runs a WebVRCommand in a specific WebGLContext.
WebVRCommand(WebGLContextId, WebVRCommand),
/// Commands used for the DOMToTexture feature.
DOMToTextureCommand(DOMToTextureCommand),
/// Creates a new opaque framebuffer for WebXR.
Expand Down Expand Up @@ -162,13 +158,6 @@ impl WebGLMsgSender {
.send(WebGLMsg::WebGLCommand(self.ctx_id, command, backtrace))
}

/// Send a WebVRCommand message
#[inline]
pub fn send_vr(&self, command: WebVRCommand) -> WebGLSendResult {
self.sender
.send(WebGLMsg::WebVRCommand(self.ctx_id, command))
}

/// Send a resize message
#[inline]
pub fn send_resize(
Expand Down Expand Up @@ -684,36 +673,6 @@ pub enum WebGLFramebufferBindingRequest {

pub type WebGLResult<T> = Result<T, WebGLError>;

pub type WebVRDeviceId = u32;

// WebVR commands that must be called in the WebGL render thread.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum WebVRCommand {
/// Start presenting to a VR device.
Create(WebVRDeviceId),
/// Synchronize the pose information to be used in the frame.
SyncPoses(
WebVRDeviceId,
// near
f64,
// far
f64,
// sync gamepads too
bool,
WebGLSender<Result<WebVRPoseInformation, ()>>,
),
/// Submit the frame to a VR device using the specified texture coordinates.
SubmitFrame(WebVRDeviceId, [f32; 4], [f32; 4]),
/// Stop presenting to a VR device
Release(WebVRDeviceId),
}

// Trait object that handles WebVR commands.
// Receives the texture id and size associated to the WebGLContext.
pub trait WebVRRenderHandler: Send {
fn handle(&mut self, gl: &Gl, command: WebVRCommand, texture: Option<(u32, Size2D<i32>)>);
}

/// WebGL commands required to implement DOMToTexture feature.
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum DOMToTextureCommand {
Expand Down
2 changes: 0 additions & 2 deletions components/compositing/Cargo.toml
Expand Up @@ -32,7 +32,6 @@ net_traits = {path = "../net_traits"}
num-traits = "0.2"
pixels = {path = "../pixels", optional = true}
profile_traits = {path = "../profile_traits"}
rust-webvr = {version = "0.19", features = ["mock", "openvr", "vrexternal"]}
script_traits = {path = "../script_traits"}
servo_geometry = {path = "../geometry"}
servo-media = {git = "https://github.com/servo/media"}
Expand All @@ -41,7 +40,6 @@ style_traits = {path = "../style_traits"}
time = "0.1.17"
webrender = {git = "https://github.com/servo/webrender", features = ["capture"]}
webrender_api = {git = "https://github.com/servo/webrender"}
webvr_traits = {path = "../webvr_traits"}
webxr = {git = "https://github.com/servo/webxr"}

[build-dependencies]
Expand Down

0 comments on commit c611e46

Please sign in to comment.