mirror of
https://github.com/servo/servo.git
synced 2025-06-12 10:24:43 +00:00
Auto merge of #22856 - jdm:angle, r=paulrouget
Add optional ANGLE support to glutin port Supporting ANGLE in Servo has two important benefits: * we can actually run Servo instances on our Windows CI machines, which gives us more confidence that we're not breaking it * we can continue to use OpenGL on devices like the Hololens, rather than creating platform-specific graphical backends <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22856) <!-- Reviewable:end -->
This commit is contained in:
commit
b1b47d8046
9 changed files with 63 additions and 25 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -2793,10 +2793,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
|
||||
[[package]]
|
||||
name = "mozangle"
|
||||
version = "0.1.7"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -3591,7 +3592,7 @@ dependencies = [
|
|||
"mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozangle 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozjs 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
|
@ -3812,6 +3813,7 @@ dependencies = [
|
|||
"libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libservo 0.0.1",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mozangle 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"osmesa-src 0.1.0 (git+https://github.com/servo/osmesa-src)",
|
||||
"osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rust-webvr 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -5590,7 +5592,7 @@ dependencies = [
|
|||
"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125"
|
||||
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
|
||||
"checksum mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9de3eca27871df31c33b807f834b94ef7d000956f57aa25c5aed9c5f0aae8f6f"
|
||||
"checksum mozangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "45a8a18a41cfab0fde25cc2f43ea89064d211a0fbb33225b8ff93ab20406e0e7"
|
||||
"checksum mozangle 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9ba1ce5212fd56a71cfbc463aedd4ece76090d98b96d5122f84dedffa0cc508"
|
||||
"checksum mozjs 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "622108d35f4fdd68b3aa39bfe9bedaee5fa9efd19711d046e1d56ff607c0a36f"
|
||||
"checksum mozjs_sys 0.61.13 (registry+https://github.com/rust-lang/crates.io-index)" = "c7d35502544cf3e70b305e028c6ca9e4c3d5a48264af220f8341598f54d189ba"
|
||||
"checksum msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aad9dfe950c057b1bfe9c1f2aa51583a8468ef2a5baba2ebbe06d775efeb7729"
|
||||
|
|
|
@ -76,6 +76,10 @@ pub struct Opts {
|
|||
pub load_webfonts_synchronously: bool,
|
||||
|
||||
pub headless: bool,
|
||||
|
||||
/// Use ANGLE to create the GL context (Windows-only).
|
||||
pub angle: bool,
|
||||
|
||||
pub hard_fail: bool,
|
||||
|
||||
/// True if we should bubble intrinsic widths sequentially (`-b`). If this is true, then
|
||||
|
@ -558,6 +562,7 @@ pub fn default_opts() -> Opts {
|
|||
gc_profile: false,
|
||||
load_webfonts_synchronously: false,
|
||||
headless: false,
|
||||
angle: false,
|
||||
hard_fail: true,
|
||||
bubble_inline_sizes_separately: false,
|
||||
show_debug_fragment_borders: false,
|
||||
|
@ -666,6 +671,11 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
|
|||
"",
|
||||
);
|
||||
opts.optflag("z", "headless", "Headless mode");
|
||||
opts.optflag(
|
||||
"",
|
||||
"angle",
|
||||
"Use ANGLE to create a GL context (Windows-only)",
|
||||
);
|
||||
opts.optflag(
|
||||
"f",
|
||||
"hard-fail",
|
||||
|
@ -998,6 +1008,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
|
|||
gc_profile: debug_options.gc_profile,
|
||||
load_webfonts_synchronously: debug_options.load_webfonts_synchronously,
|
||||
headless: opt_match.opt_present("z"),
|
||||
angle: opt_match.opt_present("angle"),
|
||||
hard_fail: opt_match.opt_present("f") && !opt_match.opt_present("F"),
|
||||
bubble_inline_sizes_separately: bubble_inline_sizes_separately,
|
||||
profile_script_events: debug_options.profile_script_events,
|
||||
|
|
|
@ -115,4 +115,4 @@ webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
|||
webvr_traits = {path = "../webvr_traits"}
|
||||
|
||||
[target.'cfg(not(target_os = "ios"))'.dependencies]
|
||||
mozangle = "0.1"
|
||||
mozangle = "0.2"
|
||||
|
|
|
@ -66,6 +66,7 @@ sig = "1.0"
|
|||
x11 = "2.0.0"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
mozangle = { version = "0.2", features = ["egl"] }
|
||||
winapi = { version = "0.3", features = ["wingdi", "winuser"] }
|
||||
|
||||
[target.'cfg(any(target_os = "macos", all(target_arch = "x86_64", target_os = "linux")))'.dependencies]
|
||||
|
|
|
@ -184,12 +184,13 @@ fn get_default_url() -> ServoUrl {
|
|||
cmdline_url.or(pref_url).or(blank_url).unwrap()
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
|
||||
pub fn gl_version() -> glutin::GlRequest {
|
||||
glutin::GlRequest::Specific(glutin::Api::OpenGl, (3, 2))
|
||||
}
|
||||
|
||||
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
|
||||
pub fn gl_version() -> glutin::GlRequest {
|
||||
if opts::get().angle {
|
||||
glutin::GlRequest::Specific(glutin::Api::OpenGlEs, (3, 0))
|
||||
} else {
|
||||
glutin::GlRequest::GlThenGles {
|
||||
opengl_version: (3, 2),
|
||||
opengles_version: (3, 0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ use glutin::dpi::{LogicalPosition, LogicalSize, PhysicalSize};
|
|||
use glutin::os::macos::{ActivationPolicy, WindowBuilderExt};
|
||||
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
||||
use glutin::Icon;
|
||||
use glutin::{ContextBuilder, GlContext, GlWindow};
|
||||
use glutin::{Api, ContextBuilder, GlContext, GlWindow};
|
||||
use glutin::{ElementState, KeyboardInput, MouseButton, MouseScrollDelta, TouchPhase};
|
||||
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
||||
use image;
|
||||
|
@ -145,13 +145,14 @@ impl Window {
|
|||
|
||||
glutin_window.show();
|
||||
|
||||
let gl = match gl::GlType::default() {
|
||||
gl::GlType::Gl => unsafe {
|
||||
let gl = match glutin_window.context().get_api() {
|
||||
Api::OpenGl => unsafe {
|
||||
gl::GlFns::load_with(|s| glutin_window.get_proc_address(s) as *const _)
|
||||
},
|
||||
gl::GlType::Gles => unsafe {
|
||||
Api::OpenGlEs => unsafe {
|
||||
gl::GlesFns::load_with(|s| glutin_window.get_proc_address(s) as *const _)
|
||||
},
|
||||
Api::WebGl => unreachable!("webgl is unsupported"),
|
||||
};
|
||||
|
||||
gl.clear_color(0.6, 0.6, 0.6, 1.0);
|
||||
|
|
|
@ -625,16 +625,23 @@ class MachCommands(CommandBase):
|
|||
servo_exe_dir)
|
||||
# Search for the generated nspr4.dll
|
||||
build_path = path.join(servo_exe_dir, "build")
|
||||
nspr4 = "nspr4.dll"
|
||||
nspr4_path = None
|
||||
|
||||
def package_generated_shared_libraries(libs, build_path, servo_exe_dir):
|
||||
for root, dirs, files in os.walk(build_path):
|
||||
if nspr4 in files:
|
||||
nspr4_path = path.join(root, nspr4)
|
||||
break
|
||||
if nspr4_path is None:
|
||||
print("WARNING: could not find nspr4.dll")
|
||||
else:
|
||||
shutil.copy(nspr4_path, servo_exe_dir)
|
||||
remaining_libs = list(libs)
|
||||
for lib in libs:
|
||||
if lib in files:
|
||||
shutil.copy(path.join(root, lib), servo_exe_dir)
|
||||
remaining_libs.remove(lib)
|
||||
continue
|
||||
libs = remaining_libs
|
||||
if not libs:
|
||||
return
|
||||
for lib in libs:
|
||||
print("WARNING: could not find " + lib)
|
||||
|
||||
package_generated_shared_libraries(["nspr4.dll", "libEGL.dll"], build_path, servo_exe_dir)
|
||||
|
||||
# copy needed gstreamer DLLs in to servo.exe dir
|
||||
gst_x64 = "X86_64" if msvc_x64 == "64" else "X86"
|
||||
gst_root = ""
|
||||
|
|
|
@ -971,3 +971,13 @@ testing/web-platform/mozilla/tests for Servo-only tests""" % reference_path)
|
|||
run_globals = {"__file__": run_file}
|
||||
execfile(run_file, run_globals)
|
||||
return run_globals["update_conformance"](version, dest_folder, None, patches_dir)
|
||||
|
||||
@Command('smoketest',
|
||||
description='Load a simple page in Servo and ensure that it closes properly',
|
||||
category='testing')
|
||||
@CommandArgument('params', nargs='...',
|
||||
help="Command-line arguments to be passed through to Servo")
|
||||
def smoketest(self, params):
|
||||
params = params + ['tests/html/close-on-load.html']
|
||||
return self.context.commands.dispatch(
|
||||
'run', self.context, params=params)
|
||||
|
|
5
tests/html/close-on-load.html
Normal file
5
tests/html/close-on-load.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<script>
|
||||
window.onload = function() {
|
||||
window.close();
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue