From 7523736d508d4b131313b1765bcbc9640c4e66af Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Sun, 24 Nov 2024 11:12:00 +0100 Subject: [PATCH] Revert portion of #6510 that changes the interface --- wgpu-core/src/instance.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index 2c517d1abcc..4577616516f 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)]