mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-21 22:33:49 +00:00
add an Unexpected
variant to DeviceError
This commit is contained in:
parent
24134e049f
commit
2c31414517
@ -404,6 +404,7 @@ impl From<hal::DeviceError> for DeviceError {
|
||||
hal::DeviceError::Lost => DeviceError::Lost,
|
||||
hal::DeviceError::OutOfMemory => DeviceError::OutOfMemory,
|
||||
hal::DeviceError::ResourceCreationFailed => DeviceError::ResourceCreationFailed,
|
||||
hal::DeviceError::Unexpected => DeviceError::Lost,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -342,6 +342,7 @@ impl Adapter {
|
||||
hal::DeviceError::Lost => RequestDeviceError::DeviceLost,
|
||||
hal::DeviceError::OutOfMemory => RequestDeviceError::OutOfMemory,
|
||||
hal::DeviceError::ResourceCreationFailed => RequestDeviceError::Internal,
|
||||
hal::DeviceError::Unexpected => RequestDeviceError::DeviceLost,
|
||||
})?;
|
||||
|
||||
self.create_device_and_queue_from_hal(open, desc, instance_flags, trace_path)
|
||||
|
@ -314,6 +314,8 @@ pub enum DeviceError {
|
||||
Lost,
|
||||
#[error("Creation of a resource failed for a reason other than running out of memory.")]
|
||||
ResourceCreationFailed,
|
||||
#[error("Unexpected error variant (driver implementation is at fault)")]
|
||||
Unexpected,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq, Error)]
|
||||
|
@ -2559,7 +2559,7 @@ impl From<gpu_descriptor::AllocationError> for crate::DeviceError {
|
||||
}
|
||||
}
|
||||
|
||||
/// We usually map unexpected vulkan errors to the [`crate::DeviceError::Lost`]
|
||||
/// We usually map unexpected vulkan errors to the [`crate::DeviceError::Unexpected`]
|
||||
/// variant to be more robust even in cases where the driver is not
|
||||
/// complying with the spec.
|
||||
///
|
||||
|
@ -1266,14 +1266,14 @@ fn map_pipeline_err(err: vk::Result) -> crate::DeviceError {
|
||||
map_host_device_oom_err(err)
|
||||
}
|
||||
|
||||
/// Returns [`crate::DeviceError::Lost`] or panics if the `internal_error_panic`
|
||||
/// Returns [`crate::DeviceError::Unexpected`] or panics if the `internal_error_panic`
|
||||
/// feature flag is enabled.
|
||||
fn get_unexpected_err(_err: vk::Result) -> crate::DeviceError {
|
||||
#[cfg(feature = "internal_error_panic")]
|
||||
panic!("Unexpected Vulkan error: {_err:?}");
|
||||
|
||||
#[allow(unreachable_code)]
|
||||
crate::DeviceError::Lost
|
||||
crate::DeviceError::Unexpected
|
||||
}
|
||||
|
||||
/// Returns [`crate::DeviceError::OutOfMemory`] or panics if the `oom_panic`
|
||||
|
Loading…
Reference in New Issue
Block a user