diff --git a/third_party/rust/offscreen_gl_context/.cargo-checksum.json b/third_party/rust/offscreen_gl_context/.cargo-checksum.json index aeda4ede752d..a29d7316c94b 100644 --- a/third_party/rust/offscreen_gl_context/.cargo-checksum.json +++ b/third_party/rust/offscreen_gl_context/.cargo-checksum.json @@ -1 +1 @@ -{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"7150ee9391a955b2ef7e0762fc61c0c1aab167620ca36d88d78062d93b8334ba",".travis.yml":"9b8376fc479996f32f8a690e6009fc2f7e9f6dc1b1224e0180a92ad65b0b2183","Cargo.toml":"60ebb561d420274dbcaa25b70eccc36f3b711e4ec0921629c5fffd2e5db68119","Makefile":"85b6d903eecac170ac97f10d9d89b8366cd91f5ea2f7c6212704bc590b64cf50","README.md":"614cf0c6242be3e62e45a3d60ce9a2a1581bdc46b28b25d5f40caba558e4d615","build.rs":"9a6d3cf7aaa49c71b1a70ef6e449c4393026368c7e5f3284c696e42d496b2489","src/draw_buffer.rs":"7619ea2889c1e49ea387c3952a8cea5821526cf68e81ad02f918a373e71ef9ed","src/gl_context.rs":"ef41d8eea16d4329bd475dde05e7ca57cf72304fa7616c9fda34d091b7ae45c4","src/gl_context_attributes.rs":"c76ef02996d0daac313b666d1991878bbf7812932a0f9feac9e62c89ba7bf669","src/gl_context_capabilities.rs":"9f665ad04d42d47d15ecbd430639d95da526ec5951f0b7abe2434adc1415c85d","src/gl_feature.rs":"b826884900c0e8d6317a41ebb6c30bdb468601bf1c030c376749bdb2ecd2f15a","src/gl_formats.rs":"99087345b4e9a12c86605c0d091bfaf1b4ed4b2475a3b6f91d2127a2bb85fe1b","src/gl_limits.rs":"02e41619518daae5895929db00d073b5ad0d9daf9319a61abb7012c2e59fb6c7","src/lib.rs":"38d2f093f564b0e5aee86e01fc53684f24d631673691c0b2fe60231b55f55499","src/platform/mod.rs":"973a55be221419f1c86e9a85e7e45a1e1192b0592d6066e0e145e34c0cfb2ca0","src/platform/not_implemented/mod.rs":"d576e9fc3164f9e2a8ff9460a60eaa8ecada44c600de1a4d1bb5513ab93569af","src/platform/not_implemented/native_gl_context.rs":"fe018722b8bebbd59b6fae759dd78b0175d10bf110205b113ff155fd06d0f75d","src/platform/with_cgl/mod.rs":"b05dc146c9ba82d62410d9b0566a8aa70c77e7ec583ad4881c531d7118454543","src/platform/with_cgl/native_gl_context.rs":"c6271cfa96836d8f833f5efbc90352852557d582db41d2c513cc36c3f966ae88","src/platform/with_egl/mod.rs":"c52ac147eb051733070c36b2c62be8c57427f80999507f62a9ce801f4aac284c","src/platform/with_egl/native_gl_context.rs":"3a8342d53de9525a5478cc96b323dbad2b3628aa6655fe5f092834cc72256116","src/platform/with_egl/utils.rs":"508521e2bf3809ffe0dfea4fa4a358903f49c77a33aa42cc6c0e7458d992a2a7","src/platform/with_glx/mod.rs":"0e497f38b2071ed189995c91b27b0b199d31bfcc10836e2d26b55023d7aff503","src/platform/with_glx/native_gl_context.rs":"2c648ae18baac14290b2eca3581d474adfea00a29a7ad47a1100e564e74b9152","src/platform/with_glx/utils.rs":"eb81e0a4c62947fa5099c241cfe2e4dd075376d30b22864e042c0f536ac6be58","src/platform/with_osmesa/mod.rs":"9f6d69878125185f16740f52ba5cdd8a45e8812af1a3561482c9b43edaf4514a","src/platform/with_wgl/mod.rs":"38f9b44b54c8a1bd4d25ae77a4ea6a2e5454a00b816764d7d74152c1f3c1b126","src/platform/with_wgl/native_gl_context.rs":"8f5f4155cfe630901c0e1c851f1ca0a9b8218bbb30ceafd327b2a6fd59794a86","src/platform/with_wgl/utils.rs":"d9640c000dcb513cf0a13c4a0d35c423366b7d0894deff299affe0202bdeb770","src/platform/with_wgl/wgl_attributes.rs":"73b75da18519e048011e9c303e402cf7961e3652aa8f4d4ebf507b4ab83d06a3","src/tests.rs":"ce137345454f4e565512085c11b4da34f1c1614a87ba0a29d9b1a5219ef502f2"},"package":"000307b66855b01357765d9ac8d32a66aa09f3dcc3a7ccb272f74c76df475c9c"} \ No newline at end of file +{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",".gitignore":"7150ee9391a955b2ef7e0762fc61c0c1aab167620ca36d88d78062d93b8334ba",".travis.yml":"9b8376fc479996f32f8a690e6009fc2f7e9f6dc1b1224e0180a92ad65b0b2183","Cargo.toml":"7a9a4be975f82a33d22cc25c2c4bdafa7225801be31f04adddec1eedf8d153a5","Makefile":"85b6d903eecac170ac97f10d9d89b8366cd91f5ea2f7c6212704bc590b64cf50","README.md":"614cf0c6242be3e62e45a3d60ce9a2a1581bdc46b28b25d5f40caba558e4d615","build.rs":"86776b47fac1d9368e3c3c5d57c62731729ed859bb1c4e4db0fe219251812cab","src/draw_buffer.rs":"7619ea2889c1e49ea387c3952a8cea5821526cf68e81ad02f918a373e71ef9ed","src/gl_context.rs":"ef41d8eea16d4329bd475dde05e7ca57cf72304fa7616c9fda34d091b7ae45c4","src/gl_context_attributes.rs":"c76ef02996d0daac313b666d1991878bbf7812932a0f9feac9e62c89ba7bf669","src/gl_context_capabilities.rs":"9f665ad04d42d47d15ecbd430639d95da526ec5951f0b7abe2434adc1415c85d","src/gl_feature.rs":"b826884900c0e8d6317a41ebb6c30bdb468601bf1c030c376749bdb2ecd2f15a","src/gl_formats.rs":"99087345b4e9a12c86605c0d091bfaf1b4ed4b2475a3b6f91d2127a2bb85fe1b","src/gl_limits.rs":"02e41619518daae5895929db00d073b5ad0d9daf9319a61abb7012c2e59fb6c7","src/lib.rs":"daaf4e26504dbb97f3803de4337f601d616adf0633e5c4415c2c172fb257ebd6","src/platform/mod.rs":"f6ec310e5b8fb519607b8e4d5ca71a0c07c83737a83c3785b5b44e7902498c8a","src/platform/not_implemented/mod.rs":"d576e9fc3164f9e2a8ff9460a60eaa8ecada44c600de1a4d1bb5513ab93569af","src/platform/not_implemented/native_gl_context.rs":"fe018722b8bebbd59b6fae759dd78b0175d10bf110205b113ff155fd06d0f75d","src/platform/with_cgl/mod.rs":"b05dc146c9ba82d62410d9b0566a8aa70c77e7ec583ad4881c531d7118454543","src/platform/with_cgl/native_gl_context.rs":"c6271cfa96836d8f833f5efbc90352852557d582db41d2c513cc36c3f966ae88","src/platform/with_egl/mod.rs":"c52ac147eb051733070c36b2c62be8c57427f80999507f62a9ce801f4aac284c","src/platform/with_egl/native_gl_context.rs":"3a8342d53de9525a5478cc96b323dbad2b3628aa6655fe5f092834cc72256116","src/platform/with_egl/utils.rs":"508521e2bf3809ffe0dfea4fa4a358903f49c77a33aa42cc6c0e7458d992a2a7","src/platform/with_glx/mod.rs":"0e497f38b2071ed189995c91b27b0b199d31bfcc10836e2d26b55023d7aff503","src/platform/with_glx/native_gl_context.rs":"2c648ae18baac14290b2eca3581d474adfea00a29a7ad47a1100e564e74b9152","src/platform/with_glx/utils.rs":"eb81e0a4c62947fa5099c241cfe2e4dd075376d30b22864e042c0f536ac6be58","src/platform/with_osmesa/mod.rs":"9f6d69878125185f16740f52ba5cdd8a45e8812af1a3561482c9b43edaf4514a","src/platform/with_wgl/mod.rs":"38f9b44b54c8a1bd4d25ae77a4ea6a2e5454a00b816764d7d74152c1f3c1b126","src/platform/with_wgl/native_gl_context.rs":"4aecd40a811cf38607b17db9724f79bb934e056f85c90c987b2aa82d637b7bb4","src/platform/with_wgl/utils.rs":"d9640c000dcb513cf0a13c4a0d35c423366b7d0894deff299affe0202bdeb770","src/platform/with_wgl/wgl_attributes.rs":"73b75da18519e048011e9c303e402cf7961e3652aa8f4d4ebf507b4ab83d06a3","src/tests.rs":"780d4211a02c09abebb2b8be85a87ed98bee374999bd333c29efb3a8c7d2b281"},"package":"9da33a538d9c8fc81102e5d5c1ed844568b400d86c22413550a9b8474be62ba3"} \ No newline at end of file diff --git a/third_party/rust/offscreen_gl_context/Cargo.toml b/third_party/rust/offscreen_gl_context/Cargo.toml index 2605d687f27f..63d5498ae51a 100644 --- a/third_party/rust/offscreen_gl_context/Cargo.toml +++ b/third_party/rust/offscreen_gl_context/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "offscreen_gl_context" license = "MIT / Apache-2.0" -version = "0.4.5" +version = "0.5.0" authors = ["Emilio Cobos Álvarez ", "The Servo Project Developers"] description = "Creation and manipulation of HW accelerated offscreen rendering contexts in multiple platforms. Originally intended for the Servo project's WebGL implementation." repository = "https://github.com/emilio/rust-offscreen-rendering-context" diff --git a/third_party/rust/offscreen_gl_context/build.rs b/third_party/rust/offscreen_gl_context/build.rs index 5f14f4b03255..6d7faa438d0d 100644 --- a/third_party/rust/offscreen_gl_context/build.rs +++ b/third_party/rust/offscreen_gl_context/build.rs @@ -15,14 +15,14 @@ fn main() { .write_bindings(gl_generator::StaticGenerator, &mut file).unwrap(); } - if target.contains("android") || target.contains("linux") { + if target.contains("android") || (target.contains("linux") && cfg!(feature = "test_egl_in_linux")) { let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap(); Registry::new(Api::Egl, (1, 4), Profile::Core, Fallbacks::All, []) .write_bindings(gl_generator::StaticGenerator, &mut file).unwrap(); println!("cargo:rustc-link-lib=EGL"); } - if target.contains("windows") { + if target.contains("windows") { let mut file = File::create(&dest.join("wgl_bindings.rs")).unwrap(); Registry::new(Api::Wgl, (1, 0), Profile::Core, Fallbacks::All, []) .write_bindings(gl_generator::StaticGenerator, &mut file) @@ -46,6 +46,6 @@ fn main() { ]) .write_bindings(gl_generator::StructGenerator, &mut file).unwrap(); - + } } diff --git a/third_party/rust/offscreen_gl_context/src/lib.rs b/third_party/rust/offscreen_gl_context/src/lib.rs index 3ae9da6b612c..4f257f8a2438 100644 --- a/third_party/rust/offscreen_gl_context/src/lib.rs +++ b/third_party/rust/offscreen_gl_context/src/lib.rs @@ -59,7 +59,7 @@ mod glx { include!(concat!(env!("OUT_DIR"), "/glx_bindings.rs")); } -#[cfg(any(target_os="linux", target_os="android"))] +#[cfg(any(target_os="android", all(target_os="linux", feature = "test_egl_in_linux")))] #[allow(non_camel_case_types)] mod egl { use std::os::raw::{c_long, c_void}; diff --git a/third_party/rust/offscreen_gl_context/src/platform/mod.rs b/third_party/rust/offscreen_gl_context/src/platform/mod.rs index 8fa6a90a222e..a0f6c149bbc0 100644 --- a/third_party/rust/offscreen_gl_context/src/platform/mod.rs +++ b/third_party/rust/offscreen_gl_context/src/platform/mod.rs @@ -36,7 +36,7 @@ pub mod with_osmesa; #[cfg(feature="osmesa")] pub use self::with_osmesa::{OSMesaContext, OSMesaContextHandle}; -#[cfg(any(target_os="android", target_os="linux"))] +#[cfg(any(target_os="android", all(target_os="linux", feature = "test_egl_in_linux")))] pub mod with_egl; #[cfg(target_os="android")] pub use self::with_egl::{NativeGLContext, NativeGLContextHandle}; diff --git a/third_party/rust/offscreen_gl_context/src/platform/with_wgl/native_gl_context.rs b/third_party/rust/offscreen_gl_context/src/platform/with_wgl/native_gl_context.rs index b8d109d11d71..204322d92f14 100644 --- a/third_party/rust/offscreen_gl_context/src/platform/with_wgl/native_gl_context.rs +++ b/third_party/rust/offscreen_gl_context/src/platform/with_wgl/native_gl_context.rs @@ -127,48 +127,53 @@ impl NativeGLContextMethods for NativeGLContext { // and bind the original share context again when the wglShareList is completed. let (tx, rx) = mpsc::channel(); dispatcher.dispatch(Box::new(move || { - unsafe { + let result = unsafe { if wgl::MakeCurrent(ptr::null_mut(), ptr::null_mut()) == 0 { - error!("WGL MakeCurrent failed"); + Err(()) + } else { + Ok(()) } - } - tx.send(()).unwrap(); + }; + tx.send(result).unwrap(); })); // Wait until wglMakeCurrent operation is completed in the thread of the shared context - rx.recv().unwrap(); + if rx.recv().unwrap().is_err() { + return Err("Error creating WGL context: WGL::MakeCurrent failed in shared context") + } } - match unsafe { utils::create_offscreen(render_ctx, &WGLAttributes::default()) } { + let result = match unsafe { utils::create_offscreen(render_ctx, &WGLAttributes::default()) } { Ok(ref res) => { let ctx = NativeGLContext { render_ctx: res.0, device_ctx: res.1, weak: false, }; - - // Restore shared context - if let Some(ref dispatcher) = dispatcher { - let (tx, rx) = mpsc::channel(); - let handle = NativeGLContextHandle(render_ctx, device_ctx); - dispatcher.dispatch(Box::new(move || { - unsafe { - if wgl::MakeCurrent(handle.1 as *const _, handle.0 as *const _) == 0 { - error!("WGL MakeCurrent failed!"); - } - }; - tx.send(()).unwrap(); - })); - // Wait until wglMakeCurrent operation is completed in the thread of the shared context - rx.recv().unwrap(); - } - Ok(ctx) } Err(s) => { error!("WGL: {}", s); Err("Error creating WGL context") } + }; + + // Restore shared context + if let Some(ref dispatcher) = dispatcher { + let (tx, rx) = mpsc::channel(); + let handle = NativeGLContextHandle(render_ctx, device_ctx); + dispatcher.dispatch(Box::new(move || { + unsafe { + if wgl::MakeCurrent(handle.1 as *const _, handle.0 as *const _) == 0 { + error!("Error restoring WGL shared context: WGL MakeCurrent failed"); + } + }; + tx.send(()).unwrap(); + })); + // Wait until wglMakeCurrent operation is completed in the thread of the shared context + rx.recv().unwrap(); } + + result } fn is_current(&self) -> bool { diff --git a/third_party/rust/offscreen_gl_context/src/tests.rs b/third_party/rust/offscreen_gl_context/src/tests.rs index d6b7cbf73005..b6732589fa51 100644 --- a/third_party/rust/offscreen_gl_context/src/tests.rs +++ b/third_party/rust/offscreen_gl_context/src/tests.rs @@ -167,7 +167,7 @@ fn test_multithread_render() { let primary = GLContext::::new(size, GLContextAttributes::default(), ColorAttachmentType::Texture, - None).unwrap(); + None).unwrap(); test_gl_context(&primary); let (tx, rx) = mpsc::channel(); let (end_tx, end_rx) = mpsc::channel(); @@ -217,7 +217,7 @@ fn test_multithread_sharing() { ColorAttachmentType::Texture, None).unwrap(); primary.make_current().unwrap(); - + let primary_texture_id = primary.borrow_draw_buffer().unwrap().get_bound_texture_id().unwrap(); assert!(primary_texture_id != 0); @@ -379,4 +379,4 @@ fn test_zero_size() { GLContextAttributes::default(), ColorAttachmentType::Texture, None).unwrap(); -} \ No newline at end of file +} diff --git a/toolkit/library/gtest/rust/Cargo.lock b/toolkit/library/gtest/rust/Cargo.lock index b9d7bf1f9a75..61e09b80affe 100644 --- a/toolkit/library/gtest/rust/Cargo.lock +++ b/toolkit/library/gtest/rust/Cargo.lock @@ -293,7 +293,7 @@ dependencies = [ [[package]] name = "offscreen_gl_context" -version = "0.4.5" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -553,7 +553,7 @@ dependencies = [ "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "webrender_traits 0.8.0", @@ -571,7 +571,7 @@ dependencies = [ "gleam 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "serde_codegen 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -635,7 +635,7 @@ dependencies = [ "checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1" "checksum num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "a16a42856a256b39c6d3484f097f6713e14feacd9bfb02290917904fae46c81c" "checksum num_cpus 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8890e6084723d57d0df8d2720b0d60c6ee67d6c93e7169630e4371e88765dcad" -"checksum offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "000307b66855b01357765d9ac8d32a66aa09f3dcc3a7ccb272f74c76df475c9c" +"checksum offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9da33a538d9c8fc81102e5d5c1ed844568b400d86c22413550a9b8474be62ba3" "checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" "checksum pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8cee804ecc7eaf201a4a207241472cc870e825206f6c031e3ee2a72fa425f2fa" "checksum post-expansion 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "31a834a6060acaef74a8d878f6ca37a2b86fefe042bbfe70689ba587e42526f9" diff --git a/toolkit/library/rust/Cargo.lock b/toolkit/library/rust/Cargo.lock index 6d121fa68d7b..8cdc8767b805 100644 --- a/toolkit/library/rust/Cargo.lock +++ b/toolkit/library/rust/Cargo.lock @@ -280,7 +280,7 @@ dependencies = [ [[package]] name = "offscreen_gl_context" -version = "0.4.5" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -540,7 +540,7 @@ dependencies = [ "lazy_static 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", "webrender_traits 0.8.0", @@ -558,7 +558,7 @@ dependencies = [ "gleam 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "serde_codegen 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -622,7 +622,7 @@ dependencies = [ "checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1" "checksum num-traits 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "a16a42856a256b39c6d3484f097f6713e14feacd9bfb02290917904fae46c81c" "checksum num_cpus 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8890e6084723d57d0df8d2720b0d60c6ee67d6c93e7169630e4371e88765dcad" -"checksum offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "000307b66855b01357765d9ac8d32a66aa09f3dcc3a7ccb272f74c76df475c9c" +"checksum offscreen_gl_context 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9da33a538d9c8fc81102e5d5c1ed844568b400d86c22413550a9b8474be62ba3" "checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" "checksum pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8cee804ecc7eaf201a4a207241472cc870e825206f6c031e3ee2a72fa425f2fa" "checksum post-expansion 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "31a834a6060acaef74a8d878f6ca37a2b86fefe042bbfe70689ba587e42526f9"