From a46ca86a50e4538aaa4f700f6dd107429cd5da37 Mon Sep 17 00:00:00 2001 From: Paul Rouget Date: Wed, 29 May 2019 10:37:47 +0200 Subject: [PATCH 1/7] implement Visual Studio logs --- ports/libsimpleservo/capi/src/lib.rs | 28 ++++++++++++++++++++++- ports/libsimpleservo/capi/src/vslogger.rs | 24 +++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 ports/libsimpleservo/capi/src/vslogger.rs diff --git a/ports/libsimpleservo/capi/src/lib.rs b/ports/libsimpleservo/capi/src/lib.rs index 5ac667355677..42d3d7db8f5a 100644 --- a/ports/libsimpleservo/capi/src/lib.rs +++ b/ports/libsimpleservo/capi/src/lib.rs @@ -5,6 +5,10 @@ #[macro_use] extern crate log; +#[cfg(target_os = "windows")] +mod vslogger; + +#[cfg(not(target_os = "windows"))] use env_logger; use simpleservo::{self, gl_glue, ServoGlue, SERVO}; use simpleservo::{Coordinates, EventLoopWaker, HostTrait, InitOptions, VRInitOptions}; @@ -66,13 +70,33 @@ pub extern "C" fn servo_version() -> *const c_char { ptr } +#[cfg(target_os = "windows")] +fn init_logger() { + use log::LevelFilter; + use std::sync::Once; + use vslogger::VSLogger; + + static LOGGER: VSLogger = VSLogger; + static LOGGER_INIT: Once = Once::new(); + LOGGER_INIT.call_once(|| { + log::set_logger(&LOGGER) + .map(|_| log::set_max_level(LevelFilter::Debug)) + .unwrap(); + }); +} + +#[cfg(not(target_os = "windows"))] +fn init_logger() { + crate::env_logger::init(); +} + fn init( opts: CInitOptions, gl: gl_glue::ServoGl, wakeup: extern "C" fn(), callbacks: CHostCallbacks, ) { - crate::env_logger::init(); + init_logger(); let args = if !opts.args.is_null() { let args = unsafe { CStr::from_ptr(opts.args) }; @@ -116,6 +140,7 @@ pub extern "C" fn init_with_egl( wakeup: extern "C" fn(), callbacks: CHostCallbacks, ) { + init_logger(); let gl = gl_glue::egl::init().unwrap(); init(opts, gl, wakeup, callbacks) } @@ -127,6 +152,7 @@ pub extern "C" fn init_with_gl( wakeup: extern "C" fn(), callbacks: CHostCallbacks, ) { + init_logger(); let gl = gl_glue::gl::init().unwrap(); init(opts, gl, wakeup, callbacks) } diff --git a/ports/libsimpleservo/capi/src/vslogger.rs b/ports/libsimpleservo/capi/src/vslogger.rs new file mode 100644 index 000000000000..98c54a1c63bb --- /dev/null +++ b/ports/libsimpleservo/capi/src/vslogger.rs @@ -0,0 +1,24 @@ +use log::{self, Level, Metadata, Record}; + +extern "C" { + fn OutputDebugStringA(s: *const u8); +} + +pub struct VSLogger; + +impl log::Log for VSLogger { + fn enabled(&self, metadata: &Metadata) -> bool { + metadata.level() <= Level::Warn + } + + fn log(&self, record: &Record) { + if self.enabled(record.metadata()) { + let log = format!("RUST: {} - {}\r\n\0", record.level(), record.args()); + unsafe { + OutputDebugStringA(log.as_ptr()); + }; + } + } + + fn flush(&self) {} +} From 16dda6585f7529848fe2c0aeef44934f75db7349 Mon Sep 17 00:00:00 2001 From: Paul Rouget Date: Mon, 3 Jun 2019 10:41:50 +0200 Subject: [PATCH 2/7] Use StaticStructGenerator on Windows --- ports/libsimpleservo/api/build.rs | 21 +++++++++------- ports/libsimpleservo/api/src/gl_glue.rs | 33 ------------------------- 2 files changed, 12 insertions(+), 42 deletions(-) diff --git a/ports/libsimpleservo/api/build.rs b/ports/libsimpleservo/api/build.rs index de216c650d1e..243e139cf978 100644 --- a/ports/libsimpleservo/api/build.rs +++ b/ports/libsimpleservo/api/build.rs @@ -15,16 +15,19 @@ fn main() { // For now, we only support EGL, and only on Windows and Android. if target.contains("android") || target.contains("windows") { let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap(); - if target.contains("android") { - Registry::new(Api::Egl, (1, 5), Profile::Core, Fallbacks::All, []) - .write_bindings(gl_generator::StaticStructGenerator, &mut file) - .unwrap(); - } + Registry::new(Api::Egl, (1, 5), Profile::Core, Fallbacks::All, []) + .write_bindings(gl_generator::StaticStructGenerator, &mut file) + .unwrap(); + + // Historically, Android builds have succeeded with rust-link-lib=EGL. + // On Windows when relying on %LIBS% to contain libEGL.lib, however, + // we must explicitly use rustc-link-lib=libEGL or rustc will attempt + // to link EGL.lib instead. if target.contains("windows") { - Registry::new(Api::Egl, (1, 5), Profile::Core, Fallbacks::All, []) - .write_bindings(gl_generator::StructGenerator, &mut file) - .unwrap(); - }; + println!("cargo:rustc-link-lib=libEGL"); + } else { + println!("cargo:rust-link-lib=EGL"); + } } if target.contains("linux") || diff --git a/ports/libsimpleservo/api/src/gl_glue.rs b/ports/libsimpleservo/api/src/gl_glue.rs index e722a4a59cd1..126de03789d7 100644 --- a/ports/libsimpleservo/api/src/gl_glue.rs +++ b/ports/libsimpleservo/api/src/gl_glue.rs @@ -11,20 +11,9 @@ pub type ServoGl = std::rc::Rc; pub mod egl { use servo::gl::GlesFns; use std::ffi::CString; - #[cfg(not(target_os = "windows"))] use std::os::raw::c_void; - #[cfg(target_os = "windows")] - use winapi::um::libloaderapi::{GetProcAddress, LoadLibraryA}; - #[cfg(target_os = "windows")] - pub type EGLNativeWindowType = winapi::shared::windef::HWND; - #[cfg(target_os = "linux")] pub type EGLNativeWindowType = *const libc::c_void; - #[cfg(target_os = "android")] - pub type EGLNativeWindowType = *const libc::c_void; - #[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))] - pub type EGLNativeWindowType = *const libc::c_void; - pub type khronos_utime_nanoseconds_t = khronos_uint64_t; pub type khronos_uint64_t = libc::uint64_t; pub type khronos_ssize_t = libc::c_long; @@ -37,7 +26,6 @@ pub mod egl { include!(concat!(env!("OUT_DIR"), "/egl_bindings.rs")); - #[cfg(target_os = "android")] pub fn init() -> Result { info!("Loading EGL..."); unsafe { @@ -54,27 +42,6 @@ pub mod egl { Ok(egl) } } - - #[cfg(target_os = "windows")] - pub fn init() -> Result { - info!("Loading EGL..."); - - let dll = b"libEGL.dll\0" as &[u8]; - let dll = unsafe { LoadLibraryA(dll.as_ptr() as *const _) }; - if dll.is_null() { - Err("Can't find libEGL.dll") - } else { - unsafe { - let egl = GlesFns::load_with(|addr| { - let addr = CString::new(addr.as_bytes()).unwrap(); - let addr = addr.as_ptr(); - GetProcAddress(dll, addr) as *const _ - }); - info!("EGL loaded"); - Ok(egl) - } - } - } } #[cfg(target_os = "windows")] From b5e8ca4f3b7082ef1580f2ce90439cc5c1631879 Mon Sep 17 00:00:00 2001 From: a Date: Fri, 21 Jun 2019 17:03:19 -0400 Subject: [PATCH 3/7] Use fixed webrender. --- Cargo.lock | 70 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 4 ++++ 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7064e2d21553..865fd974388d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -408,8 +408,8 @@ dependencies = [ "raqote 0.4.1-alpha.0 (git+https://github.com/jrmuizel/raqote)", "serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", "servo_config 0.0.1", - "webrender 0.60.0 (git+https://github.com/servo/webrender)", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", ] [[package]] @@ -427,7 +427,7 @@ dependencies = [ "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", "servo_config 0.0.1", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", "webvr_traits 0.0.1", ] @@ -613,8 +613,8 @@ dependencies = [ "style_traits 0.0.1", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender 0.60.0 (git+https://github.com/servo/webrender)", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", "webvr 0.0.1", "webvr_traits 0.0.1", ] @@ -656,7 +656,7 @@ dependencies = [ "servo_remutex 0.0.1", "servo_url 0.0.1", "style_traits 0.0.1", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", "webvr_traits 0.0.1", ] @@ -1106,7 +1106,7 @@ dependencies = [ "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "servo_url 0.0.1", "style_traits 0.0.1", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", ] [[package]] @@ -1440,7 +1440,7 @@ dependencies = [ "ucd 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-bidi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", "xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "xml5ever 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2304,7 +2304,7 @@ dependencies = [ "style_traits 0.0.1", "unicode-bidi 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", "xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2351,7 +2351,7 @@ dependencies = [ "style 0.0.1", "style_traits 0.0.1", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", ] [[package]] @@ -2369,7 +2369,7 @@ dependencies = [ "script_traits 0.0.1", "servo_geometry 0.0.1", "servo_url 0.0.1", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", ] [[package]] @@ -2483,8 +2483,8 @@ dependencies = [ "style 0.0.1", "style_traits 0.0.1", "webdriver_server 0.0.1", - "webrender 0.60.0 (git+https://github.com/servo/webrender)", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", "webvr 0.0.1", "webvr_traits 0.0.1", ] @@ -2613,7 +2613,7 @@ dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", "xml5ever 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2713,7 +2713,7 @@ dependencies = [ "profile_traits 0.0.1", "servo_url 0.0.1", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", ] [[package]] @@ -2866,7 +2866,7 @@ dependencies = [ "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "size_of_test 0.0.1", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", ] [[package]] @@ -2923,7 +2923,7 @@ dependencies = [ "tokio-timer 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", "ws 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2966,7 +2966,7 @@ dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", ] [[package]] @@ -3794,7 +3794,7 @@ dependencies = [ "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "utf-8 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", "webvr_traits 0.0.1", "xml5ever 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3827,7 +3827,7 @@ dependencies = [ "servo_url 0.0.1", "style 0.0.1", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", ] [[package]] @@ -3884,7 +3884,7 @@ dependencies = [ "style_traits 0.0.1", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", "webvr_traits 0.0.1", ] @@ -4235,7 +4235,7 @@ dependencies = [ "malloc_size_of 0.0.1", "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "style_traits 0.0.1", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", ] [[package]] @@ -4600,7 +4600,7 @@ dependencies = [ "servo_url 0.0.1", "to_shmem 0.0.1", "to_shmem_derive 0.0.1", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", ] [[package]] @@ -5231,7 +5231,7 @@ dependencies = [ [[package]] name = "webrender" version = "0.60.0" -source = "git+https://github.com/servo/webrender#e53aae02728e155e555b8baa9d180d90dac3b86f" +source = "git+https://github.com/jdm/webrender?branch=servo-hl#005b785bfa91cff265077b4b9c4dafea8768b526" dependencies = [ "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5262,16 +5262,16 @@ dependencies = [ "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "thread_profiler 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", - "webrender_build 0.0.1 (git+https://github.com/servo/webrender)", - "wr_malloc_size_of 0.0.1 (git+https://github.com/servo/webrender)", + "webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)", + "webrender_build 0.0.1 (git+https://github.com/jdm/webrender?branch=servo-hl)", + "wr_malloc_size_of 0.0.1 (git+https://github.com/jdm/webrender?branch=servo-hl)", "ws 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "webrender_api" version = "0.60.0" -source = "git+https://github.com/servo/webrender#e53aae02728e155e555b8baa9d180d90dac3b86f" +source = "git+https://github.com/jdm/webrender?branch=servo-hl#005b785bfa91cff265077b4b9c4dafea8768b526" dependencies = [ "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5287,13 +5287,13 @@ dependencies = [ "serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "wr_malloc_size_of 0.0.1 (git+https://github.com/servo/webrender)", + "wr_malloc_size_of 0.0.1 (git+https://github.com/jdm/webrender?branch=servo-hl)", ] [[package]] name = "webrender_build" version = "0.0.1" -source = "git+https://github.com/servo/webrender#e53aae02728e155e555b8baa9d180d90dac3b86f" +source = "git+https://github.com/jdm/webrender?branch=servo-hl#005b785bfa91cff265077b4b9c4dafea8768b526" dependencies = [ "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -5413,7 +5413,7 @@ dependencies = [ [[package]] name = "wr_malloc_size_of" version = "0.0.1" -source = "git+https://github.com/servo/webrender#e53aae02728e155e555b8baa9d180d90dac3b86f" +source = "git+https://github.com/jdm/webrender?branch=servo-hl#005b785bfa91cff265077b4b9c4dafea8768b526" dependencies = [ "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5958,9 +5958,9 @@ dependencies = [ "checksum wayland-scanner 0.21.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f1927ee62e4e149c010dc9eca8ca47e238416cd6f45f688eb9f8a8e9c3794c30" "checksum wayland-sys 0.21.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ca41ed78a12256f81df6f53fcbe4503213ba442e02cdad3c9c888a64a668eaf4" "checksum webdriver 0.39.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0533b0b0a05e2e5c081317759a038482806c6085c9605dded03c8bbd2498b042" -"checksum webrender 0.60.0 (git+https://github.com/servo/webrender)" = "" -"checksum webrender_api 0.60.0 (git+https://github.com/servo/webrender)" = "" -"checksum webrender_build 0.0.1 (git+https://github.com/servo/webrender)" = "" +"checksum webrender 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)" = "" +"checksum webrender_api 0.60.0 (git+https://github.com/jdm/webrender?branch=servo-hl)" = "" +"checksum webrender_build 0.0.1 (git+https://github.com/jdm/webrender?branch=servo-hl)" = "" "checksum weedle 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc44aa200daee8b1f3a004beaf16554369746f1b4486f0cf93b0caf8a3c2d1e" "checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" "checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" @@ -5970,7 +5970,7 @@ dependencies = [ "checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" "checksum winit 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d233301129ddd33260b47f76900b50e154b7254546e2edba0e5468a1a5fe4de3" "checksum winres 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "27d9192d6356d7efe8405dec6c5506b67543cf64b6049968f39f4c4623b4f25d" -"checksum wr_malloc_size_of 0.0.1 (git+https://github.com/servo/webrender)" = "" +"checksum wr_malloc_size_of 0.0.1 (git+https://github.com/jdm/webrender?branch=servo-hl)" = "" "checksum ws 0.7.9 (registry+https://github.com/rust-lang/crates.io-index)" = "329d3e6dd450a9c5c73024e1047f0be7e24121a68484eb0b5368977bee3cf8c3" "checksum ws 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ec91ea61b83ce033c43c06c52ddc7532f465c0153281610d44c58b74083aee1a" "checksum x11 2.17.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e5c4ac579b5d324dc4add02312b5d0e3e0218521e2d5779d526ac39ee4bb171" diff --git a/Cargo.toml b/Cargo.toml index 060be41a5d2d..8f74656b720f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,3 +29,7 @@ opt-level = 3 mio = { git = "https://github.com/servo/mio.git", branch = "servo" } iovec = { git = "https://github.com/servo/iovec.git", branch = "servo" } cmake = { git = "https://github.com/alexcrichton/cmake-rs" } + +[patch."https://github.com/servo/webrender"] +webrender = { git = "https://github.com/jdm/webrender", branch = "servo-hl" } +webrender_api = { git = "https://github.com/jdm/webrender", branch = "servo-hl" } From df3b4e7aedbd6f3b68c8fd465eb290917f87cf46 Mon Sep 17 00:00:00 2001 From: Paul Rouget Date: Sat, 22 Jun 2019 00:05:35 +0200 Subject: [PATCH 4/7] Hololens port --- .gitignore | 38 ++ support/hololens/App.xaml | 7 + support/hololens/App.xaml.cpp | 25 + support/hololens/App.xaml.h | 17 + .../Assets/LockScreenLogo.scale-200.png | Bin 0 -> 1430 bytes .../Assets/SplashScreen.scale-200.png | Bin 0 -> 7700 bytes .../Assets/Square150x150Logo.scale-200.png | Bin 0 -> 2937 bytes .../Assets/Square44x44Logo.scale-200.png | Bin 0 -> 1647 bytes ...x44Logo.targetsize-24_altform-unplated.png | Bin 0 -> 1255 bytes support/hololens/Assets/StoreLogo.png | Bin 0 -> 1451 bytes .../Assets/Wide310x150Logo.scale-200.png | Bin 0 -> 3204 bytes support/hololens/OpenGLES.cpp | 215 +++++++++ support/hololens/OpenGLES.h | 23 + support/hololens/OpenGLESPage.xaml | 13 + support/hololens/OpenGLESPage.xaml.cpp | 147 ++++++ support/hololens/OpenGLESPage.xaml.h | 32 ++ support/hololens/Package.appxmanifest | 46 ++ .../ProjectDefaultFilters.vcxproj.filters | 30 ++ support/hololens/Servo.cpp | 79 ++++ support/hololens/Servo.h | 27 ++ support/hololens/ServoApp.sln | 43 ++ support/hololens/ServoApp.vcxproj | 446 ++++++++++++++++++ support/hololens/ServoApp.vcxproj.filters | 251 ++++++++++ support/hololens/ServoApp_TemporaryKey.pfx | Bin 0 -> 2512 bytes support/hololens/packages.config | 4 + support/hololens/pch.cpp | 1 + support/hololens/pch.h | 15 + 27 files changed, 1459 insertions(+) create mode 100644 support/hololens/App.xaml create mode 100644 support/hololens/App.xaml.cpp create mode 100644 support/hololens/App.xaml.h create mode 100644 support/hololens/Assets/LockScreenLogo.scale-200.png create mode 100644 support/hololens/Assets/SplashScreen.scale-200.png create mode 100644 support/hololens/Assets/Square150x150Logo.scale-200.png create mode 100644 support/hololens/Assets/Square44x44Logo.scale-200.png create mode 100644 support/hololens/Assets/Square44x44Logo.targetsize-24_altform-unplated.png create mode 100644 support/hololens/Assets/StoreLogo.png create mode 100644 support/hololens/Assets/Wide310x150Logo.scale-200.png create mode 100644 support/hololens/OpenGLES.cpp create mode 100644 support/hololens/OpenGLES.h create mode 100644 support/hololens/OpenGLESPage.xaml create mode 100644 support/hololens/OpenGLESPage.xaml.cpp create mode 100644 support/hololens/OpenGLESPage.xaml.h create mode 100644 support/hololens/Package.appxmanifest create mode 100644 support/hololens/ProjectDefaultFilters.vcxproj.filters create mode 100644 support/hololens/Servo.cpp create mode 100644 support/hololens/Servo.h create mode 100644 support/hololens/ServoApp.sln create mode 100644 support/hololens/ServoApp.vcxproj create mode 100644 support/hololens/ServoApp.vcxproj.filters create mode 100644 support/hololens/ServoApp_TemporaryKey.pfx create mode 100644 support/hololens/packages.config create mode 100644 support/hololens/pch.cpp create mode 100644 support/hololens/pch.h diff --git a/.gitignore b/.gitignore index e29d44ca3ea3..5bb42de78e14 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,41 @@ capture_webrender/ /unminified-js +# Hololens artifacts + +support/hololens/x64/ +support/hololens/Generated\ Files + +# Ignore thumbnails created by Windows +support/hololens/Thumbs.db + +# Ignore files built by Visual Studio +support/hololens/*.obj +support/hololens/*.exe +support/hololens/*.pdb +support/hololens/*.user +support/hololens/*.aps +support/hololens/*.pch +support/hololens/*.vspscc +support/hololens/*_i.c +support/hololens/*_p.c +support/hololens/*.ncb +support/hololens/*.suo +support/hololens/*.tlb +support/hololens/*.tlh +support/hololens/*.bak +support/hololens/*.cache +support/hololens/*.ilk +support/hololens/*.log +support/hololens/[Bb]in +support/hololens/[Dd]ebug*/ +support/hololens/*.lib +support/hololens/*.sbr +support/hololens/obj/ +support/hololens/[Rr]elease*/ +support/hololens/_ReSharper*/ +support/hololens/[Tt]est[Rr]esult* +support/hololens/.vs/ + +# Nuget packages folder +support/hololens/packages/ diff --git a/support/hololens/App.xaml b/support/hololens/App.xaml new file mode 100644 index 000000000000..bad26e0a803b --- /dev/null +++ b/support/hololens/App.xaml @@ -0,0 +1,7 @@ + + + diff --git a/support/hololens/App.xaml.cpp b/support/hololens/App.xaml.cpp new file mode 100644 index 000000000000..d62bc28e1c29 --- /dev/null +++ b/support/hololens/App.xaml.cpp @@ -0,0 +1,25 @@ +#include "pch.h" +#include "App.xaml.h" + +using namespace hlservo; + +App::App() +{ + InitializeComponent(); +} + +void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs ^ e) +{ +#if _DEBUG + if (IsDebuggerPresent()) { + DebugSettings->EnableFrameRateCounter = true; + } +#endif + + if (mPage == nullptr) { + mPage = ref new OpenGLESPage(&mOpenGLES); + } + + Windows::UI::Xaml::Window::Current->Content = mPage; + Windows::UI::Xaml::Window::Current->Activate(); +} diff --git a/support/hololens/App.xaml.h b/support/hololens/App.xaml.h new file mode 100644 index 000000000000..5568d01e99ca --- /dev/null +++ b/support/hololens/App.xaml.h @@ -0,0 +1,17 @@ +#pragma once + +#include "OpenGLES.h" +#include "app.g.h" +#include "openglespage.xaml.h" + +namespace hlservo { +ref class App sealed { +public: + App(); + virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs ^ e) override; + +private: + OpenGLESPage ^ mPage; + OpenGLES mOpenGLES; +}; +} diff --git a/support/hololens/Assets/LockScreenLogo.scale-200.png b/support/hololens/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..735f57adb5dfc01886d137b4e493d7e97cf13af3 GIT binary patch literal 1430 zcmaJ>TTC2P7~aKltDttVHYH6u8Io4i*}3fO&d$gd*bA_<3j~&e7%8(eXJLfhS!M@! zKrliY>>6yT4+Kr95$!DoD(Qn-5TP|{V_KS`k~E6(LGS@#`v$hQo&^^BKsw3HIsZBT z_y6C2n`lK@apunKojRQ^(_P}Mgewt$(^BBKCTZ;*xa?J3wQ7~@S0lUvbcLeq1Bg4o zH-bvQi|wt~L7q$~a-gDFP!{&TQfc3fX*6=uHv* zT&1&U(-)L%Xp^djI2?~eBF2cxC@YOP$+9d?P&h?lPy-9M2UT9fg5jKm1t$m#iWE{M zIf%q9@;fyT?0UP>tcw-bLkz;s2LlKl2qeP0w zECS7Ate+Awk|KQ+DOk;fl}Xsy4o^CY=pwq%QAAKKl628_yNPsK>?A>%D8fQG6IgdJ ztnxttBz#NI_a@fk7SU`WtrpsfZsNs9^0(2a z@C3#YO3>k~w7?2hipBf{#b6`}Xw1hlG$yi?;1dDs7k~xDAw@jiI*+tc;t2Lflg&bM)0!Y;0_@=w%`LW^8DsYpS#-bLOklX9r?Ei}TScw|4DbpW%+7 zFgAI)f51s}{y-eWb|vrU-Ya!GuYKP)J7z#*V_k^Xo>4!1Yqj*m)x&0L^tg3GJbVAJ zJ-Pl$R=NAabouV=^z_t;^K*0AvFs!vYU>_<|I^#c?>>CR<(T?=%{;U=aI*SbZADLH z&(f2wz_Y0??Tf|g;?|1Znw6}6U43Q#qNRwv1vp9uFn1)V#*4p&%$mP9x&15^OaBiDS(XppT|z^>;B{PLVEbS3IFYV yGvCsSX*m literal 0 HcmV?d00001 diff --git a/support/hololens/Assets/SplashScreen.scale-200.png b/support/hololens/Assets/SplashScreen.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..023e7f1feda78d5100569825acedfd213a0d84e9 GIT binary patch literal 7700 zcmeHLYj~4Yw%(;oxoEH#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}H(K!vI`~gf|Gv+FNEQD5Yd<~yX7k_l h&G-K)@HZb3BABY{)U1?^%I#E6`MGoTtustd{~yM6srvu` literal 0 HcmV?d00001 diff --git a/support/hololens/Assets/Square150x150Logo.scale-200.png b/support/hololens/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..af49fec1a5484db1d52a7f9b5ec90a27c7030186 GIT binary patch literal 2937 zcma)84OCO-8BSud5)jwMLRVKgX(S?$n?Ld|vrsm<$CF7)&zTbyy1FE5bU`Q17MRv`9ue$;R(@8kR;#vJ*IM0>cJIAOte!d7oRgdH zd%ySjdB6L9=gX^A6)VzH7p2l@v~3zJAMw|DFy#^)F@@F*`mqUn=Il>l)8_+ab;nOW{%+iPx z+s{Eu|&pIs)Z7{La9~?xKfyl z#43?gjEL15d4WbOZo#SiP%>DB^+BcnJ=7dHEe;r#G=tuw|ka z%q@}##Uh7;tc%L_64m(kHtw74ty%BJMb)_1)#S0j`)F8_1jF7vScpsnH=0V19bO8y zR`0SjIdCUo&=>JwMQF8KHA<{ODHTiQh}0^@5QRmCA?gOH6_H3K^-_sNB^RrdNuK-R zOO*vOrKCVvDwgUck`kF(E7j{I#iiN;b*ZdCt4m@HPA`EuEqGGf4%!K<;(=I=&Vyrw z%TwcWtxa}8mCZ%Cyf&ActJ6_$ox5z6-D!0-dvnRx6t7y3d+h6QYpKWO;8OdnvERo7 zuEf>ih5`wqY)~o@OeVt-wM?Q!>QzdGRj!bz6fzYrfw$hZfAKzr2-M+D+R>}~oT574c;_3zquHcElqKIsryILt3g8n3jcMb+j?i?-L3FpZJ z2WRVBRdDPc+G5aaYg#5hpE+6nQ|(VSoxT3|biF;BUq#==-27Xi=gihDPYP$7?=9cP zYKE$jeQ|3~_L0VG-(F~2ZPyD0=k{J4Q~h(t__{-mz_w8{JDY9{`1ouzz!Vr5!ECdE z6U~O1k8c}24V7~zzXWTV-Pe4)y}wQJS&q%H5`Fo_f_JvIU489aCX$;P`u#!I-=^4ijC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1$}Sz4zGn3Du&x bht0Iza^2ykEt4(epJ78uh5nDlX8(TxzDYwP literal 0 HcmV?d00001 diff --git a/support/hololens/Assets/Square44x44Logo.scale-200.png b/support/hololens/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..ce342a2ec8a61291ba76c54604aea7e9d20af11b GIT binary patch literal 1647 zcmaJ?eM}Q)7(e+G1Q(|`V9JhTI2>MkceK4;p;PR&$Pi?ejk3YQ_3o`S&|W_dsOZ8# zWPTt69g`t$ab`0cj-Y0yiBSOqmd)tG7G(}M5aP0_%&9TijB#&)I{zSE^4@#z^FF`l z`8{8`o%wlL(UI|y2!cdsuVamHH~H86F!*-15em4)NqUpCQM5?aoC_eCf@lV4wvF2a zjDQn1JBL69f&@2M3rvzJcfE!eZ8FZUBlFlC5RD)it33{mF9#B82AiyQE%w)`vlwa> zv{<1sm&kSKK$&%2jSFn7$t&P%%6Ue>R=EAnG8N7fqynWG8L3p!4801a;8{+nliO(qd(jNJ_?+9W3#hLIDLoT6~3fx9=`CC-D}-AMrpEO7HK zt3$GicGPc?GmDjy7K2P@La;eu4!$zWCZ`ym{Z$b zu-O6RM&K4JT|BIZB`E-gxqG%FzanI#+2FFmqHqXG7yxWB=w55RGOM)$xMb(>kSNR z2w=1AZi%z=AmG~yea~XaXJR!v7vLn(RUnELfiB1|6D84ICOS}^Zo2AdN}<&*h}G_u z{xZ!(%>tLT3J3<5XhWy-tg+6)0nmUUENLW8TWA{R6bgVd3X;anYFZ^IRis*_P-C-r z;i>%1^eL3UI2-{w8nuFFcs0e~7J{O2k^~Ce%+Ly4U?|=!0LH=t6()xi<^I-rs+9sF z*q{E-CxZbGPeu#a;XJwE;9S1?#R&uns>^0G3p`hEUF*v`M?@h%T%J%RChmD|EVydq zmHWh*_=S%emRC*mhxaVLzT@>Z2SX0u9v*DIJ@WC^kLVdlGV6LpK$KIrlJqc zpJ921)+3JJdTx|<`G&kXpKkjGJv=76R`yYIQ{#c-`%+`#V(7}Q;&@6U8!Td1`d;?N z_9mnI#?AA}4J!r)LN4!E-@H5eXauuB7TOawS>Y|{-P?NNx-lq+z1W-+y(;39P&&LP zL{N80?&=C*qKmdA^moMZRuPcD!B<*mq$ch=0Cnlitw#txRWhb3%TQvPqjkC`F69G4b! ze7z9MZ#+;_#l?H37UqUhDFb^l&s2{oM$3I0o^Q!yx;;V)QmCMo)Tb_ui|mit8MS?U zm##6$sZZ1$@|s%?l@>4Z<*Q}sRBSKMhb4I{e5LdEhsHIHTe8Bod5c>6QtT>$XgUBz z6MK`kO$=jmt@FqggOhJ5j~e@ygRbG;<{Vu)*+nn9aQeo0;$#j;|MS=S$&L?BeV25z xs3B`@=#`5TF{^6(A1rvdY@|-RtQ|iS5{tyX+wH?;n8E)G$kykv-D^wh{{!TZT%7;_ literal 0 HcmV?d00001 diff --git a/support/hololens/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/support/hololens/Assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 0000000000000000000000000000000000000000..f6c02ce97e0a802b85f6021e822c89f8bf57d5cd GIT binary patch literal 1255 zcmaJ>TWs4@7*5+{G#S+&C!qC#> zf>5N3P6jO*Cz>ug*(_DmW=)kea&m$gZ^+nyiF`;j%w@}y8)>p*SH}C`m?DXeieF2U zyQHecc_L%Gh!7GMt+hG06y;+|p4>m~}PjA}rKViGiEnn7G0ZO<>G|7q;2?NwGCM3s?eued6%hd$B+ z*kQJ{#~$S=DFE(%=E+UkmlEI*%3llUf~8Ja9YU1Vui0IbGBkW_gHB%Rd&!!ioX zs40O?i9I{};kle7GMvE7(rk`la=gTI)47=>%?q@^iL-nUo3}h4S}N-KHn8t5mVP8w z&bSErwp+37 zNJJ8?a|{r5Q3R0Z5s-LB1WHOwYC@7pCHWND#cL1cZ?{kJ368_*(UDWUDyb<}0y@o# zfMF016iMWPCb6obAxT$JlB6(2DrlXDTB&!0`!m??4F(qWMhjVZo?JXQmz`1*58Z=& zcDmB|S-E@j?BoFGix0flckqdS4jsPNzhfWyWIM98GxcLs89C(~dw%$_t;JjX-SD}E zfiGV;{8Q%8r}w9x>EEigW81>`kvnU@pK)4+xk9@+bNj9L!AAZ@SZ@q|)&BmY3+HZx zul~BeG4|}-;L%cHViQGQX?^zFfO0&#cHwel=d`lH9sJ-@Sl@n*(8J2>%Ac`IxyY?Q z{=GhWvC#gu-~Ia7*n{=+;qM?Ul_wy1+u7ho;=`>EwP^g~R@{unBds`!#@}tluZQpS zm)M~nYEifJWJGx?_6DcTy>#uh%>!H9=hb^(v`=m3F1{L>db=<5_tm+_&knAQ2EU$s Mu9UqpbNZeC0BbUo^Z)<= literal 0 HcmV?d00001 diff --git a/support/hololens/Assets/StoreLogo.png b/support/hololens/Assets/StoreLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..7385b56c0e4d3c6b0efe3324aa1194157d837826 GIT binary patch literal 1451 zcmaJ>eN5D57_Z|bH;{0+1#mbl)eTU3{h)Wf7EZV?;HD@XL@{B`Ui%(2aMxQ~xdXSv z5nzWi(LW)U2=Vc-cY@s7nPt{i0hc6!7xN4NNHI#EQl>YNBy8l4%x9gr_W-j zEZMQmmTIy(>;lblRfh`dIyTgc9W5d!VP$L4(kKrN1c5G~(O_#xG zAJCNTstD^5SeXFB+&$h=ToJP2H>xr$iqPs-#O*;4(!Fjw25-!gEb*)mU}=)J;Iu>w zxK(5XoD0wrPSKQ~rbL^Cw6O_03*l*}i=ydbu7adJ6y;%@tjFeXIXT+ms30pmbOP%Q zX}S;+LBh8Tea~TSkHzvX6$rYb)+n&{kSbIqh|c7hmlxmwSiq5iVhU#iEQ<>a18|O^Sln-8t&+t`*{qBWo5M?wFM(JuimAOb5!K#D}XbslM@#1ZVz_;!9U zpfEpLAOz=0g@bd6Xj_ILi-x^!M}73h^o@}hM$1jflTs|Yuj9AL@A3<-?MV4!^4q`e z)fO@A;{9K^?W?DbnesnPr6kK>$zaKo&;FhFd(GYFCIU^T+OIMb%Tqo+P%oq(IdX7S zf6+HLO?7o0m+p>~Tp5UrXWh!UH!wZ5kv!E`_w)PTpI(#Iw{AS`gH4^b(bm^ZCq^FZ zY9DD7bH}rq9mg88+KgA$Zp!iWncuU2n1AuIa@=sWvUR-s`Qb{R*kk(SPU^`$6BXz8 zn#7yaFOIK%qGxyi`dYtm#&qqox0$h=pNi#u=M8zUG@bpiZ=3sT=1}Trr}39cC)H|v zbL?W)=&s4zrh)7>L(|cc%$1#!zfL?HjpeP%T+x_a+jZ16b^iKOHxFEX$7d|8${H-* zIrOJ5w&i$>*D>AKaIoYg`;{L@jM((Kt?$N$5OnuPqVvq**Nm}(f0wwOF%iX_Pba;V z;m@wxX&NcV3?<1+u?A{y_DIj7#m3Af1rCE)o`D&Y3}0%7E;iX1yMDiS)sh0wKi!36 zL!Wmq?P^Ku&rK~HJd97KkLTRl>ScGFYZNlYytWnhmuu|)L&ND8_PmkayQb{HOY640 bno1(wj@u8DCVuFR|31B*4ek@pZJqxCDDe1x literal 0 HcmV?d00001 diff --git a/support/hololens/Assets/Wide310x150Logo.scale-200.png b/support/hololens/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..288995b397fdbef1fb7e85afd71445d5de1952c5 GIT binary patch literal 3204 zcmbVPeQXow8NYmBd90>}0NP?GhXW~VaeThm=a0tV#EwJMI!)6M3}|c4_Bl3=Kd>G0 z(GHx1wl<7(tP?FsOQkTilSo*iIvF%uArExJ73~P zSv1xEy!U(Wd4A9D`FQV@W3@F^qJ@PEF$@z`Z!*BbFsS(^?B zyiAzJ+q})bkgiQHWqEb*jJD-coHYr1^iocg)l!Qa{Xqs-l~6J}p-|##ZHYofskQ3$ zI0;xzXyhazBeXhIsg5A=%ufo@f)1yy&ScKS0;HF^!r_2UE^lpZEom(+@duma3awTv zCrCL-%D_SvYWIcdHkmI}#50(fkUi)Qgx!80ju>g1za^}ff>JI8Z@^-iCiaCgg@TgF z+vtE?Q9{VQUX&MW9SYYmGcxA14%N2@7FwBTD4N<(2{nWgV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arN%PrTLQ2Uzysx>UV=V zk^RrDSvdQ?0;=hY67EgII-f4`t=+i*yS=Y~!XlqIy_4x&%+OdfbKOFPXS2X5%4R{N z$SQMX^AK6(fA(eglGetProcAddress("eglGetPlatformDisplayEXT")); + if (!eglGetPlatformDisplayEXT) { + throw Exception::CreateException(E_FAIL, L"Failed to get function eglGetPlatformDisplayEXT"); + } + + // + // To initialize the display, we make three sets of calls to eglGetPlatformDisplayEXT and eglInitialize, with varying + // parameters passed to eglGetPlatformDisplayEXT: + // 1) The first calls uses "defaultDisplayAttributes" as a parameter. This corresponds to D3D11 Feature Level 10_0+. + // 2) If eglInitialize fails for step 1 (e.g. because 10_0+ isn't supported by the default GPU), then we try again + // using "fl9_3DisplayAttributes". This corresponds to D3D11 Feature Level 9_3. + // 3) If eglInitialize fails for step 2 (e.g. because 9_3+ isn't supported by the default GPU), then we try again + // using "warpDisplayAttributes". This corresponds to D3D11 Feature Level 11_0 on WARP, a D3D11 software rasterizer. + // + + // This tries to initialize EGL to D3D11 Feature Level 10_0+. See above comment for details. + mEglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, defaultDisplayAttributes); + if (mEglDisplay == EGL_NO_DISPLAY) { + throw Exception::CreateException(E_FAIL, L"Failed to get EGL display"); + } + + if (eglInitialize(mEglDisplay, NULL, NULL) == EGL_FALSE) { + // This tries to initialize EGL to D3D11 Feature Level 9_3, if 10_0+ is unavailable (e.g. on some mobile devices). + mEglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, fl9_3DisplayAttributes); + if (mEglDisplay == EGL_NO_DISPLAY) { + throw Exception::CreateException(E_FAIL, L"Failed to get EGL display"); + } + + if (eglInitialize(mEglDisplay, NULL, NULL) == EGL_FALSE) { + // This initializes EGL to D3D11 Feature Level 11_0 on WARP, if 9_3+ is unavailable on the default GPU. + mEglDisplay = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, warpDisplayAttributes); + if (mEglDisplay == EGL_NO_DISPLAY) { + throw Exception::CreateException(E_FAIL, L"Failed to get EGL display"); + } + + if (eglInitialize(mEglDisplay, NULL, NULL) == EGL_FALSE) { + // If all of the calls to eglInitialize returned EGL_FALSE then an error has occurred. + throw Exception::CreateException(E_FAIL, L"Failed to initialize EGL"); + } + } + } + + EGLint numConfigs = 0; + if ((eglChooseConfig(mEglDisplay, configAttributes, &mEglConfig, 1, &numConfigs) == EGL_FALSE) || (numConfigs == 0)) { + throw Exception::CreateException(E_FAIL, L"Failed to choose first EGLConfig"); + } + + mEglContext = eglCreateContext(mEglDisplay, mEglConfig, EGL_NO_CONTEXT, contextAttributes); + if (mEglContext == EGL_NO_CONTEXT) { + throw Exception::CreateException(E_FAIL, L"Failed to create EGL context"); + } +} + +void OpenGLES::Cleanup() +{ + if (mEglDisplay != EGL_NO_DISPLAY && mEglContext != EGL_NO_CONTEXT) { + eglDestroyContext(mEglDisplay, mEglContext); + mEglContext = EGL_NO_CONTEXT; + } + + if (mEglDisplay != EGL_NO_DISPLAY) { + eglTerminate(mEglDisplay); + mEglDisplay = EGL_NO_DISPLAY; + } +} + +void OpenGLES::Reset() +{ + Cleanup(); + Initialize(); +} + +EGLSurface OpenGLES::CreateSurface(SwapChainPanel ^ panel) +{ + if (!panel) { + throw Exception::CreateException(E_INVALIDARG, L"SwapChainPanel parameter is invalid"); + } + + EGLSurface surface = EGL_NO_SURFACE; + + const EGLint surfaceAttributes[] = { + EGL_ANGLE_SURFACE_RENDER_TO_BACK_BUFFER, EGL_TRUE, + EGL_NONE + }; + + PropertySet ^ surfaceCreationProperties = ref new PropertySet(); + surfaceCreationProperties->Insert(ref new String(EGLNativeWindowTypeProperty), panel); + + // How to set size and or scale: + // surfaceCreationProperties->Insert(ref new String(EGLRenderSurfaceSizeProperty), PropertyValue::CreateSize(*renderSurfaceSize)); + // surfaceCreationProperties->Insert(ref new String(EGLRenderResolutionScaleProperty), PropertyValue::CreateSingle(*resolutionScale)); + + surface = eglCreateWindowSurface(mEglDisplay, mEglConfig, reinterpret_cast(surfaceCreationProperties), surfaceAttributes); + if (surface == EGL_NO_SURFACE) { + throw Exception::CreateException(E_FAIL, L"Failed to create EGL surface"); + } + + return surface; +} + +void OpenGLES::GetSurfaceDimensions(const EGLSurface surface, EGLint* width, EGLint* height) +{ + eglQuerySurface(mEglDisplay, surface, EGL_WIDTH, width); + eglQuerySurface(mEglDisplay, surface, EGL_HEIGHT, height); +} + +void OpenGLES::DestroySurface(const EGLSurface surface) +{ + if (mEglDisplay != EGL_NO_DISPLAY && surface != EGL_NO_SURFACE) { + eglDestroySurface(mEglDisplay, surface); + } +} + +void OpenGLES::MakeCurrent(const EGLSurface surface) +{ + if (eglMakeCurrent(mEglDisplay, surface, surface, mEglContext) == EGL_FALSE) { + throw Exception::CreateException(E_FAIL, L"Failed to make EGLSurface current"); + } +} + +EGLBoolean OpenGLES::SwapBuffers(const EGLSurface surface) +{ + return (eglSwapBuffers(mEglDisplay, surface)); +} diff --git a/support/hololens/OpenGLES.h b/support/hololens/OpenGLES.h new file mode 100644 index 000000000000..133619a1ecce --- /dev/null +++ b/support/hololens/OpenGLES.h @@ -0,0 +1,23 @@ +#pragma once + +class OpenGLES { +public: + OpenGLES(); + ~OpenGLES(); + + EGLSurface CreateSurface(Windows::UI::Xaml::Controls::SwapChainPanel ^ panel); + void GetSurfaceDimensions(const EGLSurface surface, EGLint* width, EGLint* height); + void DestroySurface(const EGLSurface surface); + void MakeCurrent(const EGLSurface surface); + EGLBoolean SwapBuffers(const EGLSurface surface); + void Reset(); + +private: + void Initialize(); + void Cleanup(); + +private: + EGLDisplay mEglDisplay; + EGLContext mEglContext; + EGLConfig mEglConfig; +}; diff --git a/support/hololens/OpenGLESPage.xaml b/support/hololens/OpenGLESPage.xaml new file mode 100644 index 000000000000..c53f473505aa --- /dev/null +++ b/support/hololens/OpenGLESPage.xaml @@ -0,0 +1,13 @@ + + + + + + diff --git a/support/hololens/OpenGLESPage.xaml.cpp b/support/hololens/OpenGLESPage.xaml.cpp new file mode 100644 index 000000000000..05343bc8686f --- /dev/null +++ b/support/hololens/OpenGLESPage.xaml.cpp @@ -0,0 +1,147 @@ +#include "pch.h" +#include "OpenGLESPage.xaml.h" +#include "Servo.h" + +using namespace hlservo; +using namespace Platform; +using namespace Concurrency; +using namespace Windows::Foundation; + +static char sWakeupEvent[] = "SIGNAL_WAKEUP"; + +OpenGLESPage::OpenGLESPage() + : OpenGLESPage(nullptr) +{ +} + +OpenGLESPage::OpenGLESPage(OpenGLES* openGLES) + : mOpenGLES(openGLES) + , mRenderSurface(EGL_NO_SURFACE) +{ + InitializeComponent(); + Windows::UI::Core::CoreWindow ^ window = Windows::UI::Xaml::Window::Current->CoreWindow; + window->VisibilityChanged += ref new Windows::Foundation::TypedEventHandler(this, &OpenGLESPage::OnVisibilityChanged); + this->Loaded += ref new Windows::UI::Xaml::RoutedEventHandler(this, &OpenGLESPage::OnPageLoaded); +} + +OpenGLESPage::~OpenGLESPage() +{ + StopRenderLoop(); + DestroyRenderSurface(); +} + +void OpenGLESPage::OnPageLoaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e) +{ + CreateRenderSurface(); + StartRenderLoop(); +} + +void OpenGLESPage::OnVisibilityChanged(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::VisibilityChangedEventArgs ^ args) +{ + if (args->Visible && mRenderSurface != EGL_NO_SURFACE) { + StartRenderLoop(); + } else { + StopRenderLoop(); + } +} + +void OpenGLESPage::CreateRenderSurface() +{ + if (mOpenGLES && mRenderSurface == EGL_NO_SURFACE) { + mRenderSurface = mOpenGLES->CreateSurface(swapChainPanel); + } +} + +void OpenGLESPage::DestroyRenderSurface() +{ + if (mOpenGLES) { + mOpenGLES->DestroySurface(mRenderSurface); + } + mRenderSurface = EGL_NO_SURFACE; +} + +void OpenGLESPage::RecoverFromLostDevice() +{ + StopRenderLoop(); + { + critical_section::scoped_lock lock(mRenderSurfaceCriticalSection); + + DestroyRenderSurface(); + mOpenGLES->Reset(); + CreateRenderSurface(); + } + StartRenderLoop(); +} + +void OpenGLESPage::StartRenderLoop() +{ + if (mRenderLoopWorker != nullptr && mRenderLoopWorker->Status == Windows::Foundation::AsyncStatus::Started) { + return; + } + + auto loop = [this](Windows::Foundation::IAsyncAction ^ action) { + critical_section::scoped_lock lock(mRenderSurfaceCriticalSection); + + HANDLE hEvent = ::CreateEventA(nullptr, FALSE, FALSE, sWakeupEvent); + + // Called by Servo + Servo::sMakeCurrent = [this]() { + /* EGLint panelWidth = 0; */ + /* EGLint panelHeight = 0; */ + /* mOpenGLES->GetSurfaceDimensions(mRenderSurface, &panelWidth, &panelHeight); */ + /* glViewport(0, 0, panelWidth, panelHeight); */ + /* mServo->SetSize(panelWidth, panelHeight); */ + mOpenGLES->MakeCurrent(mRenderSurface); + }; + + // Called by Servo + Servo::sFlush = [this]() { + if (mOpenGLES->SwapBuffers(mRenderSurface) != GL_TRUE) { + // The call to eglSwapBuffers might not be successful (i.e. due to Device Lost) + // If the call fails, then we must reinitialize EGL and the GL resources. + swapChainPanel->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::High, ref new Windows::UI::Core::DispatchedHandler([=]() { + RecoverFromLostDevice(); + }, CallbackContext::Any)); + } + }; + + mOpenGLES->MakeCurrent(mRenderSurface); + + EGLint panelWidth = 0; + EGLint panelHeight = 0; + mOpenGLES->GetSurfaceDimensions(mRenderSurface, &panelWidth, &panelHeight); + glViewport(0, 0, panelWidth, panelHeight); + mServo = new Servo(panelWidth, panelHeight); + + while (action->Status == Windows::Foundation::AsyncStatus::Started) { + // Block until Servo::sWakeUp is called. + // Or run full speed if animating (see on_animating_changed), + // it will endup blocking on SwapBuffers to limit rendering to 60FPS + if (!Servo::sAnimating) { + ::WaitForSingleObject(hEvent, INFINITE); + } + mServo->PerformUpdates(); + } + }; + + auto workItemHandler = ref new Windows::System::Threading::WorkItemHandler(loop); + + // Run Servo task in a high priority background thread. + mRenderLoopWorker = Windows::System::Threading::ThreadPool::RunAsync( + workItemHandler, + Windows::System::Threading::WorkItemPriority::High, + Windows::System::Threading::WorkItemOptions::TimeSliced); + + Servo::sWakeUp = []() { + HANDLE hEvent = ::OpenEventA(EVENT_ALL_ACCESS, FALSE, sWakeupEvent); + ::SetEvent(hEvent); + }; +} + +void OpenGLESPage::StopRenderLoop() +{ + if (mRenderLoopWorker) { + mRenderLoopWorker->Cancel(); + mRenderLoopWorker = nullptr; + } +} diff --git a/support/hololens/OpenGLESPage.xaml.h b/support/hololens/OpenGLESPage.xaml.h new file mode 100644 index 000000000000..e1bb2832101b --- /dev/null +++ b/support/hololens/OpenGLESPage.xaml.h @@ -0,0 +1,32 @@ +#pragma once + +#include "OpenGLES.h" +#include "OpenGLESPage.g.h" +#include "Servo.h" + +namespace hlservo { +public +ref class OpenGLESPage sealed { +public: + OpenGLESPage(); + virtual ~OpenGLESPage(); + + internal : OpenGLESPage(OpenGLES* openGLES); + +private: + void OnPageLoaded(Platform::Object ^ sender, Windows::UI::Xaml::RoutedEventArgs ^ e); + void OnVisibilityChanged(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::VisibilityChangedEventArgs ^ args); + void CreateRenderSurface(); + void DestroyRenderSurface(); + void RecoverFromLostDevice(); + void StartRenderLoop(); + void StopRenderLoop(); + + OpenGLES* mOpenGLES; + + EGLSurface mRenderSurface; + Concurrency::critical_section mRenderSurfaceCriticalSection; + Windows::Foundation::IAsyncAction ^ mRenderLoopWorker; + Servo* mServo; +}; +} diff --git a/support/hololens/Package.appxmanifest b/support/hololens/Package.appxmanifest new file mode 100644 index 000000000000..cfb83f8d68ca --- /dev/null +++ b/support/hololens/Package.appxmanifest @@ -0,0 +1,46 @@ + + + + + + + + + + Servo + Allizom + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + + + + diff --git a/support/hololens/ProjectDefaultFilters.vcxproj.filters b/support/hololens/ProjectDefaultFilters.vcxproj.filters new file mode 100644 index 000000000000..81fb9b6f1090 --- /dev/null +++ b/support/hololens/ProjectDefaultFilters.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + d64db011-1240-48ad-a857-7af0ffd781dc + bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png + + + dll; + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + diff --git a/support/hololens/Servo.cpp b/support/hololens/Servo.cpp new file mode 100644 index 000000000000..705431c8d152 --- /dev/null +++ b/support/hololens/Servo.cpp @@ -0,0 +1,79 @@ +#include "pch.h" +#include "Servo.h" + +extern "C" { +#include +} + +using namespace hlservo; + +void on_load_started() {} +void on_load_ended() {} +void on_title_changed(const char* title) {} +void on_url_changed(const char* url) {} +void on_history_changed(bool back, bool fwd) {} +void on_shutdown_complete() {} + +std::function Servo::sFlush = [](){}; +std::function Servo::sMakeCurrent = [](){}; +std::function Servo::sWakeUp = [](){}; +bool Servo::sAnimating = false; + +void flush() { + Servo::sFlush(); +} + +void make_current() { + Servo::sMakeCurrent(); +} + +void wakeup() { + Servo::sWakeUp(); +} + +void on_animating_changed(bool aAnimating) { + Servo::sAnimating = aAnimating; +} + +Servo::Servo(GLsizei width, GLsizei height) + : mAnimating(false) + , mWindowHeight(height) + , mWindowWidth(width) { + + CInitOptions o; + o.args = NULL; + o.url = "http://example.com"; + o.width = mWindowWidth; + o.height = mWindowHeight; + o.density = 1.0; + o.enable_subpixel_text_antialiasing = false; + + CHostCallbacks c; + c.flush = &flush; + c.make_current = &make_current; + c.on_load_started = &on_load_started; + c.on_load_ended = &on_load_ended; + c.on_title_changed = &on_title_changed; + c.on_url_changed = &on_url_changed; + c.on_history_changed = &on_history_changed; + c.on_animating_changed = &on_animating_changed; + c.on_shutdown_complete = &on_shutdown_complete; + + init_with_egl(o, &wakeup, c); +} + +Servo::~Servo() { + deinit(); +} + +void Servo::PerformUpdates() { + perform_updates(); +} + +void Servo::SetSize(GLsizei width, GLsizei height) { + if (width != mWindowWidth || height != mWindowHeight) { + mWindowWidth = width; + mWindowHeight = height; + resize(mWindowWidth, mWindowHeight); + } +} diff --git a/support/hololens/Servo.h b/support/hololens/Servo.h new file mode 100644 index 000000000000..6d542ef44002 --- /dev/null +++ b/support/hololens/Servo.h @@ -0,0 +1,27 @@ +#pragma once + +#include "pch.h" + +namespace hlservo { +class Servo { +public: + Servo(GLsizei width, GLsizei height); + ~Servo(); + void PerformUpdates(); + void SetSize(GLsizei width, GLsizei height); + + // Static lambas called by Servo callbacks. + + // Will be called from any thead + static std::function sWakeUp; + // Will be called from GL thread + static std::function sFlush; + static std::function sMakeCurrent; + static bool sAnimating; + +private: + GLsizei mWindowWidth; + GLsizei mWindowHeight; + bool mAnimating; +}; +} diff --git a/support/hololens/ServoApp.sln b/support/hololens/ServoApp.sln new file mode 100644 index 000000000000..debacc49e24f --- /dev/null +++ b/support/hololens/ServoApp.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28803.352 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServoApp", "ServoApp.vcxproj", "{7134432A-49F2-4DC7-8F72-06F873A683EC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Debug|ARM.ActiveCfg = Debug|ARM + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Debug|ARM.Build.0 = Debug|ARM + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Debug|ARM.Deploy.0 = Debug|ARM + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Debug|x64.ActiveCfg = Debug|x64 + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Debug|x64.Build.0 = Debug|x64 + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Debug|x64.Deploy.0 = Debug|x64 + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Debug|x86.ActiveCfg = Debug|Win32 + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Debug|x86.Build.0 = Debug|Win32 + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Debug|x86.Deploy.0 = Debug|Win32 + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Release|ARM.ActiveCfg = Release|ARM + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Release|ARM.Build.0 = Release|ARM + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Release|ARM.Deploy.0 = Release|ARM + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Release|x64.ActiveCfg = Release|x64 + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Release|x64.Build.0 = Release|x64 + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Release|x64.Deploy.0 = Release|x64 + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Release|x86.ActiveCfg = Release|Win32 + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Release|x86.Build.0 = Release|Win32 + {7134432A-49F2-4DC7-8F72-06F873A683EC}.Release|x86.Deploy.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {58EFB63D-FFA2-4263-AE6A-6764E4E04CCA} + EndGlobalSection +EndGlobal diff --git a/support/hololens/ServoApp.vcxproj b/support/hololens/ServoApp.vcxproj new file mode 100644 index 000000000000..d2817606f3d4 --- /dev/null +++ b/support/hololens/ServoApp.vcxproj @@ -0,0 +1,446 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM + + + Release + ARM + + + + {7134432a-49f2-4dc7-8f72-06f873a683ec} + hlservo + en-US + 14.0 + true + Windows Store + 10.0 + 10.0.17763.0 + 10.0.17763.0 + ServoApp + + + + Application + true + v141 + + + Application + false + true + v142 + + + + + + + + + 14E8C17B8F0E474455725DAA105238215838FEB1 + ServoApp_TemporaryKey.pfx + + + + incore.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm + + + + + mincore.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib + + + + + mincore.lib;simpleservo.dll.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories);$(VCInstallDir)\lib\store\amd64;$(VCInstallDir)\lib\amd64;$(ProjectDir)\..\..\target\debug + + + + + mincore.lib;simpleservo.dll.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories);$(VCInstallDir)\lib\store\amd64;$(VCInstallDir)\lib\amd64;$(ProjectDir)\..\..\target\release + + + + + pch.h + $(IntDir)pch.pch + $(ProjectDir)\..\..\target\debug\;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + _DEBUG;%(PreprocessorDefinitions) + + + + + pch.h + $(IntDir)pch.pch + $(ProjectDir)\..\..\target\release\;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) + /bigobj %(AdditionalOptions) + 4453;28204 + NDEBUG;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + Create + + + + + App.xaml + + + OpenGLESPage.xaml + + + + + App.xaml + + + OpenGLESPage.xaml + + + + + Designer + + + + + Designer + + + Designer + + + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + false + true + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + true + true + false + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/support/hololens/ServoApp.vcxproj.filters b/support/hololens/ServoApp.vcxproj.filters new file mode 100644 index 000000000000..99907fc89fee --- /dev/null +++ b/support/hololens/ServoApp.vcxproj.filters @@ -0,0 +1,251 @@ + + + + + src + + + src + + + src + + + + + + + src + + + src + + + src + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsRelease + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + ServoDLLsDebug + + + + + + {f663883d-5302-4e09-82e3-094b0a4fa9bc} + + + {45140811-c74b-4497-ba07-a7610fe2fef9} + + + {851a4628-484c-4859-bb9b-3153914487f5} + + + {96a56d11-301b-46ec-b081-50010b467ebf} + + + + + src + + + + + src + + + \ No newline at end of file diff --git a/support/hololens/ServoApp_TemporaryKey.pfx b/support/hololens/ServoApp_TemporaryKey.pfx new file mode 100644 index 0000000000000000000000000000000000000000..81aa780ceeb3f36e3a2c1f0c73c93f97bb5225b0 GIT binary patch literal 2512 zcmZWpc{tSD8~@H?7)wkBWuHRKSjJ?TBukb=CZcRvqQ*{$P{M?)(S$^ck@ZRlV~Gr| zEy@TfG?9@tOWB%Y?sT8u@80M4{GRi?=e(cgJ@5JFyjT*v9}I$EN$^A%9Gzg6uq6QE z2IZ6B5l|95ltTw$NnEV|k+>G2B(7NwJO!`goAkI*Ype8G~<3oyUI*T z$H>t8n^~#fi{ftOo}}whe&wFl5@u|MI<$fhQQ{-mrHXXHf^nd zk(1P>-303~kA3OP3KLLp0=baSzUI&)04b2ueKnN*2gwy7c6qF_vsusr0~P8}B#&0K z!!>jtl8Tk$jmCm)-tU$*NcEV;|0jA0(@=r(h-6PFmhEH&cvD{A0r9(5$s?=|K zjY)M3-6hOEvm0_D8GCxaXZLyQjZMGUskIzWw2fkH8h+z8zX}@mksw=AGZlRn72{{* z5r;BtKE_3$F^khrUGMYYm%t#(&^d}?zVY5&3#|>bm~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c@`q+u$sG9w=BYI+-`EZU{@F2%Inv+Y{RcCbNr+| zQMJ^fYkddr>pm_bc-vF#as196x3Gt)w6~y%bPc6Ji34Ee%W7(<!PtaX)Q}sL3_%Aw)Y~P z;K^Ws_g&i7Hbfb=a8qcZ$z5dl7e38QOTQS*wAYym#-55-eov58^#h3c1mdN7-DyIImoMw7*chXZB)?=Cqhv zTkcB3d%2P`U$O`8cC3n&myR&x10DOh^kMbuC(|Y*h87jYJ|eqrC`z(E^O%qpY(zHP zL~_?E)5?vMPv2IrW)R`-&}K^MLZ!%1B(?zbiSs%%~x0^k;)4A6)G4oor*%(2MxgDoW$hPmU zZ?y6I@?Fx3CTl)tZ+zIN@U|(R2?8eR_E_~+<4)W^t=k%9Ha>d#msLnH%Si-DO(YyR}e4Myer3 z^%cARp(%U}n$xWBs|H<#pDv#!ZokMf!EID>@j4T95asGM!ynveU1g>RmN1#9GMh!^ ztZ4hzXL);xQcL{WA?DblSQ#ugj0>{|0v3lN(f%Uz7vCF{^ljqF;p(R`EsM@lP^7MW Z;{F1$@GjaR*@JPOxY-Xa$lJd^+F#` + + + \ No newline at end of file diff --git a/support/hololens/pch.cpp b/support/hololens/pch.cpp new file mode 100644 index 000000000000..bcb5590be1b3 --- /dev/null +++ b/support/hololens/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/support/hololens/pch.h b/support/hololens/pch.h new file mode 100644 index 000000000000..cdd82f4e1919 --- /dev/null +++ b/support/hololens/pch.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include + +#define GL_GLEXT_PROTOTYPES + +#include +#include + +#include +#include +#include + +#include From 6979a23a97682c0cae64d4eafff743e1db027131 Mon Sep 17 00:00:00 2001 From: Paul Rouget Date: Mon, 24 Jun 2019 09:56:09 +0200 Subject: [PATCH 5/7] Hololens documentation --- docs/hololens.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docs/hololens.md diff --git a/docs/hololens.md b/docs/hololens.md new file mode 100644 index 000000000000..d67930e146f4 --- /dev/null +++ b/docs/hololens.md @@ -0,0 +1,20 @@ +## Servo on Hololens. + +How to compile and run: + +With Visual Studio **2019**: +- Open `support/hololens/ServoApp.sln` +- click on *restore nugets packages* under the context menu of "Solution" (in the right panel). This will automatically download Angle which comes with libEGL.dll, necessary to build servo. + +In your Visual Studio **2017** cmd prompt: +- make sure libEGL.dll is in your `%LIB%` path: `set LIB=%LIB%;c:\XXX\servo\support\hololens\packages\ANGLE.WindowsStore.2.1.13\bin\UAP\x64\` +- compile servo: `mach build -d --libsimpleservo --features raqote_backend no_wgl` + +With Visual Studio **2019**: +- Select emulator or local machine, select configuration (Debug or Release) and press run +- VS will look for the DLLs and .h in `../../target/debug|release/` (depending on the configuration you selected in VS) and copy them in the final package. + +For now, it's not possible to interact with the web page. + +Note: to build the project with MSBuild: +- `MSBuild ServoApp.sln /p:Configuration=Debug /p:Platform=x64` From bc89fedaf135887e749a9518da14099631233929 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Fri, 28 Jun 2019 16:29:15 -0400 Subject: [PATCH 6/7] Fix EGL linking. --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 865fd974388d..3e2e53ff7490 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -403,7 +403,7 @@ dependencies = [ "ipc-channel 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.22.2 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)", "pixels 0.0.1", "raqote 0.4.1-alpha.0 (git+https://github.com/jrmuizel/raqote)", "serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3092,7 +3092,7 @@ dependencies = [ [[package]] name = "offscreen_gl_context" -version = "0.22.2" +version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5789,7 +5789,7 @@ dependencies = [ "checksum objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "31d20fd2b37e07cf5125be68357b588672e8cefe9a96f8c17a9d46053b3e590d" "checksum objc-foundation 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" "checksum objc_id 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e4730aa1c64d722db45f7ccc4113a3e2c465d018de6db4d3e7dfe031e8c8a297" -"checksum offscreen_gl_context 0.22.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ac6904d3015b214944273ac55f9619a3c2884ce21108007fc6595db2b537886f" +"checksum offscreen_gl_context 0.22.3 (registry+https://github.com/rust-lang/crates.io-index)" = "070391b55c4d07b1550f1f2b6464e07ac6a1f9962c71b5097baa5882d644a693" "checksum opaque-debug 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "51ecbcb821e1bd256d456fe858aaa7f380b63863eab2eb86eee1bd9f33dd6682" "checksum openssl 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)" = "6c24d3508b4fb6da175c10baac54c578b33f09c89ae90c6fe9788b3b4768efdc" "checksum openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)" = "912f301a749394e1025d9dcddef6106ddee9252620e6d0a0e5f8d0681de9b129" From 51405479bc3d9da5214b077d4ea337e37d74b2aa Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Fri, 28 Jun 2019 16:48:26 -0400 Subject: [PATCH 7/7] Simplify build process for UWP app. --- components/servo/Cargo.toml | 3 ++- ports/glutin/Cargo.toml | 1 + ports/libmlservo/Cargo.toml | 1 + ports/libsimpleservo/api/Cargo.toml | 1 + ports/libsimpleservo/capi/Cargo.toml | 1 + ports/libsimpleservo/jniapi/Cargo.toml | 1 + python/servo/build_commands.py | 29 +++++++++++++++++++++++--- 7 files changed, 33 insertions(+), 4 deletions(-) diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index 0b959ad2ef18..d990bdf116dc 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -14,6 +14,7 @@ crate-type = ["rlib"] [features] azure_backend = ["canvas/azure_backend"] debugmozjs = ["script/debugmozjs"] +egl = ["mozangle/egl"] energy-profiling = ["profile_traits/energy-profiling"] profilemozjs = ["script/profilemozjs"] googlevr = ["webvr/googlevr"] @@ -89,4 +90,4 @@ git = "https://github.com/servo/media" git = "https://github.com/servo/media" [target.'cfg(target_os = "windows")'.dependencies] -mozangle = { version = "0.2", features = ["egl"] } +mozangle = {version = "0.2"} diff --git a/ports/glutin/Cargo.toml b/ports/glutin/Cargo.toml index 2a6f1302d22c..22ec1330f86c 100644 --- a/ports/glutin/Cargo.toml +++ b/ports/glutin/Cargo.toml @@ -30,6 +30,7 @@ ProductName = "Servo" azure_backend = ["libservo/azure_backend"] default = ["unstable", "default-except-unstable"] default-except-unstable = ["webdriver", "max_log_level"] +egl = ["libservo/egl"] energy-profiling = ["libservo/energy-profiling"] debugmozjs = ["libservo/debugmozjs"] js_backtrace = ["libservo/js_backtrace"] diff --git a/ports/libmlservo/Cargo.toml b/ports/libmlservo/Cargo.toml index f2b92ed63495..15d47878053c 100644 --- a/ports/libmlservo/Cargo.toml +++ b/ports/libmlservo/Cargo.toml @@ -14,6 +14,7 @@ bench = false [features] azure_backend = ["simpleservo/azure_backend"] +egl = ["simpleservo/egl"] raqote_backend = ["simpleservo/raqote_backend"] [dependencies] diff --git a/ports/libsimpleservo/api/Cargo.toml b/ports/libsimpleservo/api/Cargo.toml index 8e1726a8b025..2ce457196cb0 100644 --- a/ports/libsimpleservo/api/Cargo.toml +++ b/ports/libsimpleservo/api/Cargo.toml @@ -30,6 +30,7 @@ azure_backend = ["libservo/azure_backend"] default = ["unstable", "default-except-unstable"] default-except-unstable = ["webdriver", "max_log_level"] debugmozjs = ["libservo/debugmozjs"] +egl = ["libservo/egl"] energy-profiling = ["libservo/energy-profiling"] googlevr = ["libservo/googlevr"] js_backtrace = ["libservo/js_backtrace"] diff --git a/ports/libsimpleservo/capi/Cargo.toml b/ports/libsimpleservo/capi/Cargo.toml index 1ca469d82c05..8a4c1aa5f1df 100644 --- a/ports/libsimpleservo/capi/Cargo.toml +++ b/ports/libsimpleservo/capi/Cargo.toml @@ -25,6 +25,7 @@ azure_backend = ["simpleservo/azure_backend"] debugmozjs = ["simpleservo/debugmozjs"] default = ["unstable", "default-except-unstable"] default-except-unstable = ["webdriver", "max_log_level"] +egl = ["simpleservo/egl"] energy-profiling = ["simpleservo/energy-profiling"] googlevr = ["simpleservo/googlevr"] js_backtrace = ["simpleservo/js_backtrace"] diff --git a/ports/libsimpleservo/jniapi/Cargo.toml b/ports/libsimpleservo/jniapi/Cargo.toml index 95a841770a0c..b571302286ce 100644 --- a/ports/libsimpleservo/jniapi/Cargo.toml +++ b/ports/libsimpleservo/jniapi/Cargo.toml @@ -30,6 +30,7 @@ azure_backend = ["simpleservo/azure_backend"] debugmozjs = ["simpleservo/debugmozjs"] default = ["unstable", "default-except-unstable"] default-except-unstable = ["webdriver", "max_log_level"] +egl = ["simpleservo/egl"] energy-profiling = ["simpleservo/energy-profiling"] googlevr = ["simpleservo/googlevr"] js_backtrace = ["simpleservo/js_backtrace"] diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index 582da195356d..98068a0ba2d1 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -30,7 +30,7 @@ from mach.registrar import Registrar from mach_bootstrap import _get_exec_path -from servo.command_base import CommandBase, cd, call, check_call, BIN_SUFFIX +from servo.command_base import CommandBase, cd, call, check_call, BIN_SUFFIX, append_to_path_env from servo.util import host_triple @@ -193,6 +193,7 @@ class MachCommands(CommandBase): default=None, action='store_true', help='Build the libsimpleservo library instead of the servo executable') + @CommandArgument('--uwp', default=None, action='store_true') @CommandArgument('--with-frame-pointer', default=None, action='store_true', @@ -202,7 +203,7 @@ class MachCommands(CommandBase): def build(self, target=None, release=False, dev=False, jobs=None, features=None, android=None, magicleap=None, no_package=False, verbose=False, very_verbose=False, debug_mozjs=False, params=None, with_debug_assertions=False, - libsimpleservo=False, with_frame_pointer=False, with_raqote=False, without_wgl=False): + libsimpleservo=False, uwp=False, with_frame_pointer=False, with_raqote=False, without_wgl=False): opts = params or [] @@ -284,6 +285,27 @@ def build(self, target=None, release=False, dev=False, jobs=None, self.ensure_bootstrapped(target=target) self.ensure_clobbered() + if uwp: + # Ensure that azure/skia is disabled. + with_raqote = True + # The WGL libraries aren't available to UWP apps. + without_wgl = True + # Don't try and build a desktop port. + libsimpleservo = True + # Ensure that the NuGet ANGLE package containing libEGL is accessible + # to the Rust linker. + append_to_path_env( + path.join( + os.getcwd(), "support", "hololens", "packages", + "ANGLE.WindowsStore.2.1.13", "bin", "UAP", "x64" + ), + env, + "LIB" + ) + else: + # Non-UWP builds provide their own libEGL via mozangle. + features += ["egl"] + self.add_manifest_path(opts, android, libsimpleservo) if debug_mozjs: @@ -661,7 +683,8 @@ def package_generated_shared_libraries(libs, build_path, servo_exe_dir): for lib in libs: print("WARNING: could not find " + lib) - package_generated_shared_libraries(["libEGL.dll"], build_path, servo_exe_dir) + if not uwp: + package_generated_shared_libraries(["libEGL.dll"], build_path, servo_exe_dir) # copy needed gstreamer DLLs in to servo.exe dir target_triple = target or host_triple()