diff --git a/CHANGELOG.md b/CHANGELOG.md index fe5ed1fd20..85e81fe9b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -123,17 +123,19 @@ By @ErichDonGubler in [#6456](https://github.com/gfx-rs/wgpu/pull/6456), [#6148] #### General - Handle query set creation failure as an internal error that loses the `Device`, rather than panicking. By @ErichDonGubler in [#6505](https://github.com/gfx-rs/wgpu/pull/6505). +- Ensure that `Features::TIMESTAMP_QUERY` is set when using timestamp writes in render and compute passes. By @ErichDonGubler in [#6497](https://github.com/gfx-rs/wgpu/pull/6497). +- Check for device mismatches when beginning render and compute passes. By @ErichDonGubler in [#6497](https://github.com/gfx-rs/wgpu/pull/6497). +- Lower `QUERY_SET_MAX_QUERIES` (and enforced limits) from 8192 to 4096 to match WebGPU spec. By @ErichDonGubler in [#6525](https://github.com/gfx-rs/wgpu/pull/6525). #### Naga - Fix crash when a texture argument is missing. By @aedm in [#6486](https://github.com/gfx-rs/wgpu/pull/6486) - Emit an error in constant evaluation, rather than crash, in certain cases where `vecN` constructors have less than N arguments. By @ErichDonGubler in [#6508](https://github.com/gfx-rs/wgpu/pull/6508). -#### General +#### Vulkan + +- Fix surface capabilities being advertised when its query failed. By @wumpf in [#6510](https://github.com/gfx-rs/wgpu/pull/6510) -- Ensure that `Features::TIMESTAMP_QUERY` is set when using timestamp writes in render and compute passes. By @ErichDonGubler in [#6497](https://github.com/gfx-rs/wgpu/pull/6497). -- Check for device mismatches when beginning render and compute passes. By @ErichDonGubler in [#6497](https://github.com/gfx-rs/wgpu/pull/6497). -- Lower `QUERY_SET_MAX_QUERIES` (and enforced limits) from 8192 to 4096 to match WebGPU spec. By @ErichDonGubler in [#6525](https://github.com/gfx-rs/wgpu/pull/6525). ## 23.0.0 (2024-10-25) diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index 4577616516..2c517d1abc 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(adapter.backend()) - .ok_or(GetSurfaceSupportError::Unsupported)?; + .raw(backend) + .ok_or(GetSurfaceSupportError::NotSupportedByBackend(backend))?; profiling::scope!("surface_capabilities"); let caps = unsafe { adapter.adapter.surface_capabilities(suf) } - .ok_or(GetSurfaceSupportError::Unsupported)?; - + .ok_or(GetSurfaceSupportError::FailedToRetrieveSurfaceCapabilitiesForAdapter)?; Ok(caps) } @@ -649,8 +649,10 @@ crate::impl_storage_item!(Adapter); #[derive(Clone, Debug, Error)] #[non_exhaustive] pub enum GetSurfaceSupportError { - #[error("Surface is not supported by the adapter")] - Unsupported, + #[error("Surface is not supported for the specified backend {0}")] + NotSupportedByBackend(Backend), + #[error("Failed to retrieve surface capabilities for the specified adapter.")] + FailedToRetrieveSurfaceCapabilitiesForAdapter, } #[derive(Clone, Debug, Error)] diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 30ae7f155d..2916928e46 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -2262,7 +2262,8 @@ impl crate::Adapter for super::Adapter { Ok(present_modes) => present_modes, Err(e) => { log::error!("get_physical_device_surface_present_modes: {}", e); - Vec::new() + // Per definition of `SurfaceCapabilities`, there must be at least one present mode. + return None; } } }; @@ -2277,7 +2278,8 @@ impl crate::Adapter for super::Adapter { Ok(formats) => formats, Err(e) => { log::error!("get_physical_device_surface_formats: {}", e); - Vec::new() + // Per definition of `SurfaceCapabilities`, there must be at least one present format. + return None; } } }; diff --git a/wgpu/src/backend/wgpu_core.rs b/wgpu/src/backend/wgpu_core.rs index befec4bd78..e2b75d1e1b 100644 --- a/wgpu/src/backend/wgpu_core.rs +++ b/wgpu/src/backend/wgpu_core.rs @@ -716,10 +716,7 @@ impl crate::Context for ContextWgpuCore { .surface_get_capabilities(surface_data.id, *adapter_data) { Ok(caps) => caps, - Err(wgc::instance::GetSurfaceSupportError::Unsupported) => { - wgt::SurfaceCapabilities::default() - } - Err(err) => self.handle_error_fatal(err, "Surface::get_supported_formats"), + Err(_) => wgt::SurfaceCapabilities::default(), } }