From b92a598e62645ae02d459457794681833259ff7c Mon Sep 17 00:00:00 2001 From: Samson <16504129+sagudev@users.noreply.github.com> Date: Thu, 16 Jan 2025 15:42:47 +0100 Subject: [PATCH] chore: Update wgpu and fix webgpu pref (#35020) * Update wgpu to v24 Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * `dom.webgpu.enabled` -> `dom_webgpu_enabled` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * Update expectations Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --- Cargo.lock | 24 ++-- Cargo.toml | 4 +- components/script/dom/webidls/WebGPU.webidl | 6 +- components/webgpu/ipc_messages/recv.rs | 2 - components/webgpu/wgpu_thread.rs | 3 +- ports/servoshell/prefs.rs | 2 +- .../wpt/webgpu/meta/webgpu/cts.https.html.ini | 134 ++---------------- 7 files changed, 28 insertions(+), 147 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0aba4f58742..7b083ab2d69 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4450,8 +4450,9 @@ dependencies = [ [[package]] name = "metal" -version = "0.30.0" -source = "git+https://github.com/gfx-rs/metal-rs.git?rev=ef768ff9d7#ef768ff9d742ae6a0f4e83ddc8031264e7d460c4" +version = "0.31.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f569fb946490b5743ad69813cb19629130ce9374034abe31614a36402d18f99e" dependencies = [ "bitflags 2.8.0", "block", @@ -4594,8 +4595,8 @@ checksum = "956787520e75e9bd233246045d19f42fb73242759cc57fba9611d940ae96d4b0" [[package]] name = "naga" -version = "23.0.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=dc9b2eb71807ccafb7414425f1f8f24b5691685d#dc9b2eb71807ccafb7414425f1f8f24b5691685d" +version = "24.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=779261e64daa6cf76c826532b7a1561d8ec203fd#779261e64daa6cf76c826532b7a1561d8ec203fd" dependencies = [ "arrayvec", "bit-set", @@ -8494,8 +8495,8 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" [[package]] name = "wgpu-core" -version = "23.0.1" -source = "git+https://github.com/gfx-rs/wgpu?rev=dc9b2eb71807ccafb7414425f1f8f24b5691685d#dc9b2eb71807ccafb7414425f1f8f24b5691685d" +version = "24.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=779261e64daa6cf76c826532b7a1561d8ec203fd#779261e64daa6cf76c826532b7a1561d8ec203fd" dependencies = [ "arrayvec", "bit-vec", @@ -8518,8 +8519,8 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "23.0.1" -source = "git+https://github.com/gfx-rs/wgpu?rev=dc9b2eb71807ccafb7414425f1f8f24b5691685d#dc9b2eb71807ccafb7414425f1f8f24b5691685d" +version = "24.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=779261e64daa6cf76c826532b7a1561d8ec203fd#779261e64daa6cf76c826532b7a1561d8ec203fd" dependencies = [ "android_system_properties", "arrayvec", @@ -8540,7 +8541,7 @@ dependencies = [ "libc", "libloading", "log", - "metal 0.30.0", + "metal 0.31.0", "naga", "ndk-sys 0.5.0+25.2.9519653", "objc", @@ -8562,11 +8563,12 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "23.0.0" -source = "git+https://github.com/gfx-rs/wgpu?rev=dc9b2eb71807ccafb7414425f1f8f24b5691685d#dc9b2eb71807ccafb7414425f1f8f24b5691685d" +version = "24.0.0" +source = "git+https://github.com/gfx-rs/wgpu?rev=779261e64daa6cf76c826532b7a1561d8ec203fd#779261e64daa6cf76c826532b7a1561d8ec203fd" dependencies = [ "bitflags 2.8.0", "js-sys", + "log", "serde", "web-sys", ] diff --git a/Cargo.toml b/Cargo.toml index f7b01c008e2..e4303852b6e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -159,8 +159,8 @@ webrender_api = { git = "https://github.com/servo/webrender", branch = "0.65" } webrender_traits = { path = "components/shared/webrender" } webxr = { git = "https://github.com/servo/webxr" } webxr-api = { git = "https://github.com/servo/webxr" } -wgpu-core = { git = "https://github.com/gfx-rs/wgpu", rev = "dc9b2eb71807ccafb7414425f1f8f24b5691685d" } -wgpu-types = { git = "https://github.com/gfx-rs/wgpu", rev = "dc9b2eb71807ccafb7414425f1f8f24b5691685d" } +wgpu-core = { git = "https://github.com/gfx-rs/wgpu", rev = "779261e64daa6cf76c826532b7a1561d8ec203fd" } +wgpu-types = { git = "https://github.com/gfx-rs/wgpu", rev = "779261e64daa6cf76c826532b7a1561d8ec203fd" } windows-sys = "0.59" wr_malloc_size_of = { git = "https://github.com/servo/webrender", branch = "0.65" } xi-unicode = "0.3.0" diff --git a/components/script/dom/webidls/WebGPU.webidl b/components/script/dom/webidls/WebGPU.webidl index 41bee4718cb..177a12d3563 100644 --- a/components/script/dom/webidls/WebGPU.webidl +++ b/components/script/dom/webidls/WebGPU.webidl @@ -1147,10 +1147,10 @@ enum GPUQueryType { partial interface GPUCanvasContext { - [Throws, Pref="dom.webgpu.enabled"] + [Throws, Pref="dom_webgpu_enabled"] undefined configure(GPUCanvasConfiguration descriptor); - [Pref="dom.webgpu.enabled"] undefined unconfigure(); - [Throws, Pref="dom.webgpu.enabled"] + [Pref="dom_webgpu_enabled"] undefined unconfigure(); + [Throws, Pref="dom_webgpu_enabled"] GPUTexture getCurrentTexture(); }; diff --git a/components/webgpu/ipc_messages/recv.rs b/components/webgpu/ipc_messages/recv.rs index 041a576daeb..0ae97e4ec22 100644 --- a/components/webgpu/ipc_messages/recv.rs +++ b/components/webgpu/ipc_messages/recv.rs @@ -42,8 +42,6 @@ pub struct ContextConfiguration { pub is_opaque: bool, } -// FIXME: https://github.com/servo/servo/issues/34591 -#[expect(clippy::large_enum_variant)] #[derive(Debug, Deserialize, Serialize)] pub enum WebGPURequest { BufferMapAsync { diff --git a/components/webgpu/wgpu_thread.rs b/components/webgpu/wgpu_thread.rs index 374fe2e8265..e03513a0dbb 100644 --- a/components/webgpu/wgpu_thread.rs +++ b/components/webgpu/wgpu_thread.rs @@ -20,7 +20,6 @@ use wgc::command::{ComputePass, ComputePassDescriptor, RenderPass}; use wgc::device::{DeviceDescriptor, ImplicitPipelineIds}; use wgc::id; use wgc::id::DeviceId; -use wgc::instance::parse_backends_from_comma_list; use wgc::pipeline::ShaderModuleDescriptor; use wgc::resource::BufferMapOperation; use wgpu_core::command::RenderPassDescriptor; @@ -135,7 +134,7 @@ impl WGPU { "Selecting backends based on dom.webgpu.wgpu_backend pref: {:?}", backend_pref ); - parse_backends_from_comma_list(&backend_pref) + wgt::Backends::from_comma_list(&backend_pref) }; let global = Arc::new(wgc::global::Global::new( "wgpu-core", diff --git a/ports/servoshell/prefs.rs b/ports/servoshell/prefs.rs index 8fc4d1424ef..01fac5ef397 100644 --- a/ports/servoshell/prefs.rs +++ b/ports/servoshell/prefs.rs @@ -315,7 +315,7 @@ pub(crate) fn parse_command_line_arguments(args: Vec) -> ArgumentParsing "", "pref", "A preference to set to disable", - "dom.webgpu.enabled=false", + "dom_webgpu_enabled=false", ); opts.optmulti( "", diff --git a/tests/wpt/webgpu/meta/webgpu/cts.https.html.ini b/tests/wpt/webgpu/meta/webgpu/cts.https.html.ini index 83dee546199..232d81668e6 100644 --- a/tests/wpt/webgpu/meta/webgpu/cts.https.html.ini +++ b/tests/wpt/webgpu/meta/webgpu/cts.https.html.ini @@ -48425,12 +48425,20 @@ [cts.https.html?q=webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_canvas,state:*] [:state="nocontext"] + expected: + if os == "linux" and not debug: FAIL [:state="placeholder-hascontext"] + expected: + if os == "linux" and not debug: FAIL [:state="placeholder-nocontext"] + expected: + if os == "linux" and not debug: FAIL [:state="valid"] + expected: + if os == "linux" and not debug: FAIL [cts.https.html?q=webgpu:api,validation,queue,copyToTexture,CopyExternalImageToTexture:source_image,crossOrigin:*] @@ -88148,23 +88156,13 @@ [cts.https.html?q=webgpu:shader,execution,expression,binary,i32_arithmetic:subtraction:*] - expected: - if os == "linux" and not debug: CRASH [:inputSource="const";vectorize="_undef_"] - expected: - if os == "linux" and not debug: FAIL [:inputSource="const";vectorize=2] - expected: - if os == "linux" and not debug: FAIL [:inputSource="const";vectorize=3] - expected: - if os == "linux" and not debug: FAIL [:inputSource="const";vectorize=4] - expected: - if os == "linux" and not debug: FAIL [:inputSource="storage_r";vectorize="_undef_"] @@ -443357,60 +443355,34 @@ [cts.https.html?q=webgpu:shader,validation,decl,context_dependent_resolution:attribute_names:*] [:case="align"] - expected: - if os == "linux" and not debug: FAIL [:case="binding"] - expected: - if os == "linux" and not debug: FAIL [:case="builtin"] - expected: - if os == "linux" and not debug: FAIL [:case="compute"] - expected: - if os == "linux" and not debug: FAIL [:case="fragment"] - expected: - if os == "linux" and not debug: FAIL [:case="group"] - expected: - if os == "linux" and not debug: FAIL [:case="id"] - expected: - if os == "linux" and not debug: FAIL [:case="interpolate"] - expected: - if os == "linux" and not debug: FAIL [:case="invariant"] - expected: - if os == "linux" and not debug: FAIL [:case="location"] - expected: - if os == "linux" and not debug: FAIL [:case="must_use"] expected: if os == "linux" and not debug: FAIL [:case="size"] - expected: - if os == "linux" and not debug: FAIL [:case="vertex"] - expected: - if os == "linux" and not debug: FAIL [:case="workgroup_size"] - expected: - if os == "linux" and not debug: FAIL [cts.https.html?q=webgpu:shader,validation,decl,context_dependent_resolution:builtin_value_names:*] @@ -443419,92 +443391,52 @@ if os == "linux" and not debug: FAIL [:case="front_facing"] - expected: - if os == "linux" and not debug: FAIL [:case="global_invocation_id"] - expected: - if os == "linux" and not debug: FAIL [:case="instance_index"] - expected: - if os == "linux" and not debug: FAIL [:case="local_invocation_id"] - expected: - if os == "linux" and not debug: FAIL [:case="local_invocation_index"] - expected: - if os == "linux" and not debug: FAIL [:case="num_workgroups"] - expected: - if os == "linux" and not debug: FAIL [:case="position_fragment"] - expected: - if os == "linux" and not debug: FAIL [:case="position_vertex"] - expected: - if os == "linux" and not debug: FAIL [:case="sample_index"] - expected: - if os == "linux" and not debug: FAIL [:case="sample_mask_input"] - expected: - if os == "linux" and not debug: FAIL [:case="sample_mask_output"] expected: if os == "linux" and not debug: FAIL [:case="vertex_index"] - expected: - if os == "linux" and not debug: FAIL [:case="workgroup_id"] - expected: - if os == "linux" and not debug: FAIL [cts.https.html?q=webgpu:shader,validation,decl,context_dependent_resolution:diagnostic_rule_names:*] [:case="derivative_uniformity"] - expected: - if os == "linux" and not debug: FAIL [:case="rule"] - expected: - if os == "linux" and not debug: FAIL [:case="unknown"] - expected: - if os == "linux" and not debug: FAIL [:case="unknown_rule"] - expected: - if os == "linux" and not debug: FAIL [cts.https.html?q=webgpu:shader,validation,decl,context_dependent_resolution:diagnostic_severity_names:*] [:case="error"] - expected: - if os == "linux" and not debug: FAIL [:case="info"] - expected: - if os == "linux" and not debug: FAIL [:case="off"] - expected: - if os == "linux" and not debug: FAIL [:case="warning"] - expected: - if os == "linux" and not debug: FAIL [cts.https.html?q=webgpu:shader,validation,decl,context_dependent_resolution:enable_names:*] @@ -443513,40 +443445,24 @@ [cts.https.html?q=webgpu:shader,validation,decl,context_dependent_resolution:interpolation_flat_names:*] [:case="either"] - expected: - if os == "linux" and not debug: FAIL [:case="first"] - expected: - if os == "linux" and not debug: FAIL [cts.https.html?q=webgpu:shader,validation,decl,context_dependent_resolution:interpolation_sampling_names:*] [:case="center"] - expected: - if os == "linux" and not debug: FAIL [:case="centroid"] - expected: - if os == "linux" and not debug: FAIL [:case="sample"] - expected: - if os == "linux" and not debug: FAIL [cts.https.html?q=webgpu:shader,validation,decl,context_dependent_resolution:interpolation_type_names:*] [:case="flat"] - expected: - if os == "linux" and not debug: FAIL [:case="linear"] - expected: - if os == "linux" and not debug: FAIL [:case="perspective"] - expected: - if os == "linux" and not debug: FAIL [cts.https.html?q=webgpu:shader,validation,decl,context_dependent_resolution:language_names:*] @@ -443561,68 +443477,36 @@ [cts.https.html?q=webgpu:shader,validation,decl,context_dependent_resolution:swizzle_names:*] [:case="a"] - expected: - if os == "linux" and not debug: FAIL [:case="agra"] - expected: - if os == "linux" and not debug: FAIL [:case="arr"] - expected: - if os == "linux" and not debug: FAIL [:case="b"] - expected: - if os == "linux" and not debug: FAIL [:case="bgra"] - expected: - if os == "linux" and not debug: FAIL [:case="g"] - expected: - if os == "linux" and not debug: FAIL [:case="r"] - expected: - if os == "linux" and not debug: FAIL [:case="rgb"] - expected: - if os == "linux" and not debug: FAIL [:case="w"] - expected: - if os == "linux" and not debug: FAIL [:case="wxyz"] - expected: - if os == "linux" and not debug: FAIL [:case="x"] - expected: - if os == "linux" and not debug: FAIL [:case="xy"] - expected: - if os == "linux" and not debug: FAIL [:case="xyxy"] - expected: - if os == "linux" and not debug: FAIL [:case="y"] - expected: - if os == "linux" and not debug: FAIL [:case="yxz"] - expected: - if os == "linux" and not debug: FAIL [:case="z"] - expected: - if os == "linux" and not debug: FAIL [cts.https.html?q=webgpu:shader,validation,decl,let:initializer:*] @@ -443715,8 +443599,6 @@ [:case="abs_float_init_convert"] [:case="abs_int_init_convert"] - expected: - if os == "linux" and not debug: FAIL [:case="const_func_init"]