mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
rename WrongDevice
to DeviceMismatch
This commit is contained in:
parent
ce716adb5e
commit
c01a1335aa
@ -385,14 +385,14 @@ fn map_buffer<A: HalApi>(
|
||||
pub struct InvalidDevice;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct WrongDevice {
|
||||
pub struct DeviceMismatch {
|
||||
pub(super) res: ResourceErrorIdent,
|
||||
pub(super) res_device: ResourceErrorIdent,
|
||||
pub(super) target: Option<ResourceErrorIdent>,
|
||||
pub(super) target_device: ResourceErrorIdent,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for WrongDevice {
|
||||
impl std::fmt::Display for DeviceMismatch {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
|
||||
write!(
|
||||
f,
|
||||
@ -406,7 +406,7 @@ impl std::fmt::Display for WrongDevice {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for WrongDevice {}
|
||||
impl std::error::Error for DeviceMismatch {}
|
||||
|
||||
#[derive(Clone, Debug, Error)]
|
||||
#[non_exhaustive]
|
||||
@ -422,7 +422,7 @@ pub enum DeviceError {
|
||||
#[error("QueueId is invalid")]
|
||||
InvalidQueueId,
|
||||
#[error(transparent)]
|
||||
WrongDevice(#[from] Box<WrongDevice>),
|
||||
DeviceMismatch(#[from] Box<DeviceMismatch>),
|
||||
}
|
||||
|
||||
impl From<hal::DeviceError> for DeviceError {
|
||||
|
@ -16,7 +16,7 @@ pub enum PipelineCacheValidationError {
|
||||
#[error("The pipeline cacha data was out of date and so cannot be safely used")]
|
||||
Outdated,
|
||||
#[error("The cache data was created for a different device")]
|
||||
WrongDevice,
|
||||
DeviceMismatch,
|
||||
#[error("Pipeline cacha data was created for a future version of wgpu")]
|
||||
Unsupported,
|
||||
}
|
||||
@ -26,7 +26,7 @@ impl PipelineCacheValidationError {
|
||||
/// That is, is there a mistake in user code interacting with the cache
|
||||
pub fn was_avoidable(&self) -> bool {
|
||||
match self {
|
||||
PipelineCacheValidationError::WrongDevice => true,
|
||||
PipelineCacheValidationError::DeviceMismatch => true,
|
||||
PipelineCacheValidationError::Truncated
|
||||
| PipelineCacheValidationError::Unsupported
|
||||
| PipelineCacheValidationError::Extended
|
||||
@ -57,10 +57,10 @@ pub fn validate_pipeline_cache<'d>(
|
||||
return Err(PipelineCacheValidationError::Outdated);
|
||||
}
|
||||
if header.backend != adapter.backend as u8 {
|
||||
return Err(PipelineCacheValidationError::WrongDevice);
|
||||
return Err(PipelineCacheValidationError::DeviceMismatch);
|
||||
}
|
||||
if header.adapter_key != adapter_key {
|
||||
return Err(PipelineCacheValidationError::WrongDevice);
|
||||
return Err(PipelineCacheValidationError::DeviceMismatch);
|
||||
}
|
||||
if header.validation_key != validation_key {
|
||||
// If the validation key is wrong, that means that this device has changed
|
||||
@ -420,7 +420,7 @@ mod tests {
|
||||
];
|
||||
let cache = cache.into_iter().flatten().collect::<Vec<u8>>();
|
||||
let validation_result = super::validate_pipeline_cache(&cache, &ADAPTER, VALIDATION_KEY);
|
||||
assert_eq!(validation_result, Err(E::WrongDevice));
|
||||
assert_eq!(validation_result, Err(E::DeviceMismatch));
|
||||
}
|
||||
#[test]
|
||||
fn wrong_adapter() {
|
||||
@ -436,7 +436,7 @@ mod tests {
|
||||
];
|
||||
let cache = cache.into_iter().flatten().collect::<Vec<u8>>();
|
||||
let validation_result = super::validate_pipeline_cache(&cache, &ADAPTER, VALIDATION_KEY);
|
||||
assert_eq!(validation_result, Err(E::WrongDevice));
|
||||
assert_eq!(validation_result, Err(E::DeviceMismatch));
|
||||
}
|
||||
#[test]
|
||||
fn wrong_validation() {
|
||||
|
@ -3,8 +3,8 @@ use crate::device::trace;
|
||||
use crate::{
|
||||
binding_model::BindGroup,
|
||||
device::{
|
||||
queue, resource::DeferredDestroy, BufferMapPendingClosure, Device, DeviceError, HostMap,
|
||||
MissingDownlevelFlags, MissingFeatures, WrongDevice,
|
||||
queue, resource::DeferredDestroy, BufferMapPendingClosure, Device, DeviceError,
|
||||
DeviceMismatch, HostMap, MissingDownlevelFlags, MissingFeatures,
|
||||
},
|
||||
global::Global,
|
||||
hal_api::HalApi,
|
||||
@ -162,7 +162,7 @@ pub(crate) trait ParentDevice<A: HalApi>: Resource {
|
||||
Arc::ptr_eq(self.device(), other.device())
|
||||
.then_some(())
|
||||
.ok_or_else(|| {
|
||||
DeviceError::WrongDevice(Box::new(WrongDevice {
|
||||
DeviceError::DeviceMismatch(Box::new(DeviceMismatch {
|
||||
res: self.error_ident(),
|
||||
res_device: self.device().error_ident(),
|
||||
target: Some(other.error_ident()),
|
||||
@ -175,7 +175,7 @@ pub(crate) trait ParentDevice<A: HalApi>: Resource {
|
||||
Arc::ptr_eq(self.device(), device)
|
||||
.then_some(())
|
||||
.ok_or_else(|| {
|
||||
DeviceError::WrongDevice(Box::new(WrongDevice {
|
||||
DeviceError::DeviceMismatch(Box::new(DeviceMismatch {
|
||||
res: self.error_ident(),
|
||||
res_device: self.device().error_ident(),
|
||||
target: None,
|
||||
|
Loading…
Reference in New Issue
Block a user