Skip to content

Commit

Permalink
Hax
Browse files Browse the repository at this point in the history
  • Loading branch information
xorgy committed Mar 2, 2024
1 parent d7f474e commit 0ad9c19
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions src/app_main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,36 +204,35 @@ where
self.scene.reset();
self.scene.append(fragment, transform);
self.counter += 1;

let surface_texture = self
.surface
.surface
.get_current_texture()
.expect("failed to acquire next swapchain texture");
let dev_id = self.surface.dev_id;
let device = &self.render_cx.devices[dev_id].device;
let queue = &self.render_cx.devices[dev_id].queue;
let renderer_options = RendererOptions {
surface_format: Some(self.surface.format),
use_cpu: false,
antialiasing_support: AaSupport {
area: true,
msaa8: false,
msaa16: false,
},
num_init_threads: NonZeroUsize::new(1),
};
let render_params = RenderParams {
base_color: Color::BLACK,
width,
height,
antialiasing_method: vello::AaConfig::Area,
};
self.renderer
.get_or_insert_with(|| Renderer::new(device, renderer_options).unwrap())
.render_to_surface(device, queue, &self.scene, &surface_texture, &render_params)
.expect("failed to render to surface");
surface_texture.present();
device.poll(wgpu::Maintain::Wait);
loop {
if let Ok(surface_texture) = self.surface.surface.get_current_texture() {
let dev_id = self.surface.dev_id;
let device = &self.render_cx.devices[dev_id].device;
let queue = &self.render_cx.devices[dev_id].queue;
let renderer_options = RendererOptions {
surface_format: Some(self.surface.format),
use_cpu: false,
antialiasing_support: AaSupport {
area: true,
msaa8: false,
msaa16: false,
},
num_init_threads: NonZeroUsize::new(1),
};
let render_params = RenderParams {
base_color: Color::BLACK,
width,
height,
antialiasing_method: vello::AaConfig::Area,
};
self.renderer
.get_or_insert_with(|| Renderer::new(device, renderer_options).unwrap())
.render_to_surface(device, queue, &self.scene, &surface_texture, &render_params)
.expect("failed to render to surface");
surface_texture.present();
device.poll(wgpu::Maintain::Wait);
break;
}
}
}
}

0 comments on commit 0ad9c19

Please sign in to comment.