From 75752a400925738d90c2267b4c15ef2b554725fe Mon Sep 17 00:00:00 2001 From: Micha White Date: Sun, 27 Nov 2022 22:34:13 -0500 Subject: Small performance improvement --- alligator_render/examples/bunnymark.rs | 1 + alligator_render/src/renderer.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/alligator_render/examples/bunnymark.rs b/alligator_render/examples/bunnymark.rs index 7ef97b7..62371c9 100644 --- a/alligator_render/examples/bunnymark.rs +++ b/alligator_render/examples/bunnymark.rs @@ -113,6 +113,7 @@ fn main() { default_width: NonZeroU32::new(1280).unwrap(), default_height: NonZeroU32::new(720).unwrap(), vsync: false, + low_power: false, ..Default::default() }; diff --git a/alligator_render/src/renderer.rs b/alligator_render/src/renderer.rs index 064ff31..27e7884 100644 --- a/alligator_render/src/renderer.rs +++ b/alligator_render/src/renderer.rs @@ -303,12 +303,6 @@ impl Renderer { /// that can be used for the new frame. #[profiling::function] fn render(&mut self) -> Result<(), wgpu::SurfaceError> { - // the new texture we can render to - let output = self.surface.get_current_texture()?; - let view = output - .texture - .create_view(&wgpu::TextureViewDescriptor::default()); - // this will allow us to send commands to the gpu let mut encoder = self .device @@ -321,6 +315,12 @@ impl Renderer { self.camera.refresh(&self.queue); self.textures.fill_textures(&self.queue); + // the new texture we can render to + let output = self.surface.get_current_texture()?; + let view = output + .texture + .create_view(&wgpu::TextureViewDescriptor::default()); + { profiling::scope!("encode render pass"); let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { -- cgit v1.2.3