aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock24
-rw-r--r--components/config/opts.rs11
-rw-r--r--ports/glutin/Cargo.toml1
-rw-r--r--ports/glutin/app.rs15
-rw-r--r--ports/glutin/headed_window.rs9
5 files changed, 49 insertions, 11 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 273ce391788..7158407e200 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1493,6 +1493,16 @@ dependencies = [
[[package]]
name = "gl_generator"
+version = "0.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "xml-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
+name = "gl_generator"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
@@ -2236,6 +2246,11 @@ dependencies = [
[[package]]
name = "khronos_api"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "khronos_api"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3809,6 +3824,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.1.7 (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.10.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -5322,6 +5338,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "xml-rs"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
+name = "xml-rs"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -5488,6 +5509,7 @@ dependencies = [
"checksum getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "b900c08c1939860ce8b54dc6a89e26e00c04c380fd0e09796799bd7f12861e05"
"checksum gif 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff3414b424657317e708489d2857d9575f4403698428b040b609b9d1c1a84a2c"
"checksum gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0ffaf173cf76c73a73e080366bf556b4776ece104b06961766ff11449f38604"
+"checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a"
"checksum gleam 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d7591624fbbc384a8195791facbd16a5b118d5d2240c508de518b7ccc771fe"
"checksum glib 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e8fdc159c196a5dfa53a92929ac4c10c8a6637ffb43951f3fff89c2cd2365"
"checksum glib-sys 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5bda542f3caee39a027638e9644ff89204101ad916fd7370b585ad2c5fc97e61"
@@ -5550,6 +5572,7 @@ dependencies = [
"checksum jpeg-decoder 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0dfe27a6c0dabd772d0f9b9f8701c4ca12c4d1eebcadf2be1f6f70396f6a1434"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum keyboard-types 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "53b536dc22c0dabb295e85dbd0c062023885b12b8db24e1d86833f4e50ea7959"
+"checksum khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "037ab472c33f67b5fbd3e9163a2645319e5356fcd355efa6d4eb7fff4bbcb554"
"checksum khronos_api 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "62237e6d326bd5871cd21469323bf096de81f1618cd82cbaf5d87825335aeb49"
"checksum lalrpop 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2e80bee40b22bca46665b4ef1f3cd88ed0fb043c971407eac17a0712c02572"
"checksum lalrpop-util 0.16.3 (registry+https://github.com/rust-lang/crates.io-index)" = "33b27d8490dbe1f9704b0088d61e8d46edc10d5673a8829836c6ded26a9912c7"
@@ -5784,6 +5807,7 @@ dependencies = [
"checksum xcb 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5e917a3f24142e9ff8be2414e36c649d47d6cc2ba81f16201cdef96e533e02de"
"checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61"
"checksum xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12ea8eda4b1eb72f02d148402e23832d56a33f55d8c1b2d5bcdde91d79d47cb1"
+"checksum xml-rs 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3646aef67e75922d0e77af92599ed8499c0a60f043708821f5c3c940e88f67f3"
"checksum xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "541b12c998c5b56aa2b4e6f18f03664eef9a4fd0a246a55594efae6cc2d964b5"
"checksum xml5ever 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "32cd7ebf0203c620906230ce22caa5df0b603c32b6fef72a275a48f6a2ae64b9"
"checksum zip 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "77ce0ceee93c995954a31f77903925a6a8bb094709445238e344f2107910e29e"
diff --git a/components/config/opts.rs b/components/config/opts.rs
index 8a8a58aeb03..f5ff22070e5 100644
--- a/components/config/opts.rs
+++ b/components/config/opts.rs
@@ -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,
@@ -667,6 +672,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",
"Exit on thread failure instead of displaying about:failure",
@@ -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,
diff --git a/ports/glutin/Cargo.toml b/ports/glutin/Cargo.toml
index 4edbef5fd85..59267396157 100644
--- a/ports/glutin/Cargo.toml
+++ b/ports/glutin/Cargo.toml
@@ -66,6 +66,7 @@ sig = "1.0"
x11 = "2.0.0"
[target.'cfg(target_os = "windows")'.dependencies]
+mozangle = { version = "0.1", features = ["egl"] }
winapi = { version = "0.3", features = ["wingdi", "winuser"] }
[target.'cfg(any(target_os = "macos", all(target_arch = "x86_64", target_os = "linux")))'.dependencies]
diff --git a/ports/glutin/app.rs b/ports/glutin/app.rs
index 59d37fcd246..ac219003988 100644
--- a/ports/glutin/app.rs
+++ b/ports/glutin/app.rs
@@ -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 {
- glutin::GlRequest::Specific(glutin::Api::OpenGlEs, (3, 0))
+ if opts::get().angle {
+ glutin::GlRequest::Specific(glutin::Api::OpenGlEs, (3, 0))
+ } else {
+ glutin::GlRequest::GlThenGles {
+ opengl_version: (3, 2),
+ opengles_version: (3, 0),
+ }
+ }
}
diff --git a/ports/glutin/headed_window.rs b/ports/glutin/headed_window.rs
index 754cccf175b..f1825f50f9e 100644
--- a/ports/glutin/headed_window.rs
+++ b/ports/glutin/headed_window.rs
@@ -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);