Skip to content

Commit 918fdc9

Browse files
committed
remove reason from ErrorType::DeviceLost since it's always "unknown" and users should register the lost callback instead
1 parent 25d75e2 commit 918fdc9

File tree

5 files changed

+5
-13
lines changed

5 files changed

+5
-13
lines changed

deno_webgpu/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ impl GPUError {
188188
fn from_webgpu(e: impl WebGpuError) -> Self {
189189
match e.webgpu_error_type() {
190190
ErrorType::Internal => GPUError::Internal,
191-
ErrorType::DeviceLost { reason } => GPUError::Lost(reason.into()),
191+
ErrorType::DeviceLost => GPUError::Lost(GPUDeviceLostReason::Unknown), // TODO: this variant should be ignored, register the lost callback instead.
192192
ErrorType::OutOfMemory => GPUError::OutOfMemory,
193193
ErrorType::Validation => GPUError::Validation(fmt_err(&e)),
194194
}

wgpu-core/src/device/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,7 @@ impl WebGpuError for DeviceError {
347347
match self {
348348
DeviceError::DeviceMismatch(e) => e.webgpu_error_type(),
349349
Self::ResourceCreationFailed => ErrorType::OutOfMemory,
350-
Self::Lost => ErrorType::DeviceLost {
351-
reason: DeviceLostReason::Unknown,
352-
},
350+
Self::Lost => ErrorType::DeviceLost,
353351
Self::OutOfMemory => ErrorType::OutOfMemory,
354352
}
355353
}

wgpu-types/src/error.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! Shared types for WebGPU errors. See also:
22
//! <https://gpuweb.github.io/gpuweb/#errors-and-debugging>
33
4-
use crate::DeviceLostReason;
5-
64
/// A classification of WebGPU error for implementers of the WebGPU API to use in their own error
75
/// layer(s).
86
///
@@ -30,10 +28,7 @@ pub enum ErrorType {
3028
/// property should be `resolve`d.
3129
///
3230
/// [`GPUDevice.lost`]: https://www.w3.org/TR/webgpu/#dom-gpudevice-lost
33-
DeviceLost {
34-
/// The reason the device was lost.
35-
reason: DeviceLostReason,
36-
},
31+
DeviceLost,
3732
}
3833

3934
/// A trait for querying the [`ErrorType`] classification of an error.

wgpu-types/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7743,8 +7743,7 @@ mod send_sync {
77437743
impl<T> WasmNotSync for T {}
77447744
}
77457745

7746-
/// Corresponds to a [`GPUDeviceLostReason`]; usually seen by implementers of WebGPU with
7747-
/// [`error::ErrorType::DeviceLost::reason`].
7746+
/// Corresponds to a [`GPUDeviceLostReason`].
77487747
///
77497748
/// [`GPUDeviceLostReason`]: https://www.w3.org/TR/webgpu/#enumdef-gpudevicelostreason
77507749
#[repr(u8)]

wgpu/src/backend/wgpu_core.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ impl ContextWgpuCore {
335335
description,
336336
}
337337
}
338-
ErrorType::DeviceLost { reason: _ } => return,
338+
ErrorType::DeviceLost => return, // will be surfaced via callback
339339
};
340340
sink.handle_error(error);
341341
}

0 commit comments

Comments
 (0)