Skip to content

Commit 1f49837

Browse files
committed
Fix Vulkan surface capabilities being advertised when its query failed. (#6510)
Leaves out portions of #6510 that changed the interface
1 parent 5ea7288 commit 1f49837

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ Bottom level categories:
5353

5454
- Fix surface creation crashing on iOS. By @mockersf in [#6535](https://github.com/gfx-rs/wgpu/pull/6535)
5555

56+
#### Vulkan
57+
58+
- Fix surface capabilities being advertised when its query failed. By @wumpf in [#6510](https://github.com/gfx-rs/wgpu/pull/6510)
59+
5660
## 23.0.0 (2024-10-25)
5761

5862
### Themes of this release

wgpu-hal/src/vulkan/adapter.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,7 +2254,8 @@ impl crate::Adapter for super::Adapter {
22542254
Ok(present_modes) => present_modes,
22552255
Err(e) => {
22562256
log::error!("get_physical_device_surface_present_modes: {}", e);
2257-
Vec::new()
2257+
// Per definition of `SurfaceCapabilities`, there must be at least one present mode.
2258+
return None;
22582259
}
22592260
}
22602261
};
@@ -2269,7 +2270,8 @@ impl crate::Adapter for super::Adapter {
22692270
Ok(formats) => formats,
22702271
Err(e) => {
22712272
log::error!("get_physical_device_surface_formats: {}", e);
2272-
Vec::new()
2273+
// Per definition of `SurfaceCapabilities`, there must be at least one present format.
2274+
return None;
22732275
}
22742276
}
22752277
};

wgpu/src/backend/wgpu_core.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -702,10 +702,7 @@ impl crate::Context for ContextWgpuCore {
702702
.surface_get_capabilities(surface_data.id, *adapter_data)
703703
{
704704
Ok(caps) => caps,
705-
Err(wgc::instance::GetSurfaceSupportError::Unsupported) => {
706-
wgt::SurfaceCapabilities::default()
707-
}
708-
Err(err) => self.handle_error_fatal(err, "Surface::get_supported_formats"),
705+
Err(_) => wgt::SurfaceCapabilities::default(),
709706
}
710707
}
711708

0 commit comments

Comments
 (0)