diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-09-12 16:08:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-12 16:08:58 -0400 |
commit | 89d0b0233a230274c93cfc514525e29e2d691a7e (patch) | |
tree | 929eb2536b134cd718c5e447b52bbb95688f2f35 | |
parent | 2ff34e5e21579f4ef64c052b0202eaa3ca9f5040 (diff) | |
parent | 1cefae71817924e375626802c5e639fe80f66c66 (diff) | |
download | servo-89d0b0233a230274c93cfc514525e29e2d691a7e.tar.gz servo-89d0b0233a230274c93cfc514525e29e2d691a7e.zip |
Auto merge of #24176 - jdm:no-gleam, r=asajeffrey
Replace use of gleam in webgl with sparkle.
Rely on https://github.com/servo/sparkle for the GL bindings required to implement Servo's WebGL stack. This does not touch the GL usage in the compositor or webrender, which continue to rely on https://github.com/servo/gleam. This means that any breaking changes to the public GL bindings interface (such as required by https://github.com/servo/servo/pull/24111) only require updating rust-offscreen-rendering-context and rust-webvr, rather than many other crates that are out of our direct control.
---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] There are tests for these changes
<!-- 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/24176)
<!-- Reviewable:end -->
-rw-r--r-- | Cargo.lock | 72 | ||||
-rw-r--r-- | components/canvas/Cargo.toml | 3 | ||||
-rw-r--r-- | components/canvas/gl_context.rs | 8 | ||||
-rw-r--r-- | components/canvas/webgl_thread.rs | 45 | ||||
-rw-r--r-- | components/canvas_traits/Cargo.toml | 2 | ||||
-rw-r--r-- | components/canvas_traits/webgl.rs | 10 | ||||
-rw-r--r-- | components/script/Cargo.toml | 2 | ||||
-rw-r--r-- | components/script/dom/webgl_extensions/extensions.rs | 2 | ||||
-rw-r--r-- | components/servo/Cargo.toml | 3 | ||||
-rw-r--r-- | components/servo/lib.rs | 6 | ||||
-rw-r--r-- | components/webvr/Cargo.toml | 5 | ||||
-rw-r--r-- | components/webvr/webvr_thread.rs | 9 | ||||
-rw-r--r-- | components/webvr_traits/Cargo.toml | 2 | ||||
-rw-r--r-- | ports/glutin/Cargo.toml | 2 | ||||
-rw-r--r-- | ports/libmlservo/Cargo.toml | 2 | ||||
-rw-r--r-- | servo-tidy.toml | 2 |
16 files changed, 103 insertions, 72 deletions
diff --git a/Cargo.lock b/Cargo.lock index 3613c69daa6..04dd118aad6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -403,11 +403,12 @@ dependencies = [ "ipc-channel 0.12.0 (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.23.0 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)", "pixels 0.0.1", "raqote 0.6.2-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", + "sparkle 0.1.3 (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_traits 0.0.1", @@ -420,7 +421,6 @@ version = "0.0.1" dependencies = [ "cssparser 0.25.8 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", @@ -429,6 +429,7 @@ dependencies = [ "serde 1.0.88 (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", + "sparkle 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "typetag 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", "webvr_traits 0.0.1", @@ -496,6 +497,15 @@ dependencies = [ ] [[package]] +name = "cgl" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gleam 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "chrono" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1477,6 +1487,14 @@ dependencies = [ ] [[package]] +name = "gleam" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "glib" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2518,7 +2536,7 @@ dependencies = [ "libc 0.2.62 (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)", - "rust-webvr 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-webvr 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "simpleservo 0.0.1", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2557,7 +2575,7 @@ dependencies = [ "msg 0.0.1", "net 0.0.1", "net_traits 0.0.1", - "offscreen_gl_context 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)", "profile 0.0.1", "profile_traits 0.0.1", "script 0.0.1", @@ -2569,6 +2587,7 @@ dependencies = [ "servo_config 0.0.1", "servo_geometry 0.0.1", "servo_url 0.0.1", + "sparkle 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "style 0.0.1", "style_traits 0.0.1", "webdriver_server 0.0.1", @@ -3183,20 +3202,20 @@ dependencies = [ [[package]] name = "offscreen_gl_context" -version = "0.23.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cgl 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", + "sparkle 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "x11 2.17.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3785,7 +3804,7 @@ dependencies = [ [[package]] name = "rust-webvr" -version = "0.14.2" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bindgen 0.49.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3798,19 +3817,20 @@ dependencies = [ "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "ovr-mobile-sys 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-webvr-api 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-webvr-api 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sparkle 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rust-webvr-api" -version = "0.14.1" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "android_injected_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", + "sparkle 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)", ] @@ -3887,7 +3907,6 @@ dependencies = [ "enum-iterator 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "headers 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3940,6 +3959,7 @@ dependencies = [ "servo_rand 0.0.1", "servo_url 0.0.1", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", + "sparkle 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "style 0.0.1", "style_traits 0.0.1", "swapper 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4151,7 +4171,7 @@ dependencies = [ "log 0.4.6 (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.14.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-webvr 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "servo-media 0.1.0 (git+https://github.com/servo/media)", "sig 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "tinyfiledialogs 3.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4617,6 +4637,14 @@ dependencies = [ ] [[package]] +name = "sparkle" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "stable_deref_trait" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -5593,10 +5621,11 @@ dependencies = [ "ipc-channel 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", - "rust-webvr 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-webvr-api 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-webvr 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-webvr-api 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "script_traits 0.0.1", "servo_config 0.0.1", + "sparkle 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "webvr_traits 0.0.1", ] @@ -5606,7 +5635,7 @@ version = "0.0.1" dependencies = [ "ipc-channel 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", - "rust-webvr-api 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-webvr-api 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -5885,6 +5914,7 @@ dependencies = [ "checksum cexpr 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8fc0086be9ca82f7fc89fc873435531cb898b86e850005850de1f820e2db6e9b" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" "checksum cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "55e7ec0b74fe5897894cbc207092c577e87c52f8a59e8ca8d97ef37551f60a49" +"checksum cgl 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e24cd014051545194d6e879b37d33eed1fcf4bf41e1f54644530c63d8cb912f5" "checksum chrono 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1cce36c92cb605414e9b824f866f5babe0a0368e39ea07393b9b63cf3844c0e6" "checksum clang-sys 0.28.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4227269cec09f5f83ff160be12a1e9b0262dd1aa305302d5ba296c2ebd291055" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" @@ -5967,6 +5997,7 @@ dependencies = [ "checksum gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "39a23d5e872a275135d66895d954269cf5e8661d234eb1c2480f4ce0d586acbd" "checksum gl_generator 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ca98bbde17256e02d17336a6bdb5a50f7d0ccacee502e191d3e3d0ec2f96f84a" "checksum gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)" = "c8a455b5a3ccd35daeb89fdb8a89ebb0a1fe23c05c7a7f9017840bc3ae176f71" +"checksum gleam 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ea4f9ba7411ae3f00516401fb811b4f4f37f5c926357f2a033d27f96b74c849" "checksum glib 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d70d737019da0473a7cd6d9240571cf58c6897dcb10edf32b90774f4ba237c1b" "checksum glib-sys 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b86a9169fbc9cf9a0ef315039c2304b09d5c575c5fde7defba3576a0311b863" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" @@ -6091,7 +6122,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.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b6b1df447af7a71721bfc33697b364831d59c0c8668dae0e570a7993ca84bc8" +"checksum offscreen_gl_context 0.25.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3a6c4bb6b3da8b14a280a742ef6b73046b4ad84799e68ebff2fd935e8185edf" "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" @@ -6153,8 +6184,8 @@ dependencies = [ "checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" "checksum rle-decode-fast 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cabe4fa914dec5870285fa7f71f602645da47c486e68486d2b4ceb4a343e90ac" "checksum ron 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "da06feaa07f69125ab9ddc769b11de29090122170b402547f64b86fe16ebc399" -"checksum rust-webvr 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6dd23c0de4e3a5dbe92d4e629e324e1e068cb92d69361a1a02a671bdadc8276" -"checksum rust-webvr-api 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f9bf4e36b6f3a3a7c3f5adae7baef2e115d65e1dfb5028e75158df624dbf939a" +"checksum rust-webvr 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd1dd1e92425c5264b452f8bba67cdc11b3a2a4901a36892883d087b5689aa58" +"checksum rust-webvr-api 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f862b3325fac0dc55d4b9edc0f740e647e833534718b5d55472581f810e6b9e9" "checksum rustc-demangle 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3058a43ada2c2d0b92b3ae38007a2d0fa5e9db971be260e0171408a4ff471c95" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum rusttype 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b8eb11f5b0a98c8eca2fb1483f42646d8c340e83e46ab416f8a063a0fd0eeb20" @@ -6197,6 +6228,7 @@ dependencies = [ "checksum smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b73ea3738b47563803ef814925e69be00799a8c07420be8b996f8e98fb2336db" "checksum smithay-client-toolkit 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2ccb8c57049b2a34d2cc2b203fa785020ba0129d31920ef0d317430adaf748fa" "checksum socket2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ff606e0486e88f5fc6cfeb3966e434fb409abbc7a3ab495238f70a1ca97f789d" +"checksum sparkle 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1e884e45eaf4690757766eb966b40309cd417a174b30d897e45d8e717875c7d" "checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b" "checksum stb_truetype 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "48fa7d3136d8645909de1f7c7eb5416cc43057a75ace08fc39ae736bc9da8af1" "checksum string 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d" diff --git a/components/canvas/Cargo.toml b/components/canvas/Cargo.toml index 53826ccc8d9..8405e18d245 100644 --- a/components/canvas/Cargo.toml +++ b/components/canvas/Cargo.toml @@ -29,11 +29,12 @@ half = "1" ipc-channel = "0.12" log = "0.4" num-traits = "0.2" -offscreen_gl_context = {version = "0.23", features = ["serde", "osmesa"]} +offscreen_gl_context = {version = "0.25", features = ["serde", "osmesa"]} raqote = {git = "https://github.com/jrmuizel/raqote", optional = true} pixels = {path = "../pixels"} serde_bytes = "0.10" servo_config = {path = "../config"} +sparkle = "0.1" webrender = {git = "https://github.com/servo/webrender"} webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]} webrender_traits = {path = "../webrender_traits"} diff --git a/components/canvas/gl_context.rs b/components/canvas/gl_context.rs index e1e45f40a60..b8168753fa4 100644 --- a/components/canvas/gl_context.rs +++ b/components/canvas/gl_context.rs @@ -7,7 +7,6 @@ use canvas_traits::webgl::{ GLContextAttributes, GLLimits, WebGLCommand, WebGLCommandBacktrace, WebGLVersion, }; use euclid::default::Size2D; -use gleam::gl; use offscreen_gl_context::{ ColorAttachmentType, DrawBuffer, GLContext, GLContextAttributes as RawGLContextAttributes, GLContextDispatcher, @@ -15,6 +14,7 @@ use offscreen_gl_context::{ use offscreen_gl_context::{GLLimits as RawGLLimits, GLVersion}; use offscreen_gl_context::{NativeGLContext, NativeGLContextHandle, NativeGLContextMethods}; use offscreen_gl_context::{OSMesaContext, OSMesaContextHandle}; +use sparkle::gl; pub trait CloneableDispatcher: GLContextDispatcher { fn clone(&self) -> Box<dyn GLContextDispatcher>; @@ -84,7 +84,7 @@ impl GLContextFactory { size.to_i32(), attributes, ColorAttachmentType::Texture, - gl::GlType::default(), + gl::GlType::Gl, Self::gl_version(webgl_version), Some(handle), None, @@ -120,7 +120,7 @@ impl GLContextFactory { size.to_i32(), attributes, ColorAttachmentType::Texture, - gl::GlType::default(), + gl::GlType::Gl, Self::gl_version(webgl_version), None, None, @@ -171,7 +171,7 @@ impl GLContextWrapper { } } - pub fn gl(&self) -> &dyn gl::Gl { + pub fn gl(&self) -> &gl::Gl { match *self { GLContextWrapper::Native(ref ctx) => ctx.gl(), GLContextWrapper::OSMesa(ref ctx) => ctx.gl(), diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index ceaaf908b9f..ee1e3513939 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -8,12 +8,12 @@ use canvas_traits::webgl::*; use embedder_traits::EventLoopWaker; use euclid::default::Size2D; use fnv::FnvHashMap; -use gleam::gl; use half::f16; use ipc_channel::ipc::{self, OpaqueIpcMessage}; use ipc_channel::router::ROUTER; use offscreen_gl_context::{DrawBuffer, GLContext, NativeGLContextMethods}; use pixels::{self, PixelFormat}; +use sparkle::gl; use std::borrow::Cow; use std::cell::Cell; use std::cell::RefCell; @@ -1573,7 +1573,7 @@ impl WebGLImpl { } fn initialize_framebuffer( - gl: &dyn gl::Gl, + gl: &gl::Gl, state: &GLState, color: bool, depth: bool, @@ -1633,7 +1633,7 @@ impl WebGLImpl { } #[allow(unsafe_code)] - fn link_program(gl: &dyn gl::Gl, program: WebGLProgramId) -> ProgramLinkInfo { + fn link_program(gl: &gl::Gl, program: WebGLProgramId) -> ProgramLinkInfo { gl.link_program(program.get()); let mut linked = [0]; unsafe { @@ -1706,13 +1706,13 @@ impl WebGLImpl { } } - fn finish(gl: &dyn gl::Gl, chan: &WebGLSender<()>) { + fn finish(gl: &gl::Gl, chan: &WebGLSender<()>) { gl.finish(); chan.send(()).unwrap(); } fn shader_precision_format( - gl: &dyn gl::Gl, + gl: &gl::Gl, shader_type: u32, precision_type: u32, chan: &WebGLSender<(i32, i32, i32)>, @@ -1722,7 +1722,7 @@ impl WebGLImpl { } #[allow(unsafe_code)] - fn get_extensions(gl: &dyn gl::Gl, chan: &WebGLSender<String>) { + fn get_extensions(gl: &gl::Gl, chan: &WebGLSender<String>) { let mut ext_count = [0]; unsafe { gl.get_integer_v(gl::NUM_EXTENSIONS, &mut ext_count); @@ -1743,7 +1743,7 @@ impl WebGLImpl { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.6 fn get_framebuffer_attachment_parameter( - gl: &dyn gl::Gl, + gl: &gl::Gl, target: u32, attachment: u32, pname: u32, @@ -1754,18 +1754,13 @@ impl WebGLImpl { } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7 - fn get_renderbuffer_parameter( - gl: &dyn gl::Gl, - target: u32, - pname: u32, - chan: &WebGLSender<i32>, - ) { + fn get_renderbuffer_parameter(gl: &gl::Gl, target: u32, pname: u32, chan: &WebGLSender<i32>) { let parameter = gl.get_renderbuffer_parameter_iv(target, pname); chan.send(parameter).unwrap(); } fn uniform_location( - gl: &dyn gl::Gl, + gl: &gl::Gl, program_id: WebGLProgramId, name: &str, chan: &WebGLSender<i32>, @@ -1775,18 +1770,18 @@ impl WebGLImpl { chan.send(location).unwrap(); } - fn shader_info_log(gl: &dyn gl::Gl, shader_id: WebGLShaderId, chan: &WebGLSender<String>) { + fn shader_info_log(gl: &gl::Gl, shader_id: WebGLShaderId, chan: &WebGLSender<String>) { let log = gl.get_shader_info_log(shader_id.get()); chan.send(log).unwrap(); } - fn program_info_log(gl: &dyn gl::Gl, program_id: WebGLProgramId, chan: &WebGLSender<String>) { + fn program_info_log(gl: &gl::Gl, program_id: WebGLProgramId, chan: &WebGLSender<String>) { let log = gl.get_program_info_log(program_id.get()); chan.send(log).unwrap(); } #[allow(unsafe_code)] - fn create_buffer(gl: &dyn gl::Gl, chan: &WebGLSender<Option<WebGLBufferId>>) { + fn create_buffer(gl: &gl::Gl, chan: &WebGLSender<Option<WebGLBufferId>>) { let buffer = gl.gen_buffers(1)[0]; let buffer = if buffer == 0 { None @@ -1797,7 +1792,7 @@ impl WebGLImpl { } #[allow(unsafe_code)] - fn create_framebuffer(gl: &dyn gl::Gl, chan: &WebGLSender<Option<WebGLFramebufferId>>) { + fn create_framebuffer(gl: &gl::Gl, chan: &WebGLSender<Option<WebGLFramebufferId>>) { let framebuffer = gl.gen_framebuffers(1)[0]; let framebuffer = if framebuffer == 0 { None @@ -1808,7 +1803,7 @@ impl WebGLImpl { } #[allow(unsafe_code)] - fn create_renderbuffer(gl: &dyn gl::Gl, chan: &WebGLSender<Option<WebGLRenderbufferId>>) { + fn create_renderbuffer(gl: &gl::Gl, chan: &WebGLSender<Option<WebGLRenderbufferId>>) { let renderbuffer = gl.gen_renderbuffers(1)[0]; let renderbuffer = if renderbuffer == 0 { None @@ -1819,7 +1814,7 @@ impl WebGLImpl { } #[allow(unsafe_code)] - fn create_texture(gl: &dyn gl::Gl, chan: &WebGLSender<Option<WebGLTextureId>>) { + fn create_texture(gl: &gl::Gl, chan: &WebGLSender<Option<WebGLTextureId>>) { let texture = gl.gen_textures(1)[0]; let texture = if texture == 0 { None @@ -1830,7 +1825,7 @@ impl WebGLImpl { } #[allow(unsafe_code)] - fn create_program(gl: &dyn gl::Gl, chan: &WebGLSender<Option<WebGLProgramId>>) { + fn create_program(gl: &gl::Gl, chan: &WebGLSender<Option<WebGLProgramId>>) { let program = gl.create_program(); let program = if program == 0 { None @@ -1841,7 +1836,7 @@ impl WebGLImpl { } #[allow(unsafe_code)] - fn create_shader(gl: &dyn gl::Gl, shader_type: u32, chan: &WebGLSender<Option<WebGLShaderId>>) { + fn create_shader(gl: &gl::Gl, shader_type: u32, chan: &WebGLSender<Option<WebGLShaderId>>) { let shader = gl.create_shader(shader_type); let shader = if shader == 0 { None @@ -1852,7 +1847,7 @@ impl WebGLImpl { } #[allow(unsafe_code)] - fn create_vertex_array(gl: &dyn gl::Gl, chan: &WebGLSender<Option<WebGLVertexArrayId>>) { + fn create_vertex_array(gl: &gl::Gl, chan: &WebGLSender<Option<WebGLVertexArrayId>>) { let vao = gl.gen_vertex_arrays(1)[0]; let vao = if vao == 0 { None @@ -1864,7 +1859,7 @@ impl WebGLImpl { #[inline] fn bind_framebuffer<Native: NativeGLContextMethods>( - gl: &dyn gl::Gl, + gl: &gl::Gl, target: u32, request: WebGLFramebufferBindingRequest, ctx: &GLContext<Native>, @@ -1880,7 +1875,7 @@ impl WebGLImpl { } #[inline] - fn compile_shader(gl: &dyn gl::Gl, shader_id: WebGLShaderId, source: &str) { + fn compile_shader(gl: &gl::Gl, shader_id: WebGLShaderId, source: &str) { gl.shader_source(shader_id.get(), &[source.as_bytes()]); gl.compile_shader(shader_id.get()); } diff --git a/components/canvas_traits/Cargo.toml b/components/canvas_traits/Cargo.toml index b16b114173a..4c2691bbd84 100644 --- a/components/canvas_traits/Cargo.toml +++ b/components/canvas_traits/Cargo.toml @@ -17,7 +17,6 @@ webgl_backtrace = [] cssparser = "0.25" euclid = "0.20" ipc-channel = "0.12" -gleam = "0.6.7" lazy_static = "1" malloc_size_of = { path = "../malloc_size_of" } malloc_size_of_derive = "0.1" @@ -25,6 +24,7 @@ pixels = {path = "../pixels"} serde = "1.0" serde_bytes = "0.10" servo_config = {path = "../config"} +sparkle = "0.1" typetag = "0.1" webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]} webvr_traits = {path = "../webvr_traits"} diff --git a/components/canvas_traits/webgl.rs b/components/canvas_traits/webgl.rs index a037b528874..142119fb75d 100644 --- a/components/canvas_traits/webgl.rs +++ b/components/canvas_traits/webgl.rs @@ -3,10 +3,10 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use euclid::default::{Rect, Size2D}; -use gleam::gl; -use gleam::gl::Gl; use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSharedMemory}; use pixels::PixelFormat; +use sparkle::gl; +use sparkle::gl::Gl; use std::borrow::Cow; use std::fmt; use std::num::NonZeroU32; @@ -549,7 +549,7 @@ pub enum WebVRCommand { // Trait object that handles WebVR commands. // Receives the texture id and size associated to the WebGLContext. pub trait WebVRRenderHandler: Send { - fn handle(&mut self, gl: &dyn Gl, command: WebVRCommand, texture: Option<(u32, Size2D<i32>)>); + fn handle(&mut self, gl: &Gl, command: WebVRCommand, texture: Option<(u32, Size2D<i32>)>); } /// WebGL commands required to implement DOMToTexture feature. @@ -758,9 +758,9 @@ macro_rules! gl_enums { } } -// FIXME: These should come from gleam +// FIXME: These should come from sparkle mod gl_ext_constants { - use gleam::gl::types::GLenum; + use sparkle::gl::types::GLenum; pub const COMPRESSED_RGB_S3TC_DXT1_EXT: GLenum = 0x83F0; pub const COMPRESSED_RGBA_S3TC_DXT1_EXT: GLenum = 0x83F1; diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 225daef5e04..957f45ad9bd 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -52,7 +52,6 @@ encoding_rs = "0.8" enum-iterator = "0.2.0" euclid = "0.20" fnv = "1.0" -gleam = "0.6" headers = "0.2" html5ever = "0.23" http = "0.1" @@ -100,6 +99,7 @@ servo_geometry = {path = "../geometry" } servo-media = {git = "https://github.com/servo/media"} servo_rand = {path = "../rand"} servo_url = {path = "../url"} +sparkle = "0.1" smallvec = { version = "0.6", features = ["std", "union"] } style = {path = "../style", features = ["servo"]} style_traits = {path = "../style_traits"} diff --git a/components/script/dom/webgl_extensions/extensions.rs b/components/script/dom/webgl_extensions/extensions.rs index 7beb3081374..fa502ca26cd 100644 --- a/components/script/dom/webgl_extensions/extensions.rs +++ b/components/script/dom/webgl_extensions/extensions.rs @@ -20,9 +20,9 @@ use crate::dom::webglrenderingcontext::WebGLRenderingContext; use crate::dom::webgltexture::TexCompression; use canvas_traits::webgl::{GlType, WebGLVersion}; use fnv::{FnvHashMap, FnvHashSet}; -use gleam::gl::{self, GLenum}; use js::jsapi::JSObject; use malloc_size_of::MallocSizeOf; +use sparkle::gl::{self, GLenum}; use std::collections::HashMap; use std::iter::FromIterator; use std::ptr::NonNull; diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index c747fe84984..10bb31d2405 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -62,7 +62,7 @@ media = {path = "../media"} msg = {path = "../msg"} net = {path = "../net"} net_traits = {path = "../net_traits"} -offscreen_gl_context = "0.23" +offscreen_gl_context = "0.25" profile = {path = "../profile"} profile_traits = {path = "../profile_traits"} script = {path = "../script"} @@ -72,6 +72,7 @@ servo_config = {path = "../config"} servo_geometry = {path = "../geometry"} servo-media = {git = "https://github.com/servo/media"} servo_url = {path = "../url"} +sparkle = "0.1" style = {path = "../style", features = ["servo"]} style_traits = {path = "../style_traits", features = ["servo"]} webrender = {git = "https://github.com/servo/webrender"} diff --git a/components/servo/lib.rs b/components/servo/lib.rs index e2ce15fa39f..9ae3212d98c 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -412,7 +412,11 @@ where } else { let dispatcher = Box::new(MainThreadDispatcher::new(compositor_proxy.clone())) as Box<_>; - GLContextFactory::current_native_handle(dispatcher, window.gl().get_type()) + let gl_type = match window.gl().get_type() { + gl::GlType::Gl => sparkle::gl::GlType::Gl, + gl::GlType::Gles => sparkle::gl::GlType::Gles, + }; + GLContextFactory::current_native_handle(dispatcher, gl_type) }; let (external_image_handlers, external_images) = WebrenderExternalImageHandlers::new(); diff --git a/components/webvr/Cargo.toml b/components/webvr/Cargo.toml index d6528e946cb..aae24a7ccb3 100644 --- a/components/webvr/Cargo.toml +++ b/components/webvr/Cargo.toml @@ -22,8 +22,9 @@ gleam = "0.6" ipc-channel = "0.12" log = "0.4" msg = {path = "../msg"} -rust-webvr = { version = "0.14.2", features = ["mock", "openvr", "vrexternal"] } -rust-webvr-api = "0.14" +rust-webvr = {version = "0.16", features = ["mock", "openvr", "vrexternal"]} +rust-webvr-api = "0.16" script_traits = {path = "../script_traits"} servo_config = {path = "../config"} +sparkle = "0.1" webvr_traits = {path = "../webvr_traits" } diff --git a/components/webvr/webvr_thread.rs b/components/webvr/webvr_thread.rs index c782fb2e562..d27e63d6c0b 100644 --- a/components/webvr/webvr_thread.rs +++ b/components/webvr/webvr_thread.rs @@ -5,13 +5,13 @@ use canvas_traits::webgl; use crossbeam_channel::{unbounded, Receiver, Sender}; use euclid::default::Size2D; -use gleam::gl::Gl; use ipc_channel::ipc; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use msg::constellation_msg::PipelineId; use rust_webvr::VRServiceManager; use script_traits::ConstellationMsg; use servo_config::pref; +use sparkle::gl::Gl; use std::collections::hash_map::Entry; use std::collections::{HashMap, HashSet}; use std::sync::mpsc; @@ -429,12 +429,7 @@ impl WebVRCompositorHandler { impl webgl::WebVRRenderHandler for WebVRCompositorHandler { #[allow(unsafe_code)] - fn handle( - &mut self, - gl: &dyn Gl, - cmd: webgl::WebVRCommand, - texture: Option<(u32, Size2D<i32>)>, - ) { + fn handle(&mut self, gl: &Gl, cmd: webgl::WebVRCommand, texture: Option<(u32, Size2D<i32>)>) { match cmd { webgl::WebVRCommand::Create(compositor_id) => { if let Some(compositor) = self.create_compositor(compositor_id) { diff --git a/components/webvr_traits/Cargo.toml b/components/webvr_traits/Cargo.toml index da68644c050..a9a49cd59e0 100644 --- a/components/webvr_traits/Cargo.toml +++ b/components/webvr_traits/Cargo.toml @@ -13,5 +13,5 @@ path = "lib.rs" [dependencies] ipc-channel = "0.12" msg = {path = "../msg"} -rust-webvr-api = { version = "0.14", features = ["ipc"] } +rust-webvr-api = {version = "0.16", features = ["ipc"]} serde = "1.0" diff --git a/ports/glutin/Cargo.toml b/ports/glutin/Cargo.toml index 0c821dd7685..c600856bab7 100644 --- a/ports/glutin/Cargo.toml +++ b/ports/glutin/Cargo.toml @@ -57,7 +57,7 @@ lazy_static = "1" libservo = {path = "../../components/servo"} libc = "0.2" log = "0.4" -rust-webvr = { version = "0.14.2", features = ["glwindow"] } +rust-webvr = { version = "0.16", features = ["glwindow"] } servo-media = {git = "https://github.com/servo/media"} tinyfiledialogs = "3.0" webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] } diff --git a/ports/libmlservo/Cargo.toml b/ports/libmlservo/Cargo.toml index 20e5eb760eb..4c4ef0e8b1b 100644 --- a/ports/libmlservo/Cargo.toml +++ b/ports/libmlservo/Cargo.toml @@ -22,7 +22,7 @@ layout-2020 = ["simpleservo/layout-2020"] [dependencies] libservo = { path = "../../components/servo", features = ["no_static_freetype"] } simpleservo = { path = "../libsimpleservo/api", features = ["no_static_freetype"] } -rust-webvr = { version = "0.14.2", features = ["magicleap"] } +rust-webvr = { version = "0.16", features = ["magicleap"] } webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] } webxr = { git = "https://github.com/servo/webxr", features = ["ipc", "magicleap"] } libc = "0.2" diff --git a/servo-tidy.toml b/servo-tidy.toml index a5a351692b3..80897ef583d 100644 --- a/servo-tidy.toml +++ b/servo-tidy.toml @@ -29,7 +29,9 @@ rand = [ [ignore] # Ignored packages with duplicated versions packages = [ + "cgl", "gl_generator", # https://github.com/servo/servo/pull/23288#issuecomment-494687746 + "gleam", "proc-macro2", "quote", "rand_core", |