From 65f690b07559a36fe8bfcba31edd851c5c286704 Mon Sep 17 00:00:00 2001 From: Poly Date: Wed, 13 Oct 2021 19:40:29 +0200 Subject: Update wgpu to 0.11 --- examples/integration_wgpu/src/main.rs | 6 ++++-- wgpu/Cargo.toml | 4 ++-- wgpu/src/window/compositor.rs | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/integration_wgpu/src/main.rs b/examples/integration_wgpu/src/main.rs index 7ef148bc..bf36c7a5 100644 --- a/examples/integration_wgpu/src/main.rs +++ b/examples/integration_wgpu/src/main.rs @@ -39,6 +39,7 @@ pub fn main() { .request_adapter(&wgpu::RequestAdapterOptions { power_preference: wgpu::PowerPreference::HighPerformance, compatible_surface: Some(&surface), + force_fallback_adapter: false, }) .await .expect("Request adapter"); @@ -172,7 +173,7 @@ pub fn main() { resized = false; } - match surface.get_current_frame() { + match surface.get_current_texture() { Ok(frame) => { let mut encoder = device.create_command_encoder( &wgpu::CommandEncoderDescriptor { label: None }, @@ -180,7 +181,7 @@ pub fn main() { let program = state.program(); - let view = frame.output.texture.create_view(&wgpu::TextureViewDescriptor::default()); + let view = frame.texture.create_view(&wgpu::TextureViewDescriptor::default()); { // We clear the frame @@ -208,6 +209,7 @@ pub fn main() { // Then we submit the work staging_belt.finish(); queue.submit(Some(encoder.finish())); + frame.present(); // Update the mouse cursor window.set_cursor_icon( diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index 71da889f..ed74b804 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -27,8 +27,8 @@ default_system_font = ["iced_graphics/font-source"] spirv = ["wgpu/spirv"] [dependencies] -wgpu = "0.10" -wgpu_glyph = "0.14" +wgpu = "0.11" +wgpu_glyph = "0.15" glyph_brush = "0.7" raw-window-handle = "0.3" log = "0.4" diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs index eca54b6f..bd8e1f89 100644 --- a/wgpu/src/window/compositor.rs +++ b/wgpu/src/window/compositor.rs @@ -40,6 +40,7 @@ impl Compositor { wgpu::PowerPreference::HighPerformance }, compatible_surface: compatible_surface.as_ref(), + force_fallback_adapter: false, }) .await?; @@ -141,7 +142,7 @@ impl iced_graphics::window::Compositor for Compositor { output: &::Output, overlay: &[T], ) -> Result { - match surface.get_current_frame() { + match surface.get_current_texture() { Ok(frame) => { let mut encoder = self.device.create_command_encoder( &wgpu::CommandEncoderDescriptor { @@ -150,7 +151,6 @@ impl iced_graphics::window::Compositor for Compositor { ); let view = &frame - .output .texture .create_view(&wgpu::TextureViewDescriptor::default()); @@ -193,6 +193,7 @@ impl iced_graphics::window::Compositor for Compositor { // Submit work self.staging_belt.finish(); self.queue.submit(Some(encoder.finish())); + frame.present(); // Recall staging buffers self.local_pool -- cgit From 3a723f6ec118d8a2fb9c17bde84ecfc888ee6c79 Mon Sep 17 00:00:00 2001 From: Paul Delafosse Date: Fri, 15 Oct 2021 12:20:46 +0200 Subject: Fix blit shader constants visivility #1083 --- wgpu/src/shader/blit.wgsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wgpu/src/shader/blit.wgsl b/wgpu/src/shader/blit.wgsl index 694f192e..f8f6e2d4 100644 --- a/wgpu/src/shader/blit.wgsl +++ b/wgpu/src/shader/blit.wgsl @@ -1,4 +1,4 @@ -var positions: array, 6> = array, 6>( +var positions: array, 6> = array, 6>( vec2(-1.0, 1.0), vec2(-1.0, -1.0), vec2(1.0, -1.0), @@ -7,7 +7,7 @@ var positions: array, 6> = array, 6>( vec2(1.0, -1.0) ); -var uvs: array, 6> = array, 6>( +var uvs: array, 6> = array, 6>( vec2(0.0, 0.0), vec2(0.0, 1.0), vec2(1.0, 1.0), -- cgit From b098f06a299f196c846affa2453f903ebe93c856 Mon Sep 17 00:00:00 2001 From: cmot17 <25753364+cmot17@users.noreply.github.com> Date: Sun, 24 Oct 2021 08:57:14 -0400 Subject: Fix issue with text selection in text_input widget --- native/src/widget/text_input.rs | 44 ++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/native/src/widget/text_input.rs b/native/src/widget/text_input.rs index 84d171be..d4d197d3 100644 --- a/native/src/widget/text_input.rs +++ b/native/src/widget/text_input.rs @@ -335,29 +335,27 @@ where let text_layout = layout.children().next().unwrap(); let target = position.x - text_layout.bounds().x; - if target > 0.0 { - let value = if self.is_secure { - self.value.secure() - } else { - self.value.clone() - }; - - let position = renderer - .find_cursor_position( - text_layout.bounds(), - self.font, - self.size, - &value, - &self.state, - target, - ) - .unwrap_or(0); - - self.state.cursor.select_range( - self.state.cursor.start(&value), - position, - ); - } + let value = if self.is_secure { + self.value.secure() + } else { + self.value.clone() + }; + + let position = renderer + .find_cursor_position( + text_layout.bounds(), + self.font, + self.size, + &value, + &self.state, + target, + ) + .unwrap_or(0); + + self.state.cursor.select_range( + self.state.cursor.start(&value), + position, + ); return event::Status::Captured; } -- cgit