From ad2d797f812dc617d591f4fb94a076fdf343f50f Mon Sep 17 00:00:00 2001 From: teoxoy <28601907+teoxoy@users.noreply.github.com> Date: Fri, 21 Jun 2024 18:05:37 +0200 Subject: [PATCH] move `InvalidQueueId` error variant to top level error types --- wgpu-core/src/device/mod.rs | 2 -- wgpu-core/src/device/queue.rs | 16 ++++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index 51ba2cb8a..855cea1b4 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -415,8 +415,6 @@ pub enum DeviceError { ResourceCreationFailed, #[error("DeviceId is invalid")] InvalidDeviceId, - #[error("QueueId is invalid")] - InvalidQueueId, #[error(transparent)] DeviceMismatch(#[from] Box), } diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index 6a0670dbf..59490de92 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -378,6 +378,8 @@ pub struct InvalidQueue; #[derive(Clone, Debug, Error)] #[non_exhaustive] pub enum QueueWriteError { + #[error("QueueId is invalid")] + InvalidQueueId, #[error(transparent)] Queue(#[from] DeviceError), #[error(transparent)] @@ -391,6 +393,8 @@ pub enum QueueWriteError { #[derive(Clone, Debug, Error)] #[non_exhaustive] pub enum QueueSubmitError { + #[error("QueueId is invalid")] + InvalidQueueId, #[error(transparent)] Queue(#[from] DeviceError), #[error(transparent)] @@ -430,7 +434,7 @@ impl Global { let queue = hub .queues .get(queue_id) - .map_err(|_| DeviceError::InvalidQueueId)?; + .map_err(|_| QueueWriteError::InvalidQueueId)?; let device = queue.device.as_ref().unwrap(); @@ -499,7 +503,7 @@ impl Global { let queue = hub .queues .get(queue_id) - .map_err(|_| DeviceError::InvalidQueueId)?; + .map_err(|_| QueueWriteError::InvalidQueueId)?; let device = queue.device.as_ref().unwrap(); @@ -526,7 +530,7 @@ impl Global { let queue = hub .queues .get(queue_id) - .map_err(|_| DeviceError::InvalidQueueId)?; + .map_err(|_| QueueWriteError::InvalidQueueId)?; let device = queue.device.as_ref().unwrap(); @@ -695,7 +699,7 @@ impl Global { let queue = hub .queues .get(queue_id) - .map_err(|_| DeviceError::InvalidQueueId)?; + .map_err(|_| QueueWriteError::InvalidQueueId)?; let device = queue.device.as_ref().unwrap(); @@ -955,7 +959,7 @@ impl Global { let queue = hub .queues .get(queue_id) - .map_err(|_| DeviceError::InvalidQueueId)?; + .map_err(|_| QueueWriteError::InvalidQueueId)?; let device = queue.device.as_ref().unwrap(); @@ -1150,7 +1154,7 @@ impl Global { let queue = hub .queues .get(queue_id) - .map_err(|_| DeviceError::InvalidQueueId)?; + .map_err(|_| QueueSubmitError::InvalidQueueId)?; let device = queue.device.as_ref().unwrap();