From 7973cb64586d94a6987562fe6f180ac29ef0e971 Mon Sep 17 00:00:00 2001 From: Samson <16504129+sagudev@users.noreply.github.com> Date: Mon, 25 Dec 2023 08:11:37 +0100 Subject: [PATCH] Update wgpu to 0.18.1 (#30926) * Update wgpu to 0.18.1 * Fix webgpu code * tidy --- Cargo.lock | 67 +++++++++++++++------- Cargo.toml | 2 + components/script/dom/gpucommandencoder.rs | 3 + components/webgpu/Cargo.toml | 10 ++-- components/webgpu/identity.rs | 6 +- components/webgpu/lib.rs | 1 + servo-tidy.toml | 4 ++ 7 files changed, 65 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7efbacc031b..1db20eeb7ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -703,7 +703,7 @@ checksum = "da6bc11b07529f16944307272d5bd9b22530bc7d05751717c9d416586cedab49" dependencies = [ "clap", "heck", - "indexmap", + "indexmap 1.9.3", "log", "proc-macro2", "quote", @@ -800,7 +800,7 @@ dependencies = [ "atty", "bitflags 1.3.2", "clap_lex", - "indexmap", + "indexmap 1.9.3", "strsim", "termcolor", "textwrap", @@ -1659,6 +1659,12 @@ dependencies = [ "parking_lot", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" version = "0.3.8" @@ -2250,7 +2256,7 @@ checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a" dependencies = [ "bitflags 1.3.2", "gpu-descriptor-types", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -2578,7 +2584,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -2617,6 +2623,12 @@ dependencies = [ "ahash 0.7.7", ] +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + [[package]] name = "headers" version = "0.3.9" @@ -2869,7 +2881,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", "serde", ] @@ -3011,9 +3033,9 @@ dependencies = [ [[package]] name = "khronos-egl" -version = "4.1.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3" +checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76" dependencies = [ "libc", "pkg-config", @@ -3460,7 +3482,7 @@ dependencies = [ "euclid", "http", "hyper_serde", - "indexmap", + "indexmap 1.9.3", "keyboard-types", "selectors", "serde", @@ -3574,9 +3596,9 @@ dependencies = [ [[package]] name = "metal" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "623b5e6cefd76e58f774bd3cc0c6f5c7615c58c03a97815245a25c3c9bdee318" +checksum = "c43f73953f8cbe511f021b58f18c3ce1c3d1ae13fe953293e13345bf83217f25" dependencies = [ "bitflags 2.4.1", "block", @@ -3750,15 +3772,15 @@ checksum = "0419348c027fa7be448d2ae7ea0e4e04c2334c31dc4e74ab29f00a2a7ca69204" [[package]] name = "naga" -version = "0.13.0" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ceaaa4eedaece7e4ec08c55c640ba03dbb73fb812a6570a59bcf1930d0f70e" +checksum = "ae585df4b6514cf8842ac0f1ab4992edc975892704835b549cf818dc0191249e" dependencies = [ "bit-set", "bitflags 2.4.1", "codespan-reporting", "hexf-parse", - "indexmap", + "indexmap 2.1.0", "log", "num-traits", "rustc-hash", @@ -4869,7 +4891,7 @@ dependencies = [ "http", "hyper_serde", "image", - "indexmap", + "indexmap 1.9.3", "ipc-channel", "itertools", "jstraceable_derive", @@ -5763,7 +5785,7 @@ dependencies = [ "euclid", "fxhash", "html5ever", - "indexmap", + "indexmap 1.9.3", "itertools", "itoa", "lazy_static", @@ -6925,9 +6947,9 @@ checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" [[package]] name = "wgpu-core" -version = "0.17.1" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f8a44dd301a30ceeed3c27d8c0090433d3da04d7b2a4042738095a424d12ae7" +checksum = "ef91c1d62d1e9e81c79e600131a258edf75c9531cbdbde09c44a011a47312726" dependencies = [ "arrayvec", "bit-vec", @@ -6949,9 +6971,9 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "0.17.2" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a80bf0e3c77399bb52850cb0830af9bad073d5cfcb9dd8253bef8125c42db17" +checksum = "b84ecc802da3eb67b4cf3dd9ea6fe45bbb47ef13e6c49c5c3240868a9cc6cdd9" dependencies = [ "android_system_properties", "arrayvec", @@ -6968,9 +6990,10 @@ dependencies = [ "libc", "libloading 0.8.0", "log", - "metal 0.26.0", + "metal 0.27.0", "naga", "objc", + "once_cell", "parking_lot", "profiling", "range-alloc", @@ -6986,9 +7009,9 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee64d7398d0c2f9ca48922c902ef69c42d000c759f3db41e355f4a570b052b67" +checksum = "0d5ed5f0edf0de351fe311c53304986315ce866f394a2e6df0c4b3c70774bcdd" dependencies = [ "bitflags 2.4.1", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index 6498c172330..6dfb10275ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -106,6 +106,8 @@ webpki-roots = "0.25" webrender = { git = "https://github.com/servo/webrender", features = ["capture"] } webrender_api = { git = "https://github.com/servo/webrender" } webrender_traits = { path = "components/shared/webrender" } +wgpu-core = "0.18" +wgpu-types = "0.18" winapi = "0.3" xi-unicode = "0.1.0" xml5ever = "0.17" diff --git a/components/script/dom/gpucommandencoder.rs b/components/script/dom/gpucommandencoder.rs index e3946a9a812..ec9aa70046d 100644 --- a/components/script/dom/gpucommandencoder.rs +++ b/components/script/dom/gpucommandencoder.rs @@ -138,6 +138,7 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder { .label .as_ref() .map(|l| Cow::Borrowed(&**l)), + timestamp_writes: None, }, )) }; @@ -234,6 +235,8 @@ impl GPUCommandEncoderMethods for GPUCommandEncoder { .label .as_ref() .map(|l| Cow::Borrowed(&**l)), + timestamp_writes: None, + occlusion_query_set: None, }; Some(wgpu_com::RenderPass::new(self.encoder.0, &desc)) }; diff --git a/components/webgpu/Cargo.toml b/components/webgpu/Cargo.toml index f84c614dda6..efc978f8580 100644 --- a/components/webgpu/Cargo.toml +++ b/components/webgpu/Cargo.toml @@ -23,17 +23,17 @@ smallvec = { workspace = true, features = ["serde"] } webrender = { workspace = true } webrender_api = { workspace = true } webrender_traits = { workspace = true } -wgpu-core = { version = "0.17", features = ["replay", "trace", "serial-pass", "wgsl"] } -wgpu-types = { version = "0.17" } +wgpu-core = { workspace = true, features = ["replay", "trace", "serial-pass", "wgsl"] } +wgpu-types = { workspace = true } [target.'cfg(any(target_os = "ios", target_os = "macos"))'.dependencies.wgpu-core] -version = "0.17" +workspace = true features = ["replay", "trace", "serial-pass", "metal"] [target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies.wgpu-core] -version = "0.17" +workspace = true features = ["replay", "trace", "serial-pass", "vulkan"] [target.'cfg(windows)'.dependencies.wgpu-core] -version = "0.17" +workspace = true features = ["replay", "trace", "serial-pass", "dx11", "dx12", "vulkan"] diff --git a/components/webgpu/identity.rs b/components/webgpu/identity.rs index 4f4121a6652..6cd38008d30 100644 --- a/components/webgpu/identity.rs +++ b/components/webgpu/identity.rs @@ -164,4 +164,8 @@ where } } -impl GlobalIdentityHandlerFactory for IdentityRecyclerFactory {} +impl GlobalIdentityHandlerFactory for IdentityRecyclerFactory { + fn ids_are_generated_in_wgpu() -> bool { + false + } +} diff --git a/components/webgpu/lib.rs b/components/webgpu/lib.rs index 3cab267c730..e0db83ddbdc 100644 --- a/components/webgpu/lib.rs +++ b/components/webgpu/lib.rs @@ -377,6 +377,7 @@ impl<'a> WGPU<'a> { InstanceDescriptor { backends: wgt::Backends::PRIMARY, dx12_shader_compiler: Dx12Compiler::default(), + ..Default::default() }, ), adapters: Vec::new(), diff --git a/servo-tidy.toml b/servo-tidy.toml index edb38b1a87a..d551d3b69fd 100644 --- a/servo-tidy.toml +++ b/servo-tidy.toml @@ -53,6 +53,10 @@ packages = [ "foreign-types-shared", "metal", "paste", + # Duplicated by gpu-descriptor and indexmap + "hashbrown", + # Duplicated by script, style, cbindgen, clap, ... + "indexmap", # Duplicated by Gecko crates that haven't been updated yet (style, shmem, derive_common, ...). "syn",