Auto merge of #24676 - Manishearth:unpatch, r=jdm

Remove patched webxr

Unsure if this compiles yet, testing locally.

r? @jdm
This commit is contained in:
bors-servo 2019-11-11 19:25:22 -05:00 committed by GitHub
commit 31ee5fc2f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 67 additions and 37 deletions

12
Cargo.lock generated
View file

@ -5069,8 +5069,9 @@ dependencies = [
[[package]]
name = "surfman"
version = "0.23.0"
source = "git+https://github.com/jdm/rust-offscreen-rendering-context?branch=servo#dc5cf4369105f566fe95daac75bce748ae1a1c41"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7131f4831a7c13f3e90b16b0d7389b8875cc53807312c2697547763bfe7782b8"
dependencies = [
"bitflags",
"cgl 0.3.2",
@ -5097,7 +5098,8 @@ dependencies = [
[[package]]
name = "surfman-chains"
version = "0.1.0"
source = "git+https://github.com/asajeffrey/surfman-chains#13576ac0cd1573057472ba85ce520bd881e856dc"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab6ab2f8da08cd1ca6491fc0fd4c4aedc36adde0d6b3f64a6325b35dfce50ec5"
dependencies = [
"euclid",
"fnv",
@ -5996,7 +5998,7 @@ dependencies = [
[[package]]
name = "webxr"
version = "0.0.1"
source = "git+https://github.com/jdm/webxr?branch=no-gl-readback2#12e04bafc2c692bce303b2a9fa5e811e76fbaa0e"
source = "git+https://github.com/servo/webxr#4953e60dd9ff80324739eee22283d9b80f5c9559"
dependencies = [
"bindgen",
"euclid",
@ -6015,7 +6017,7 @@ dependencies = [
[[package]]
name = "webxr-api"
version = "0.0.1"
source = "git+https://github.com/jdm/webxr?branch=no-gl-readback2#12e04bafc2c692bce303b2a9fa5e811e76fbaa0e"
source = "git+https://github.com/servo/webxr#4953e60dd9ff80324739eee22283d9b80f5c9559"
dependencies = [
"euclid",
"ipc-channel",

View file

@ -29,12 +29,3 @@ opt-level = 3
mio = { git = "https://github.com/servo/mio.git", branch = "servo" }
# https://github.com/retep998/winapi-rs/pull/816
winapi = { git = "https://github.com/servo/winapi-rs", branch = "patch-1" }
# temporary
[patch."https://github.com/pcwalton/surfman"]
surfman = { git = "https://github.com/jdm/rust-offscreen-rendering-context", branch = "servo" }
[patch."https://github.com/servo/webxr"]
webxr = { git = "https://github.com/jdm/webxr", branch = "no-gl-readback2" }
webxr-api = { git = "https://github.com/jdm/webxr", branch = "no-gl-readback2" }

View file

@ -39,5 +39,5 @@ webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
webrender_traits = {path = "../webrender_traits"}
webxr-api = {git = "https://github.com/servo/webxr", features = ["ipc"]}
# NOTE: the sm-angle feature only enables angle on windows, not other platforms!
surfman = { git = "https://github.com/pcwalton/surfman", features = ["sm-angle", "sm-osmesa"] }
surfman-chains = { git = "https://github.com/asajeffrey/surfman-chains" }
surfman = { version = "0.1", features = ["sm-angle", "sm-osmesa"] }
surfman-chains = "0.1"

View file

@ -17,6 +17,7 @@ use std::sync::{Arc, Mutex};
use surfman::platform::generic::universal::context::Context;
use surfman::platform::generic::universal::device::Device;
use surfman::platform::generic::universal::surface::SurfaceTexture;
use surfman::SurfaceInfo;
use surfman_chains::SwapChains;
use webrender_traits::{WebrenderExternalImageApi, WebrenderExternalImageRegistry};
use webxr_api::SwapChainId as WebXRSwapChainId;
@ -105,8 +106,12 @@ impl WebGLExternalImages {
debug!("... locking chain {:?}", id);
let front_buffer = self.swap_chains.get(id)?.take_surface()?;
debug!("... getting texture for surface {:?}", front_buffer.id());
let size = front_buffer.size();
let SurfaceInfo {
id: front_buffer_id,
size,
..
} = self.device.surface_info(&front_buffer);
debug!("... getting texture for surface {:?}", front_buffer_id);
let front_buffer_texture = self
.device
.create_surface_texture(&mut self.context, front_buffer)

View file

@ -67,6 +67,7 @@ use surfman::ContextAttributeFlags;
use surfman::ContextAttributes;
use surfman::GLVersion;
use surfman::SurfaceAccess;
use surfman::SurfaceInfo;
use surfman::SurfaceType;
use surfman_chains::SwapChains;
use webrender_traits::{WebrenderExternalImageRegistry, WebrenderImageHandlerType};
@ -438,8 +439,15 @@ impl WebGLThread {
let mut ctx = self
.device
.create_context(&context_descriptor, surface_access, &surface_type)
.create_context(&context_descriptor)
.expect("Failed to create the GL context!");
let surface = self
.device
.create_surface(&ctx, surface_access, &surface_type)
.expect("Failed to create the initial surface!");
self.device
.bind_surface_to_context(&mut ctx, surface)
.unwrap();
// https://github.com/pcwalton/surfman/issues/7
self.device
.make_context_current(&ctx)
@ -490,8 +498,10 @@ impl WebGLThread {
self.device.make_context_current(&ctx).unwrap();
let framebuffer = self
.device
.context_surface_framebuffer_object(&ctx)
.unwrap();
.context_surface_info(&ctx)
.unwrap()
.unwrap()
.framebuffer_object;
gl.bind_framebuffer(gl::FRAMEBUFFER, framebuffer);
gl.viewport(0, 0, size.width as i32, size.height as i32);
gl.scissor(0, 0, size.width as i32, size.height as i32);
@ -578,6 +588,10 @@ impl WebGLThread {
swap_chain
.resize(&mut self.device, &mut data.ctx, size.to_i32())
.expect("Failed to resize swap chain");
// temporary, till https://github.com/pcwalton/surfman/issues/35 is fixed
self.device
.make_context_current(&data.ctx)
.expect("Failed to make context current again");
swap_chain
.clear_surface(&mut self.device, &mut data.ctx, &*data.gl)
.expect("Failed to clear resized swap chain");
@ -695,14 +709,18 @@ impl WebGLThread {
debug!("Rebinding {:?}", swap_id);
framebuffer_rebinding_info.apply(&self.device, &data.ctx, &*data.gl);
let framebuffer = self
let SurfaceInfo {
framebuffer_object,
id,
..
} = self
.device
.context_surface_framebuffer_object(&data.ctx)
.context_surface_info(&data.ctx)
.unwrap()
.unwrap();
debug!(
"... rebound framebuffer {}, new back buffer surface is {:?}",
framebuffer,
self.device.context_surface_id(&data.ctx).unwrap()
framebuffer_object, id
);
}
@ -1427,14 +1445,18 @@ impl WebGLImpl {
},
WebGLCommand::DrawingBufferWidth(ref sender) => {
let size = device
.context_surface_size(&ctx)
.expect("Where's the front buffer?");
.context_surface_info(&ctx)
.unwrap()
.expect("Where's the front buffer?")
.size;
sender.send(size.width).unwrap()
},
WebGLCommand::DrawingBufferHeight(ref sender) => {
let size = device
.context_surface_size(&ctx)
.expect("Where's the front buffer?");
.context_surface_info(&ctx)
.unwrap()
.expect("Where's the front buffer?")
.size;
sender.send(size.height).unwrap()
},
WebGLCommand::Finish(ref sender) => Self::finish(gl, sender),
@ -2192,9 +2214,13 @@ impl WebGLImpl {
id.get()
},
WebGLFramebufferBindingRequest::Explicit(WebGLFramebufferId::Opaque(_)) |
WebGLFramebufferBindingRequest::Default => device
.context_surface_framebuffer_object(ctx)
.expect("No surface attached!"),
WebGLFramebufferBindingRequest::Default => {
device
.context_surface_info(ctx)
.unwrap()
.expect("No surface attached!")
.framebuffer_object
},
};
debug!("WebGLImpl::bind_framebuffer: {:?}", id);
@ -2649,8 +2675,11 @@ impl FramebufferRebindingInfo {
gl.get_integer_v(gl::READ_FRAMEBUFFER_BINDING, &mut read_framebuffer);
gl.get_integer_v(gl::DRAW_FRAMEBUFFER_BINDING, &mut draw_framebuffer);
let context_surface_framebuffer =
device.context_surface_framebuffer_object(context).unwrap();
let context_surface_framebuffer = device
.context_surface_info(context)
.unwrap()
.unwrap()
.framebuffer_object;
let mut flags = FramebufferRebindingFlags::empty();
if context_surface_framebuffer == read_framebuffer[0] as GLuint {
@ -2672,8 +2701,11 @@ impl FramebufferRebindingInfo {
return;
}
let context_surface_framebuffer =
device.context_surface_framebuffer_object(context).unwrap();
let context_surface_framebuffer = device
.context_surface_info(context)
.unwrap()
.unwrap()
.framebuffer_object;
if self
.flags
.contains(FramebufferRebindingFlags::REBIND_READ_FRAMEBUFFER)

View file

@ -82,7 +82,7 @@ webdriver_server = {path = "../webdriver_server", optional = true}
webvr = {path = "../webvr"}
webvr_traits = {path = "../webvr_traits"}
webxr-api = {git = "https://github.com/servo/webxr"}
surfman = { git = "https://github.com/pcwalton/surfman", features = ["sm-osmesa"] }
surfman = { version = "0.1", features = ["sm-osmesa"] }
[target.'cfg(all(not(target_os = "windows"), not(target_os = "ios"), not(target_os="android"), not(target_arch="arm"), not(target_arch="aarch64")))'.dependencies]
gaol = "0.2.1"