diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index 2c517d1abc..4577616516 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -412,13 +412,13 @@ impl Surface { &self, adapter: &hal::DynExposedAdapter, ) -> Result { - let backend = adapter.backend(); let suf = self - .raw(backend) - .ok_or(GetSurfaceSupportError::NotSupportedByBackend(backend))?; + .raw(adapter.backend()) + .ok_or(GetSurfaceSupportError::Unsupported)?; profiling::scope!("surface_capabilities"); let caps = unsafe { adapter.adapter.surface_capabilities(suf) } - .ok_or(GetSurfaceSupportError::FailedToRetrieveSurfaceCapabilitiesForAdapter)?; + .ok_or(GetSurfaceSupportError::Unsupported)?; + Ok(caps) } @@ -649,10 +649,8 @@ crate::impl_storage_item!(Adapter); #[derive(Clone, Debug, Error)] #[non_exhaustive] pub enum GetSurfaceSupportError { - #[error("Surface is not supported for the specified backend {0}")] - NotSupportedByBackend(Backend), - #[error("Failed to retrieve surface capabilities for the specified adapter.")] - FailedToRetrieveSurfaceCapabilitiesForAdapter, + #[error("Surface is not supported by the adapter")] + Unsupported, } #[derive(Clone, Debug, Error)]