From fb2544021a40d029a99cadda7cf59acf5e7dc455 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sun, 9 Mar 2025 01:38:34 +0100 Subject: Update `wgpu` to `24` and use `cryoglyph` fork Co-authored-by: Winfried Baumann --- wgpu/src/window/compositor.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'wgpu/src/window/compositor.rs') diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs index 4fe689cf..bc932b44 100644 --- a/wgpu/src/window/compositor.rs +++ b/wgpu/src/window/compositor.rs @@ -54,7 +54,7 @@ impl Compositor { settings: Settings, compatible_window: Option, ) -> Result { - let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { + let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor { backends: settings.backends, flags: if cfg!(feature = "strict-assertions") { wgpu::InstanceFlags::debugging() @@ -81,12 +81,13 @@ impl Compositor { .and_then(|window| instance.create_surface(window).ok()); let adapter_options = wgpu::RequestAdapterOptions { - power_preference: wgpu::util::power_preference_from_env() - .unwrap_or(if settings.antialiasing.is_none() { + power_preference: wgpu::PowerPreference::from_env().unwrap_or( + if settings.antialiasing.is_none() { wgpu::PowerPreference::LowPower } else { wgpu::PowerPreference::HighPerformance - }), + }, + ), compatible_surface: compatible_surface.as_ref(), force_fallback_adapter: false, }; @@ -263,6 +264,7 @@ pub fn present>( wgpu::SurfaceError::OutOfMemory => { Err(compositor::SurfaceError::OutOfMemory) } + wgpu::SurfaceError::Other => Err(compositor::SurfaceError::Other), }, } } @@ -280,7 +282,7 @@ impl graphics::Compositor for Compositor { None | Some("wgpu") => { let mut settings = Settings::from(settings); - if let Some(backends) = wgpu::util::backend_bits_from_env() { + if let Some(backends) = wgpu::Backends::from_env() { settings.backends = backends; } @@ -451,9 +453,9 @@ pub fn screenshot>( encoder.copy_texture_to_buffer( texture.as_image_copy(), - wgpu::ImageCopyBuffer { + wgpu::TexelCopyBufferInfo { buffer: &output_buffer, - layout: wgpu::ImageDataLayout { + layout: wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(dimensions.padded_bytes_per_row as u32), rows_per_image: None, -- cgit