chore: Update wgpu to v25 (#36486)

Updates wgpu to v25 and remove some verbose logging from CTS (that also
causes OOM).

Testing: WebGPU CTS

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
sagudev 2025-04-18 09:49:06 +02:00 committed by GitHub
parent bd9242acfa
commit 05b5268061
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 3833 additions and 2260 deletions

70
Cargo.lock generated
View file

@ -1044,10 +1044,11 @@ dependencies = [
[[package]] [[package]]
name = "codespan-reporting" name = "codespan-reporting"
version = "0.11.1" version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81"
dependencies = [ dependencies = [
"serde",
"termcolor", "termcolor",
"unicode-width", "unicode-width",
] ]
@ -2705,7 +2706,7 @@ checksum = "dcf29e94d6d243368b7a56caa16bc213e4f9f8ed38c4d9557069527b5d5281ca"
dependencies = [ dependencies = [
"bitflags 2.9.0", "bitflags 2.9.0",
"gpu-descriptor-types", "gpu-descriptor-types",
"hashbrown 0.15.2", "hashbrown",
] ]
[[package]] [[package]]
@ -3078,6 +3079,7 @@ checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"crunchy", "crunchy",
"num-traits",
] ]
[[package]] [[package]]
@ -3095,16 +3097,6 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "hashbrown"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
dependencies = [
"ahash",
"serde",
]
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.15.2" version = "0.15.2"
@ -3112,6 +3104,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
dependencies = [ dependencies = [
"foldhash", "foldhash",
"serde",
] ]
[[package]] [[package]]
@ -3920,7 +3913,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown 0.15.2", "hashbrown",
] ]
[[package]] [[package]]
@ -4712,22 +4705,25 @@ checksum = "956787520e75e9bd233246045d19f42fb73242759cc57fba9611d940ae96d4b0"
[[package]] [[package]]
name = "naga" name = "naga"
version = "24.0.0" version = "25.0.1"
source = "git+https://github.com/gfx-rs/wgpu?rev=2f255edc60e9669c8c737464c59af10d59a31126#2f255edc60e9669c8c737464c59af10d59a31126" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b977c445f26e49757f9aca3631c3b8b836942cb278d69a92e7b80d3b24da632"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
"bitflags 2.9.0", "bitflags 2.9.0",
"cfg_aliases", "cfg_aliases",
"codespan-reporting", "codespan-reporting",
"hashbrown 0.14.5", "half",
"hashbrown",
"hexf-parse", "hexf-parse",
"indexmap", "indexmap",
"log", "log",
"num-traits",
"once_cell",
"rustc-hash 1.1.0", "rustc-hash 1.1.0",
"spirv", "spirv",
"strum", "strum",
"termcolor",
"thiserror 2.0.9", "thiserror 2.0.9",
"unicode-ident", "unicode-ident",
] ]
@ -8628,15 +8624,17 @@ checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082"
[[package]] [[package]]
name = "wgpu-core" name = "wgpu-core"
version = "24.0.0" version = "25.0.1"
source = "git+https://github.com/gfx-rs/wgpu?rev=2f255edc60e9669c8c737464c59af10d59a31126#2f255edc60e9669c8c737464c59af10d59a31126" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a19813e647da7aa3cdaa84f5846e2c64114970ea7c86b1e6aae8be08091f4bdc"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"bit-set",
"bit-vec", "bit-vec",
"bitflags 2.9.0", "bitflags 2.9.0",
"cfg_aliases", "cfg_aliases",
"document-features", "document-features",
"hashbrown 0.14.5", "hashbrown",
"indexmap", "indexmap",
"log", "log",
"naga", "naga",
@ -8656,32 +8654,36 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-core-deps-apple" name = "wgpu-core-deps-apple"
version = "24.0.0" version = "25.0.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=2f255edc60e9669c8c737464c59af10d59a31126#2f255edc60e9669c8c737464c59af10d59a31126" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfd488b3239b6b7b185c3b045c39ca6bf8af34467a4c5de4e0b1a564135d093d"
dependencies = [ dependencies = [
"wgpu-hal", "wgpu-hal",
] ]
[[package]] [[package]]
name = "wgpu-core-deps-emscripten" name = "wgpu-core-deps-emscripten"
version = "24.0.0" version = "25.0.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=2f255edc60e9669c8c737464c59af10d59a31126#2f255edc60e9669c8c737464c59af10d59a31126" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f09ad7aceb3818e52539acc679f049d3475775586f3f4e311c30165cf2c00445"
dependencies = [ dependencies = [
"wgpu-hal", "wgpu-hal",
] ]
[[package]] [[package]]
name = "wgpu-core-deps-windows-linux-android" name = "wgpu-core-deps-windows-linux-android"
version = "24.0.0" version = "25.0.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=2f255edc60e9669c8c737464c59af10d59a31126#2f255edc60e9669c8c737464c59af10d59a31126" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cba5fb5f7f9c98baa7c889d444f63ace25574833df56f5b817985f641af58e46"
dependencies = [ dependencies = [
"wgpu-hal", "wgpu-hal",
] ]
[[package]] [[package]]
name = "wgpu-hal" name = "wgpu-hal"
version = "24.0.0" version = "25.0.1"
source = "git+https://github.com/gfx-rs/wgpu?rev=2f255edc60e9669c8c737464c59af10d59a31126#2f255edc60e9669c8c737464c59af10d59a31126" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb7c4a1dc42ff14c23c9b11ebf1ee85cde661a9b1cf0392f79c1faca5bc559fb"
dependencies = [ dependencies = [
"android_system_properties", "android_system_properties",
"arrayvec", "arrayvec",
@ -8690,6 +8692,7 @@ dependencies = [
"bitflags 2.9.0", "bitflags 2.9.0",
"block", "block",
"bytemuck", "bytemuck",
"cfg-if",
"cfg_aliases", "cfg_aliases",
"core-graphics-types", "core-graphics-types",
"glow", "glow",
@ -8697,7 +8700,7 @@ dependencies = [
"gpu-alloc", "gpu-alloc",
"gpu-allocator", "gpu-allocator",
"gpu-descriptor", "gpu-descriptor",
"hashbrown 0.14.5", "hashbrown",
"js-sys", "js-sys",
"khronos-egl", "khronos-egl",
"libc", "libc",
@ -8707,7 +8710,6 @@ dependencies = [
"naga", "naga",
"ndk-sys 0.5.0+25.2.9519653", "ndk-sys 0.5.0+25.2.9519653",
"objc", "objc",
"once_cell",
"ordered-float", "ordered-float",
"parking_lot", "parking_lot",
"profiling", "profiling",
@ -8724,10 +8726,12 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-types" name = "wgpu-types"
version = "24.0.0" version = "25.0.0"
source = "git+https://github.com/gfx-rs/wgpu?rev=2f255edc60e9669c8c737464c59af10d59a31126#2f255edc60e9669c8c737464c59af10d59a31126" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aa49460c2a8ee8edba3fca54325540d904dd85b2e086ada762767e17d06e8bc"
dependencies = [ dependencies = [
"bitflags 2.9.0", "bitflags 2.9.0",
"bytemuck",
"js-sys", "js-sys",
"log", "log",
"serde", "serde",

View file

@ -167,8 +167,8 @@ webpki-roots = "0.26"
webrender = { git = "https://github.com/servo/webrender", branch = "0.66", features = ["capture"] } webrender = { git = "https://github.com/servo/webrender", branch = "0.66", features = ["capture"] }
webrender_api = { git = "https://github.com/servo/webrender", branch = "0.66" } webrender_api = { git = "https://github.com/servo/webrender", branch = "0.66" }
webxr-api = { path = "components/shared/webxr" } webxr-api = { path = "components/shared/webxr" }
wgpu-core = { git = "https://github.com/gfx-rs/wgpu", rev = "2f255edc60e9669c8c737464c59af10d59a31126" } wgpu-core = "25"
wgpu-types = { git = "https://github.com/gfx-rs/wgpu", rev = "2f255edc60e9669c8c737464c59af10d59a31126" } wgpu-types = "25"
winapi = "0.3" winapi = "0.3"
windows-sys = "0.59" windows-sys = "0.59"
wio = "0.2" wio = "0.2"

View file

@ -6,8 +6,9 @@ use std::rc::Rc;
use dom_struct::dom_struct; use dom_struct::dom_struct;
use js::jsapi::{Heap, JSObject}; use js::jsapi::{Heap, JSObject};
use webgpu_traits::{WebGPU, WebGPUAdapter, WebGPUDeviceResponse, WebGPURequest}; use webgpu_traits::{
use wgpu_core::instance::RequestDeviceError; RequestDeviceError, WebGPU, WebGPUAdapter, WebGPUDeviceResponse, WebGPURequest,
};
use wgpu_types::{self, MemoryHints}; use wgpu_types::{self, MemoryHints};
use super::gpusupportedfeatures::GPUSupportedFeatures; use super::gpusupportedfeatures::GPUSupportedFeatures;
@ -146,6 +147,7 @@ impl GPUAdapterMethods<crate::DomTypeHolder> for GPUAdapter {
required_limits, required_limits,
label: Some(descriptor.parent.label.to_string()), label: Some(descriptor.parent.label.to_string()),
memory_hints: MemoryHints::MemoryUsage, memory_hints: MemoryHints::MemoryUsage,
trace: wgpu_types::Trace::Off,
}; };
let device_id = self.global().wgpu_id_hub().create_device_id(); let device_id = self.global().wgpu_id_hub().create_device_id();
let queue_id = self.global().wgpu_id_hub().create_queue_id(); let queue_id = self.global().wgpu_id_hub().create_queue_id();
@ -206,6 +208,7 @@ impl GPUAdapterMethods<crate::DomTypeHolder> for GPUAdapter {
} }
impl RoutedPromiseListener<WebGPUDeviceResponse> for GPUAdapter { impl RoutedPromiseListener<WebGPUDeviceResponse> for GPUAdapter {
/// <https://www.w3.org/TR/webgpu/#dom-gpuadapter-requestdevice>
fn handle_response( fn handle_response(
&self, &self,
response: WebGPUDeviceResponse, response: WebGPUDeviceResponse,
@ -213,6 +216,7 @@ impl RoutedPromiseListener<WebGPUDeviceResponse> for GPUAdapter {
can_gc: CanGc, can_gc: CanGc,
) { ) {
match response { match response {
// 3.1 Let device be a new device with the capabilities described by descriptor.
(device_id, queue_id, Ok(descriptor)) => { (device_id, queue_id, Ok(descriptor)) => {
let device = GPUDevice::new( let device = GPUDevice::new(
&self.global(), &self.global(),
@ -229,14 +233,24 @@ impl RoutedPromiseListener<WebGPUDeviceResponse> for GPUAdapter {
self.global().add_gpu_device(&device); self.global().add_gpu_device(&device);
promise.resolve_native(&device, can_gc); promise.resolve_native(&device, can_gc);
}, },
// 1. If features are not supported reject promise with a TypeError.
(_, _, Err(RequestDeviceError::UnsupportedFeature(f))) => promise.reject_error( (_, _, Err(RequestDeviceError::UnsupportedFeature(f))) => promise.reject_error(
Error::Type(RequestDeviceError::UnsupportedFeature(f).to_string()), Error::Type(
wgpu_core::instance::RequestDeviceError::UnsupportedFeature(f).to_string(),
),
can_gc, can_gc,
), ),
(_, _, Err(RequestDeviceError::LimitsExceeded(_))) => { // 2. If limits are not supported reject promise with an OperationError.
(_, _, Err(RequestDeviceError::LimitsExceeded(l))) => {
warn!(
"{}",
wgpu_core::instance::RequestDeviceError::LimitsExceeded(l)
);
promise.reject_error(Error::Operation, can_gc) promise.reject_error(Error::Operation, can_gc)
}, },
(device_id, queue_id, Err(e)) => { // 3. user agent otherwise cannot fulfill the request
(device_id, queue_id, Err(RequestDeviceError::Other(e))) => {
// 1. Let device be a new device.
let device = GPUDevice::new( let device = GPUDevice::new(
&self.global(), &self.global(),
self.channel.clone(), self.channel.clone(),
@ -249,7 +263,8 @@ impl RoutedPromiseListener<WebGPUDeviceResponse> for GPUAdapter {
String::new(), String::new(),
can_gc, can_gc,
); );
device.lose(GPUDeviceLostReason::Unknown, e.to_string(), can_gc); // 2. Lose the device(device, "unknown").
device.lose(GPUDeviceLostReason::Unknown, e, can_gc);
promise.resolve_native(&device, can_gc); promise.resolve_native(&device, can_gc);
}, },
} }

View file

@ -20,7 +20,7 @@ pub use wgpu_core::id::{
ComputePassEncoderId as ComputePassId, RenderPassEncoderId as RenderPassId, ComputePassEncoderId as ComputePassId, RenderPassEncoderId as RenderPassId,
}; };
use wgpu_core::id::{ComputePipelineId, DeviceId, QueueId, RenderPipelineId}; use wgpu_core::id::{ComputePipelineId, DeviceId, QueueId, RenderPipelineId};
use wgpu_core::instance::{RequestAdapterError, RequestDeviceError}; use wgpu_core::instance::FailedLimit;
use wgpu_core::pipeline::CreateShaderModuleError; use wgpu_core::pipeline::CreateShaderModuleError;
use wgpu_types::{AdapterInfo, DeviceDescriptor, Features, Limits, TextureFormat}; use wgpu_types::{AdapterInfo, DeviceDescriptor, Features, Limits, TextureFormat};
@ -31,7 +31,7 @@ pub use crate::render_commands::*;
pub const PRESENTATION_BUFFER_COUNT: usize = 10; pub const PRESENTATION_BUFFER_COUNT: usize = 10;
pub type WebGPUAdapterResponse = Option<Result<Adapter, RequestAdapterError>>; pub type WebGPUAdapterResponse = Option<Result<Adapter, String>>;
pub type WebGPUComputePipelineResponse = Result<Pipeline<ComputePipelineId>, Error>; pub type WebGPUComputePipelineResponse = Result<Pipeline<ComputePipelineId>, Error>;
pub type WebGPUPoppedErrorScopeResponse = Result<Option<Error>, PopError>; pub type WebGPUPoppedErrorScopeResponse = Result<Option<Error>, PopError>;
pub type WebGPURenderPipelineResponse = Result<Pipeline<RenderPipelineId>, Error>; pub type WebGPURenderPipelineResponse = Result<Pipeline<RenderPipelineId>, Error>;
@ -142,3 +142,24 @@ pub type WebGPUDeviceResponse = (
WebGPUQueue, WebGPUQueue,
Result<DeviceDescriptor<Option<String>>, RequestDeviceError>, Result<DeviceDescriptor<Option<String>>, RequestDeviceError>,
); );
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum RequestDeviceError {
LimitsExceeded(FailedLimit),
UnsupportedFeature(Features),
Other(String),
}
impl From<wgpu_core::instance::RequestDeviceError> for RequestDeviceError {
fn from(value: wgpu_core::instance::RequestDeviceError) -> Self {
match value {
wgpu_core::instance::RequestDeviceError::LimitsExceeded(failed_limit) => {
RequestDeviceError::LimitsExceeded(failed_limit)
},
wgpu_core::instance::RequestDeviceError::UnsupportedFeature(features) => {
RequestDeviceError::UnsupportedFeature(features)
},
e => RequestDeviceError::Other(e.to_string()),
}
}
}

View file

@ -664,7 +664,8 @@ impl WGPU {
limits, limits,
channel: WebGPU(self.sender.clone()), channel: WebGPU(self.sender.clone()),
} }
}); })
.map_err(|err| err.to_string());
if let Err(e) = sender.send(Some(response)) { if let Err(e) = sender.send(Some(response)) {
warn!( warn!(
@ -686,6 +687,7 @@ impl WGPU {
required_features: descriptor.required_features, required_features: descriptor.required_features,
required_limits: descriptor.required_limits.clone(), required_limits: descriptor.required_limits.clone(),
memory_hints: MemoryHints::MemoryUsage, memory_hints: MemoryHints::MemoryUsage,
trace: wgpu_types::Trace::Off,
}; };
let global = &self.global; let global = &self.global;
let device = WebGPUDevice(device_id); let device = WebGPUDevice(device_id);
@ -694,7 +696,6 @@ impl WGPU {
.adapter_request_device( .adapter_request_device(
adapter_id.0, adapter_id.0,
&desc, &desc,
None,
Some(device_id), Some(device_id),
Some(queue_id), Some(queue_id),
) )
@ -733,7 +734,8 @@ impl WGPU {
}); });
global.device_set_device_lost_closure(device_id, callback); global.device_set_device_lost_closure(device_id, callback);
descriptor descriptor
}); })
.map_err(Into::into);
if let Err(e) = sender.send((device, queue, result)) { if let Err(e) = sender.send((device, queue, result)) {
warn!( warn!(
"Failed to send response to WebGPURequest::RequestDevice ({})", "Failed to send response to WebGPURequest::RequestDevice ({})",

View file

@ -118,7 +118,6 @@ skip = [
"foreign-types-shared", "foreign-types-shared",
"metal", "metal",
"windows-core", "windows-core",
"hashbrown",
# wgpu-hal depends on 0.5.0. # wgpu-hal depends on 0.5.0.
"ndk-sys", "ndk-sys",
@ -163,4 +162,4 @@ skip = [
# github.com organizations to allow git sources for # github.com organizations to allow git sources for
[sources.allow-org] [sources.allow-org]
github = ["pcwalton", "servo", "gfx-rs"] github = ["pcwalton", "servo"]

View file

@ -673,6 +673,12 @@ class MachCommands(CommandBase):
# Write the file out again # Write the file out again
with open(cts_html, 'w') as file: with open(cts_html, 'w') as file:
file.write(filedata) file.write(filedata)
logger = path.join(clone_dir, "out-wpt", "common/internal/logging/test_case_recorder.js")
with open(logger, 'r') as file:
filedata = file.read()
filedata.replace("info(ex) {", "info(ex) {return;")
with open(logger, 'w') as file:
file.write(filedata)
# copy # copy
delete(path.join(tdir, "webgpu")) delete(path.join(tdir, "webgpu"))
shutil.copytree(path.join(clone_dir, "out-wpt"), path.join(tdir, "webgpu")) shutil.copytree(path.join(clone_dir, "out-wpt"), path.join(tdir, "webgpu"))

View file

@ -582,7 +582,7 @@
[] []
], ],
"test_case_recorder.js": [ "test_case_recorder.js": [
"5b2a4e8b8ef259763c331bf7e4f8421d1eb43a70", "a37c61a4a6bae52828c0e2747e3eacd0e1e6f03d",
[] []
] ]
}, },

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,3 @@
[canvas_colorspace_rgba16float.https.html] [canvas_colorspace_rgba16float.https.html]
expected: expected:
if os == "linux" and not debug: FAIL if os == "linux" and not debug: PASS

View file

@ -1,6 +1,3 @@
[canvas_complex_rgba8unorm_copy.https.html] [canvas_complex_rgba8unorm_copy.https.html]
expected: expected:
if os == "win": TIMEOUT
if os == "linux" and debug: TIMEOUT
if os == "linux" and not debug: FAIL if os == "linux" and not debug: FAIL
if os == "mac": TIMEOUT

View file

@ -1,3 +1,3 @@
[canvas_complex_rgba8unorm_store.https.html] [canvas_complex_rgba8unorm_store.https.html]
expected: expected:
if os == "linux" and not debug: PASS if os == "linux" and not debug: [PASS, FAIL]

View file

@ -1,3 +1,3 @@
[canvas_composite_alpha_bgra8unorm_opaque_copy.https.html] [canvas_composite_alpha_bgra8unorm_opaque_copy.https.html]
expected: expected:
if os == "linux" and not debug: PASS if os == "linux" and not debug: [CRASH, PASS, FAIL]

View file

@ -1,2 +1,6 @@
[canvas_composite_alpha_bgra8unorm_opaque_draw.https.html] [canvas_composite_alpha_bgra8unorm_opaque_draw.https.html]
expected: PASS expected:
if os == "win": PASS
if os == "linux" and debug: PASS
if os == "linux" and not debug: [PASS, FAIL]
if os == "mac": PASS

View file

@ -1,3 +1,3 @@
[canvas_composite_alpha_rgba8unorm_opaque_draw.https.html] [canvas_composite_alpha_rgba8unorm_opaque_draw.https.html]
expected: expected:
if os == "linux" and not debug: PASS if os == "linux" and not debug: [PASS, FAIL]

View file

@ -1,3 +1,3 @@
[canvas_composite_alpha_rgba8unorm_premultiplied_copy.https.html] [canvas_composite_alpha_rgba8unorm_premultiplied_copy.https.html]
expected: expected:
if os == "linux" and not debug: [PASS, FAIL] if os == "linux" and not debug: [CRASH, FAIL]

View file

@ -1,3 +1,3 @@
[canvas_composite_alpha_rgba8unorm_premultiplied_draw.https.html] [canvas_composite_alpha_rgba8unorm_premultiplied_draw.https.html]
expected: expected:
if os == "linux" and not debug: [CRASH, PASS] if os == "linux" and not debug: [CRASH, PASS, FAIL]

View file

@ -1,3 +1,3 @@
[canvas_image_rendering.https.html] [canvas_image_rendering.https.html]
expected: expected:
if os == "linux" and not debug: PASS if os == "linux" and not debug: [CRASH, PASS]

View file

@ -108,6 +108,7 @@ export class TestCaseRecorder {
} }
info(ex) { info(ex) {
return;
// We need this to use the lowest LogSeverity so it doesn't override the current severity for this test case. // We need this to use the lowest LogSeverity so it doesn't override the current severity for this test case.
this.logImpl(LogSeverity.NotRun, 'INFO', ex); this.logImpl(LogSeverity.NotRun, 'INFO', ex);
} }