summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-04-13 05:42:56 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-04-13 05:42:56 +0200
commitb677345ac1b1d087bc7f331c9c8c5be06933ba6e (patch)
treedcac58b021472a7183054f9139ce7ba54abff55b /wgpu
parentd5453c62e9bdbf0cea030b009c41b892b700496d (diff)
downloadiced-b677345ac1b1d087bc7f331c9c8c5be06933ba6e.tar.gz
iced-b677345ac1b1d087bc7f331c9c8c5be06933ba6e.tar.bz2
iced-b677345ac1b1d087bc7f331c9c8c5be06933ba6e.zip
Get surface capabilities only once in `iced_wgpu`
Diffstat (limited to '')
-rw-r--r--wgpu/src/window/compositor.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs
index d66aca71..d4a59471 100644
--- a/wgpu/src/window/compositor.rs
+++ b/wgpu/src/window/compositor.rs
@@ -66,8 +66,9 @@ impl<Theme> Compositor<Theme> {
log::info!("Selected: {:#?}", adapter.get_info());
let format = compatible_surface.as_ref().and_then(|surface| {
- surface
- .get_capabilities(&adapter)
+ let capabilities = surface.get_capabilities(&adapter);
+
+ capabilities
.formats
.iter()
.filter(|format| format.describe().srgb)
@@ -76,7 +77,7 @@ impl<Theme> Compositor<Theme> {
.or_else(|| {
log::warn!("No sRGB format found!");
- surface.get_capabilities(&adapter).formats.first().copied()
+ capabilities.formats.first().copied()
})
})?;