From 4a356cfc16f3b45d64826732009d9feeac016b28 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 5 Apr 2024 01:24:34 +0200 Subject: Enable clipping and disable v-sync for now --- wgpu/src/layer.rs | 35 +++++++++++++++++------------------ wgpu/src/text.rs | 1 + wgpu/src/window/compositor.rs | 4 ++-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/wgpu/src/layer.rs b/wgpu/src/layer.rs index 1c9638b0..d415da72 100644 --- a/wgpu/src/layer.rs +++ b/wgpu/src/layer.rs @@ -183,26 +183,26 @@ impl Stack { } pub fn push_clip(&mut self, bounds: Option) { - // self.previous.push(self.current); - // self.order.push(Kind::Live); - - // self.current = self.live_count; - // self.live_count += 1; - - // let bounds = bounds.map(|bounds| bounds * self.transformation()); - - // if self.current == self.live.len() { - // self.live.push(Live { - // bounds, - // ..Live::default() - // }); - // } else { - // self.live[self.current].bounds = bounds; - // } + self.previous.push(self.current); + self.order.push(Kind::Live); + + self.current = self.live_count; + self.live_count += 1; + + let bounds = bounds.map(|bounds| bounds * self.transformation()); + + if self.current == self.live.len() { + self.live.push(Live { + bounds, + ..Live::default() + }); + } else { + self.live[self.current].bounds = bounds; + } } pub fn pop_clip(&mut self) { - // self.current = self.previous.pop().unwrap(); + self.current = self.previous.pop().unwrap(); } pub fn push_transformation(&mut self, transformation: Transformation) { @@ -219,7 +219,6 @@ impl Stack { } pub fn iter_mut(&mut self) -> impl Iterator> { - dbg!(self.order.len()); let mut live = self.live.iter_mut(); let mut cached = self.cached.iter_mut(); diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs index e0a5355c..a7695b74 100644 --- a/wgpu/src/text.rs +++ b/wgpu/src/text.rs @@ -230,6 +230,7 @@ impl Pipeline { *transformation = new_transformation; *target_size = new_target_size; + *needs_reupload = false; } } } diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs index d546a6dc..ab441fa0 100644 --- a/wgpu/src/window/compositor.rs +++ b/wgpu/src/window/compositor.rs @@ -321,12 +321,12 @@ impl graphics::Compositor for Compositor { &wgpu::SurfaceConfiguration { usage: wgpu::TextureUsages::RENDER_ATTACHMENT, format: self.format, - present_mode: self.settings.present_mode, + present_mode: wgpu::PresentMode::Immediate, width, height, alpha_mode: self.alpha_mode, view_formats: vec![], - desired_maximum_frame_latency: 1, + desired_maximum_frame_latency: 0, }, ); } -- cgit