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

View file

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

View file

@ -6,8 +6,9 @@ use std::rc::Rc;
use dom_struct::dom_struct;
use js::jsapi::{Heap, JSObject};
use webgpu_traits::{WebGPU, WebGPUAdapter, WebGPUDeviceResponse, WebGPURequest};
use wgpu_core::instance::RequestDeviceError;
use webgpu_traits::{
RequestDeviceError, WebGPU, WebGPUAdapter, WebGPUDeviceResponse, WebGPURequest,
};
use wgpu_types::{self, MemoryHints};
use super::gpusupportedfeatures::GPUSupportedFeatures;
@ -146,6 +147,7 @@ impl GPUAdapterMethods<crate::DomTypeHolder> for GPUAdapter {
required_limits,
label: Some(descriptor.parent.label.to_string()),
memory_hints: MemoryHints::MemoryUsage,
trace: wgpu_types::Trace::Off,
};
let device_id = self.global().wgpu_id_hub().create_device_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 {
/// <https://www.w3.org/TR/webgpu/#dom-gpuadapter-requestdevice>
fn handle_response(
&self,
response: WebGPUDeviceResponse,
@ -213,6 +216,7 @@ impl RoutedPromiseListener<WebGPUDeviceResponse> for GPUAdapter {
can_gc: CanGc,
) {
match response {
// 3.1 Let device be a new device with the capabilities described by descriptor.
(device_id, queue_id, Ok(descriptor)) => {
let device = GPUDevice::new(
&self.global(),
@ -229,14 +233,24 @@ impl RoutedPromiseListener<WebGPUDeviceResponse> for GPUAdapter {
self.global().add_gpu_device(&device);
promise.resolve_native(&device, can_gc);
},
// 1. If features are not supported reject promise with a TypeError.
(_, _, 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,
),
(_, _, 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)
},
(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(
&self.global(),
self.channel.clone(),
@ -249,7 +263,8 @@ impl RoutedPromiseListener<WebGPUDeviceResponse> for GPUAdapter {
String::new(),
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);
},
}

View file

@ -20,7 +20,7 @@ pub use wgpu_core::id::{
ComputePassEncoderId as ComputePassId, RenderPassEncoderId as RenderPassId,
};
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_types::{AdapterInfo, DeviceDescriptor, Features, Limits, TextureFormat};
@ -31,7 +31,7 @@ pub use crate::render_commands::*;
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 WebGPUPoppedErrorScopeResponse = Result<Option<Error>, PopError>;
pub type WebGPURenderPipelineResponse = Result<Pipeline<RenderPipelineId>, Error>;
@ -142,3 +142,24 @@ pub type WebGPUDeviceResponse = (
WebGPUQueue,
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,
channel: WebGPU(self.sender.clone()),
}
});
})
.map_err(|err| err.to_string());
if let Err(e) = sender.send(Some(response)) {
warn!(
@ -686,6 +687,7 @@ impl WGPU {
required_features: descriptor.required_features,
required_limits: descriptor.required_limits.clone(),
memory_hints: MemoryHints::MemoryUsage,
trace: wgpu_types::Trace::Off,
};
let global = &self.global;
let device = WebGPUDevice(device_id);
@ -694,7 +696,6 @@ impl WGPU {
.adapter_request_device(
adapter_id.0,
&desc,
None,
Some(device_id),
Some(queue_id),
)
@ -733,7 +734,8 @@ impl WGPU {
});
global.device_set_device_lost_closure(device_id, callback);
descriptor
});
})
.map_err(Into::into);
if let Err(e) = sender.send((device, queue, result)) {
warn!(
"Failed to send response to WebGPURequest::RequestDevice ({})",

View file

@ -118,7 +118,6 @@ skip = [
"foreign-types-shared",
"metal",
"windows-core",
"hashbrown",
# wgpu-hal depends on 0.5.0.
"ndk-sys",
@ -163,4 +162,4 @@ skip = [
# github.com organizations to allow git sources for
[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
with open(cts_html, 'w') as file:
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
delete(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": [
"5b2a4e8b8ef259763c331bf7e4f8421d1eb43a70",
"a37c61a4a6bae52828c0e2747e3eacd0e1e6f03d",
[]
]
},

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,3 @@
[canvas_colorspace_rgba16float.https.html]
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]
expected:
if os == "win": TIMEOUT
if os == "linux" and debug: TIMEOUT
if os == "linux" and not debug: FAIL
if os == "mac": TIMEOUT

View file

@ -1,3 +1,3 @@
[canvas_complex_rgba8unorm_store.https.html]
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]
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]
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]
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]
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]
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]
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) {
return;
// 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);
}