diff --git a/Cargo.toml b/Cargo.toml index f63aba0..c5c005e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ pollster = "0.2" raw-window-handle = "0.3" thiserror = "1.0" ultraviolet = "0.8" -wgpu = "0.10" +wgpu = "0.11" [dev-dependencies] pixels-mocks = { path = "internals/pixels-mocks" } diff --git a/examples/custom-shader/shaders/noise.wgsl b/examples/custom-shader/shaders/noise.wgsl index 82e8452..a1785f1 100644 --- a/examples/custom-shader/shaders/noise.wgsl +++ b/examples/custom-shader/shaders/noise.wgsl @@ -23,7 +23,7 @@ fn vs_main( [[block]] struct Locals { time: f32; }; -[[group(0), binding(2)]] var r_locals: Locals; +[[group(0), binding(2)]] var r_locals: Locals; let tau: f32 = 6.283185307179586476925286766559; let bias: f32 = 0.2376; // Offset the circular time input so it is never 0 diff --git a/examples/custom-shader/src/renderers.rs b/examples/custom-shader/src/renderers.rs index 89ea0fa..753484c 100644 --- a/examples/custom-shader/src/renderers.rs +++ b/examples/custom-shader/src/renderers.rs @@ -246,11 +246,7 @@ fn create_bind_group( }, wgpu::BindGroupEntry { binding: 2, - resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding { - buffer: time_buffer, - offset: 0, - size: None, - }), + resource: time_buffer.as_entire_binding(), }, ], }) diff --git a/examples/imgui-winit/Cargo.toml b/examples/imgui-winit/Cargo.toml index 4dcb2b2..8de5809 100644 --- a/examples/imgui-winit/Cargo.toml +++ b/examples/imgui-winit/Cargo.toml @@ -12,9 +12,9 @@ default = ["optimize"] [dependencies] env_logger = "0.9" -imgui = "0.7" -imgui-wgpu = "0.17" -imgui-winit-support = { version = "0.7.1", default-features = false, features = ["winit-25"] } +imgui = "0.8" +imgui-wgpu = "0.18" +imgui-winit-support = { version = "0.8", default-features = false, features = ["winit-25"] } log = "0.4" pixels = { path = "../.." } winit = "0.25" diff --git a/examples/imgui-winit/src/gui.rs b/examples/imgui-winit/src/gui.rs index 3e8194d..90aba9e 100644 --- a/examples/imgui-winit/src/gui.rs +++ b/examples/imgui-winit/src/gui.rs @@ -93,8 +93,8 @@ impl Gui { // Draw windows and GUI elements here let mut about_open = false; ui.main_menu_bar(|| { - ui.menu(imgui::im_str!("Help"), true, || { - about_open = imgui::MenuItem::new(imgui::im_str!("About...")).build(&ui); + ui.menu("Help", || { + about_open = imgui::MenuItem::new("About...").build(&ui); }); }); if about_open { diff --git a/shaders/scale.wgsl b/shaders/scale.wgsl index b10f2c9..efb7ff1 100644 --- a/shaders/scale.wgsl +++ b/shaders/scale.wgsl @@ -8,7 +8,7 @@ struct VertexOutput { [[block]] struct Locals { transform: mat4x4; }; -[[group(0), binding(2)]] var r_locals: Locals; +[[group(0), binding(2)]] var r_locals: Locals; [[stage(vertex)]] fn vs_main( diff --git a/src/builder.rs b/src/builder.rs index f121fe1..4b3ff13 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -29,6 +29,7 @@ impl<'req, 'dev, 'win, W: HasRawWindowHandle> PixelsBuilder<'req, 'dev, 'win, W> /// let mut pixels = PixelsBuilder::new(256, 240, surface_texture) /// .request_adapter_options(wgpu::RequestAdapterOptions { /// power_preference: wgpu::PowerPreference::HighPerformance, + /// force_fallback_adapter: false, /// compatible_surface: None, /// }) /// .enable_vsync(false) @@ -200,11 +201,13 @@ impl<'req, 'dev, 'win, W: HasRawWindowHandle> PixelsBuilder<'req, 'dev, 'win, W> instance.request_adapter(&request_adapter_options.as_ref().map_or_else( || wgpu::RequestAdapterOptions { compatible_surface, + force_fallback_adapter: false, power_preference: wgpu::util::power_preference_from_env().unwrap_or_default(), }, |rao| wgpu::RequestAdapterOptions { compatible_surface: rao.compatible_surface.or(compatible_surface), + force_fallback_adapter: false, power_preference: rao.power_preference, }, )); diff --git a/src/lib.rs b/src/lib.rs index 602c9ea..3826b5f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -284,7 +284,7 @@ impl Pixels { /// /// # Errors /// - /// Returns an error when [`wgpu::Surface::get_current_frame`] fails. + /// Returns an error when [`wgpu::Surface::get_current_texture`] fails. /// /// # Example /// @@ -328,7 +328,7 @@ impl Pixels { /// /// # Errors /// - /// Returns an error when either [`wgpu::Surface::get_current_frame`] or the provided render + /// Returns an error when either [`wgpu::Surface::get_current_texture`] or the provided render /// function fails. /// /// # Example @@ -367,13 +367,13 @@ impl Pixels { let frame = self .context .surface - .get_current_frame() + .get_current_texture() .or_else(|err| match err { wgpu::SurfaceError::Outdated => { // Reconfigure the surface to mitigate race condition on window resize. // See https://github.com/parasyte/pixels/issues/121 self.reconfigure_surface(); - self.context.surface.get_current_frame() + self.context.surface.get_current_texture() } err => Err(err), }) @@ -405,7 +405,6 @@ impl Pixels { ); let view = frame - .output .texture .create_view(&wgpu::TextureViewDescriptor::default()); @@ -413,6 +412,7 @@ impl Pixels { (render_function)(&mut encoder, &view, &self.context)?; self.context.queue.submit(Some(encoder.finish())); + frame.present(); Ok(()) } diff --git a/src/renderers.rs b/src/renderers.rs index a088447..f089ddb 100644 --- a/src/renderers.rs +++ b/src/renderers.rs @@ -114,7 +114,7 @@ impl ScalingRenderer { ty: wgpu::BindingType::Buffer { ty: wgpu::BufferBindingType::Uniform, has_dynamic_offset: false, - min_binding_size: None, + min_binding_size: None, // TODO: More efficent to specify this }, count: None, }, @@ -134,11 +134,7 @@ impl ScalingRenderer { }, wgpu::BindGroupEntry { binding: 2, - resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding { - buffer: &uniform_buffer, - offset: 0, - size: None, - }), + resource: uniform_buffer.as_entire_binding(), }, ], });