mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
remove reason from ErrorType::DeviceLost since it's always "unknown" and users should register the lost callback instead
This commit is contained in:
parent
25d75e2a02
commit
918fdc98b5
@ -188,7 +188,7 @@ impl GPUError {
|
||||
fn from_webgpu(e: impl WebGpuError) -> Self {
|
||||
match e.webgpu_error_type() {
|
||||
ErrorType::Internal => GPUError::Internal,
|
||||
ErrorType::DeviceLost { reason } => GPUError::Lost(reason.into()),
|
||||
ErrorType::DeviceLost => GPUError::Lost(GPUDeviceLostReason::Unknown), // TODO: this variant should be ignored, register the lost callback instead.
|
||||
ErrorType::OutOfMemory => GPUError::OutOfMemory,
|
||||
ErrorType::Validation => GPUError::Validation(fmt_err(&e)),
|
||||
}
|
||||
|
||||
@ -347,9 +347,7 @@ impl WebGpuError for DeviceError {
|
||||
match self {
|
||||
DeviceError::DeviceMismatch(e) => e.webgpu_error_type(),
|
||||
Self::ResourceCreationFailed => ErrorType::OutOfMemory,
|
||||
Self::Lost => ErrorType::DeviceLost {
|
||||
reason: DeviceLostReason::Unknown,
|
||||
},
|
||||
Self::Lost => ErrorType::DeviceLost,
|
||||
Self::OutOfMemory => ErrorType::OutOfMemory,
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
//! Shared types for WebGPU errors. See also:
|
||||
//! <https://gpuweb.github.io/gpuweb/#errors-and-debugging>
|
||||
|
||||
use crate::DeviceLostReason;
|
||||
|
||||
/// A classification of WebGPU error for implementers of the WebGPU API to use in their own error
|
||||
/// layer(s).
|
||||
///
|
||||
@ -30,10 +28,7 @@ pub enum ErrorType {
|
||||
/// property should be `resolve`d.
|
||||
///
|
||||
/// [`GPUDevice.lost`]: https://www.w3.org/TR/webgpu/#dom-gpudevice-lost
|
||||
DeviceLost {
|
||||
/// The reason the device was lost.
|
||||
reason: DeviceLostReason,
|
||||
},
|
||||
DeviceLost,
|
||||
}
|
||||
|
||||
/// A trait for querying the [`ErrorType`] classification of an error.
|
||||
|
||||
@ -7743,8 +7743,7 @@ mod send_sync {
|
||||
impl<T> WasmNotSync for T {}
|
||||
}
|
||||
|
||||
/// Corresponds to a [`GPUDeviceLostReason`]; usually seen by implementers of WebGPU with
|
||||
/// [`error::ErrorType::DeviceLost::reason`].
|
||||
/// Corresponds to a [`GPUDeviceLostReason`].
|
||||
///
|
||||
/// [`GPUDeviceLostReason`]: https://www.w3.org/TR/webgpu/#enumdef-gpudevicelostreason
|
||||
#[repr(u8)]
|
||||
|
||||
@ -335,7 +335,7 @@ impl ContextWgpuCore {
|
||||
description,
|
||||
}
|
||||
}
|
||||
ErrorType::DeviceLost { reason: _ } => return,
|
||||
ErrorType::DeviceLost => return, // will be surfaced via callback
|
||||
};
|
||||
sink.handle_error(error);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user