Skip to content

Commit e10e179

Browse files
committed
remove DeviceError::ResourceCreationFailed
1 parent 918fdc9 commit e10e179

File tree

7 files changed

+6
-14
lines changed

7 files changed

+6
-14
lines changed

wgpu-core/src/device/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,17 +336,14 @@ pub enum DeviceError {
336336
Lost,
337337
#[error("Not enough memory left.")]
338338
OutOfMemory,
339-
#[error("Creation of a resource failed for a reason other than running out of memory.")]
340-
ResourceCreationFailed,
341339
#[error(transparent)]
342340
DeviceMismatch(#[from] Box<DeviceMismatch>),
343341
}
344342

345343
impl WebGpuError for DeviceError {
346344
fn webgpu_error_type(&self) -> ErrorType {
347345
match self {
348-
DeviceError::DeviceMismatch(e) => e.webgpu_error_type(),
349-
Self::ResourceCreationFailed => ErrorType::OutOfMemory,
346+
Self::DeviceMismatch(e) => e.webgpu_error_type(),
350347
Self::Lost => ErrorType::DeviceLost,
351348
Self::OutOfMemory => ErrorType::OutOfMemory,
352349
}
@@ -361,7 +358,6 @@ impl DeviceError {
361358
match error {
362359
hal::DeviceError::Lost => Self::Lost,
363360
hal::DeviceError::OutOfMemory => Self::OutOfMemory,
364-
hal::DeviceError::ResourceCreationFailed => Self::ResourceCreationFailed,
365361
hal::DeviceError::Unexpected => Self::Lost,
366362
}
367363
}

wgpu-core/src/device/queue.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ impl Drop for Queue {
221221
self.device.handle_hal_error(e); // will lose the device
222222
break;
223223
}
224-
hal::DeviceError::ResourceCreationFailed => unreachable!(),
225224
hal::DeviceError::Unexpected => {
226225
panic!(
227226
"We ran into an unexpected error while waiting on the last successful submission to complete!"

wgpu-core/src/device/resource.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,6 @@ impl Device {
378378
match error {
379379
hal::DeviceError::OutOfMemory
380380
| hal::DeviceError::Lost
381-
| hal::DeviceError::ResourceCreationFailed
382381
| hal::DeviceError::Unexpected => {
383382
self.lose(&error.to_string());
384383
}

wgpu-hal/src/gles/adapter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ impl crate::Adapter for super::Adapter {
996996
{
997997
Some(unsafe {
998998
Self::create_shader_clear_program(gl, self.shared.es)
999-
.ok_or(crate::DeviceError::ResourceCreationFailed)?
999+
.ok_or(crate::DeviceError::Lost)?
10001000
})
10011001
} else {
10021002
// If we don't need the workaround, don't waste time and resources compiling the clear program

wgpu-hal/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,6 @@ pub enum DeviceError {
375375
OutOfMemory,
376376
#[error("Device is lost")]
377377
Lost,
378-
#[error("Creation of a resource failed for a reason other than running out of memory.")]
379-
ResourceCreationFailed,
380378
#[error("Unexpected error variant (driver implementation is at fault)")]
381379
Unexpected,
382380
}

wgpu-hal/src/metal/device.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,7 @@ impl crate::Device for super::Device {
14631463
Some(counter) => counter,
14641464
None => {
14651465
log::error!("Failed to obtain timestamp counter set.");
1466-
return Err(crate::DeviceError::ResourceCreationFailed);
1466+
return Err(crate::DeviceError::Unexpected);
14671467
}
14681468
};
14691469
csb_desc.set_counter_set(timestamp_counter);
@@ -1473,7 +1473,7 @@ impl crate::Device for super::Device {
14731473
Ok(buffer) => buffer,
14741474
Err(err) => {
14751475
log::error!("Failed to create counter sample buffer: {:?}", err);
1476-
return Err(crate::DeviceError::ResourceCreationFailed);
1476+
return Err(crate::DeviceError::Unexpected);
14771477
}
14781478
};
14791479

wgpu-hal/src/vulkan/device.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ impl super::Device {
752752
.contains(wgt::Features::VULKAN_EXTERNAL_MEMORY_WIN32)
753753
{
754754
log::error!("Vulkan driver does not support VK_KHR_external_memory_win32");
755-
return Err(crate::DeviceError::ResourceCreationFailed);
755+
return Err(crate::DeviceError::Unexpected);
756756
}
757757

758758
let mut external_memory_image_info = vk::ExternalMemoryImageCreateInfo::default()
@@ -780,7 +780,7 @@ impl super::Device {
780780
image.requirements.memory_type_bits,
781781
vk::MemoryPropertyFlags::DEVICE_LOCAL,
782782
)
783-
.ok_or(crate::DeviceError::ResourceCreationFailed)?;
783+
.ok_or(crate::DeviceError::Unexpected)?;
784784

785785
let memory_allocate_info = vk::MemoryAllocateInfo::default()
786786
.allocation_size(image.requirements.size)

0 commit comments

Comments
 (0)