From 1abf3fe90eb7fceea4750c6e4092ff7e888966f7 Mon Sep 17 00:00:00 2001 From: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com> Date: Fri, 15 Nov 2024 05:25:18 -0800 Subject: [PATCH] remove unused enum variants (#6550) --- wgpu-core/src/command/draw.rs | 2 -- wgpu-core/src/command/mod.rs | 2 -- wgpu-core/src/command/render.rs | 4 ---- wgpu-core/src/command/transfer.rs | 2 -- wgpu-core/src/device/life.rs | 2 -- wgpu-core/src/device/queue.rs | 7 ------- wgpu-core/src/instance.rs | 2 -- wgpu-core/src/pipeline.rs | 4 ---- wgpu-core/src/present.rs | 5 ----- wgpu-core/src/ray_tracing.rs | 11 ----------- wgpu-core/src/resource.rs | 8 -------- wgpu-core/src/validation.rs | 4 ---- 12 files changed, 53 deletions(-) diff --git a/wgpu-core/src/command/draw.rs b/wgpu-core/src/command/draw.rs index dd54b60f2..76a4cfb06 100644 --- a/wgpu-core/src/command/draw.rs +++ b/wgpu-core/src/command/draw.rs @@ -71,8 +71,6 @@ pub enum RenderCommandError { BindGroupIndexOutOfRange { index: u32, max: u32 }, #[error("Vertex buffer index {index} is greater than the device's requested `max_vertex_buffers` limit {max}")] VertexBufferIndexOutOfRange { index: u32, max: u32 }, - #[error("Dynamic buffer offset {0} does not respect device's requested `{1}` limit {2}")] - UnalignedBufferOffset(u64, &'static str, u32), #[error("Render pipeline targets are incompatible with render pass")] IncompatiblePipelineTargets(#[from] crate::device::RenderPassCompatibilityError), #[error("{0} writes to depth, while the pass has read-only depth access")] diff --git a/wgpu-core/src/command/mod.rs b/wgpu-core/src/command/mod.rs index 33025579a..6a06d1f83 100644 --- a/wgpu-core/src/command/mod.rs +++ b/wgpu-core/src/command/mod.rs @@ -914,8 +914,6 @@ pub enum PassErrorScope { SetScissorRect, #[error("In a draw command, kind: {kind:?}")] Draw { kind: DrawKind, indexed: bool }, - #[error("While resetting queries after the renderpass was ran")] - QueryReset, #[error("In a write_timestamp command")] WriteTimestamp, #[error("In a begin_occlusion_query command")] diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index 6102d0d49..ad3a5b6ca 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -624,10 +624,6 @@ pub enum RenderPassErrorInner { src: wgt::TextureFormat, dst: wgt::TextureFormat, }, - #[error("Surface texture is dropped before the render pass is finished")] - SurfaceTextureDropped, - #[error("Not enough memory left for render pass")] - OutOfMemory, #[error("Unable to clear non-present/read-only depth")] InvalidDepthOps, #[error("Unable to clear non-present/read-only stencil")] diff --git a/wgpu-core/src/command/transfer.rs b/wgpu-core/src/command/transfer.rs index 21dda6ce2..2fe6c83f7 100644 --- a/wgpu-core/src/command/transfer.rs +++ b/wgpu-core/src/command/transfer.rs @@ -91,8 +91,6 @@ pub enum TransferError { UnspecifiedRowsPerImage, #[error("Number of bytes per row is less than the number of bytes in a complete row")] InvalidBytesPerRow, - #[error("Image is 1D and the copy height and depth are not both set to 1")] - InvalidCopySize, #[error("Number of rows per image is invalid")] InvalidRowsPerImage, #[error("Copy source aspects must refer to all aspects of the source texture format")] diff --git a/wgpu-core/src/device/life.rs b/wgpu-core/src/device/life.rs index c7d3a59d6..f1c6d5bfb 100644 --- a/wgpu-core/src/device/life.rs +++ b/wgpu-core/src/device/life.rs @@ -151,8 +151,6 @@ pub enum WaitIdleError { Device(#[from] DeviceError), #[error("Tried to wait using a submission index ({0}) that has not been returned by a successful submission (last successful submission: {1})")] WrongSubmissionIndex(SubmissionIndex, SubmissionIndex), - #[error("GPU got stuck :(")] - StuckGpu, } /// Resource tracking for a device. diff --git a/wgpu-core/src/device/queue.rs b/wgpu-core/src/device/queue.rs index 370880a93..0983eb901 100644 --- a/wgpu-core/src/device/queue.rs +++ b/wgpu-core/src/device/queue.rs @@ -537,12 +537,6 @@ pub enum QueueSubmitError { Unmap(#[from] BufferAccessError), #[error("{0} is still mapped")] BufferStillMapped(ResourceErrorIdent), - #[error("Surface output was dropped before the command buffer got submitted")] - SurfaceOutputDropped, - #[error("Surface was unconfigured before the command buffer got submitted")] - SurfaceUnconfigured, - #[error("GPU got stuck :(")] - StuckGpu, #[error(transparent)] InvalidResource(#[from] InvalidResourceError), #[error(transparent)] @@ -1430,7 +1424,6 @@ impl Queue { Err(WaitIdleError::Device(err)) => { break 'error Err(QueueSubmitError::Queue(err)) } - Err(WaitIdleError::StuckGpu) => break 'error Err(QueueSubmitError::StuckGpu), Err(WaitIdleError::WrongSubmissionIndex(..)) => unreachable!(), }; diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index 53a498502..5c8aef3cd 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -660,8 +660,6 @@ pub enum RequestDeviceError { Device(#[from] DeviceError), #[error(transparent)] LimitsExceeded(#[from] FailedLimit), - #[error("Device has no queue supporting graphics")] - NoGraphicsQueue, #[error("Unsupported features were requested: {0:?}")] UnsupportedFeature(wgt::Features), } diff --git a/wgpu-core/src/pipeline.rs b/wgpu-core/src/pipeline.rs index 01ceabf66..07e08cb35 100644 --- a/wgpu-core/src/pipeline.rs +++ b/wgpu-core/src/pipeline.rs @@ -280,8 +280,6 @@ pub enum CreatePipelineCacheError { Validation(#[from] PipelineCacheValidationError), #[error(transparent)] MissingFeatures(#[from] MissingFeatures), - #[error("Internal error: {0}")] - Internal(String), } #[derive(Debug)] @@ -439,8 +437,6 @@ pub enum ColorStateError { pipeline: validation::NumericType, shader: validation::NumericType, }, - #[error("Blend factors for {0:?} must be `One`")] - InvalidMinMaxBlendFactors(wgt::BlendComponent), #[error("Invalid write mask {0:?}")] InvalidWriteMask(wgt::ColorWrites), } diff --git a/wgpu-core/src/present.rs b/wgpu-core/src/present.rs index e601b2190..05124af25 100644 --- a/wgpu-core/src/present.rs +++ b/wgpu-core/src/present.rs @@ -47,8 +47,6 @@ pub enum SurfaceError { AlreadyAcquired, #[error("Texture has been destroyed")] TextureDestroyed, - #[error("Acquired frame is still referenced")] - StillReferenced, } #[derive(Clone, Debug, Error)] @@ -94,8 +92,6 @@ pub enum ConfigureSurfaceError { requested: hal::TextureUses, available: hal::TextureUses, }, - #[error("Gpu got stuck :(")] - StuckGpu, } impl From for ConfigureSurfaceError { @@ -103,7 +99,6 @@ impl From for ConfigureSurfaceError { match e { WaitIdleError::Device(d) => ConfigureSurfaceError::Device(d), WaitIdleError::WrongSubmissionIndex(..) => unreachable!(), - WaitIdleError::StuckGpu => ConfigureSurfaceError::StuckGpu, } } } diff --git a/wgpu-core/src/ray_tracing.rs b/wgpu-core/src/ray_tracing.rs index f6102b552..a094b3530 100644 --- a/wgpu-core/src/ray_tracing.rs +++ b/wgpu-core/src/ray_tracing.rs @@ -44,8 +44,6 @@ pub enum CreateTlasError { CreateBufferError(#[from] CreateBufferError), #[error("Features::RAY_TRACING_ACCELERATION_STRUCTURE is not enabled")] MissingFeature, - #[error("Unimplemented Tlas error: this error is not yet implemented")] - Unimplemented, } /// Error encountered while attempting to do a copy on a command encoder. @@ -132,9 +130,6 @@ pub enum BuildAccelerationStructureError { #[error("BlasId is invalid or destroyed (for instance)")] InvalidBlasIdForInstance, - #[error("Blas {0:?} is invalid or destroyed (for instance)")] - InvalidBlasForInstance(ResourceErrorIdent), - #[error("TlasId is invalid or destroyed")] InvalidTlasId, @@ -150,18 +145,12 @@ pub enum BuildAccelerationStructureError { #[derive(Clone, Debug, Error)] pub enum ValidateBlasActionsError { - #[error("BlasId is invalid or destroyed")] - InvalidBlas, - #[error("Blas {0:?} is used before it is built")] UsedUnbuilt(ResourceErrorIdent), } #[derive(Clone, Debug, Error)] pub enum ValidateTlasActionsError { - #[error("Tlas {0:?} is invalid or destroyed")] - InvalidTlas(ResourceErrorIdent), - #[error("Tlas {0:?} is used before it is built")] UsedUnbuilt(ResourceErrorIdent), diff --git a/wgpu-core/src/resource.rs b/wgpu-core/src/resource.rs index 0b9cdf821..764c5bafe 100644 --- a/wgpu-core/src/resource.rs +++ b/wgpu-core/src/resource.rs @@ -206,9 +206,6 @@ pub enum BufferMapAsyncStatus { MapAlreadyPending, /// An unknown error. Error, - /// Mapping was aborted (by unmapping or destroying the buffer before mapping - /// happened). - Aborted, /// The context is Lost. ContextLost, /// The buffer is in an invalid state. @@ -1746,8 +1743,6 @@ pub enum CreateTextureViewError { Device(#[from] DeviceError), #[error(transparent)] DestroyedResource(#[from] DestroyedResourceError), - #[error("Not enough memory left to create texture view")] - OutOfMemory, #[error("Invalid texture view dimension `{view:?}` with texture of dimension `{texture:?}`")] InvalidTextureViewDimension { view: wgt::TextureViewDimension, @@ -1896,9 +1891,6 @@ pub enum CreateSamplerError { filter_mode: wgt::FilterMode, anisotropic_clamp: u16, }, - #[error("Cannot create any more samplers")] - TooManyObjects, - /// AddressMode::ClampToBorder requires feature ADDRESS_MODE_CLAMP_TO_BORDER. #[error(transparent)] MissingFeatures(#[from] MissingFeatures), } diff --git a/wgpu-core/src/validation.rs b/wgpu-core/src/validation.rs index 68a9288e0..52273b4f8 100644 --- a/wgpu-core/src/validation.rs +++ b/wgpu-core/src/validation.rs @@ -169,10 +169,6 @@ pub enum BindingError { InconsistentlyDerivedType, #[error("Texture format {0:?} is not supported for storage use")] BadStorageFormat(wgt::TextureFormat), - #[error( - "Storage texture with access {0:?} doesn't have a matching supported `StorageTextureAccess`" - )] - UnsupportedTextureStorageAccess(naga::StorageAccess), } #[derive(Clone, Debug, Error)]