Skip to content
This repository has been archived by the owner on Sep 8, 2024. It is now read-only.

Commit

Permalink
Add back on_uncaptured_error in release + cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
darthdeus committed Nov 12, 2023
1 parent 1c9179d commit 09da4fb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 18 deletions.
10 changes: 5 additions & 5 deletions comfy-wgpu/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ pub async fn create_graphics_context(window: &Window) -> GraphicsContext {
.await
.expect("failed to create wgpu adapter");

// device.on_uncaptured_error(Box::new(|err| {
// error!("WGPU ERROR: {:?}", err);
// #[cfg(fature = "ci-release")]
// panic!("Exiting due to wgpu error: {:?}", err);
// }));
#[cfg(fature = "ci-release")]
device.on_uncaptured_error(Box::new(|err| {
error!("WGPU ERROR: {:?}", err);
panic!("Exiting due to wgpu error: {:?}", err);
}));

let caps = surface.get_capabilities(&adapter);
let supported_formats = caps.formats;
Expand Down
16 changes: 4 additions & 12 deletions comfy/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,11 @@ impl EngineState {
// .secondary_frame_mark(tracy_client::frame_name!("update"));


// TODO: this really needs a cleanup
pub fn renderer(&mut self) -> &mut WgpuRenderer {
self.renderer.as_mut().expect("renderer must be initialized")
}

// TODO: this really needs a cleanup
pub fn resize(&mut self, new_size: UVec2) {
self.renderer.as_mut().unwrap().resize(new_size);
}

// TODO: this really needs a cleanup
pub fn quit_flag(&mut self) -> bool {
self.quit_flag
self.renderer
.as_mut()
.expect("renderer must be initialized")
.resize(new_size);
}

pub fn title(&self) -> String {
Expand Down
2 changes: 1 addition & 1 deletion comfy/src/game_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pub async fn run_comfy_main_async(
set_time(get_time() + delta as f64);
use_default_shader();

if engine.quit_flag() {
if engine.quit_flag {
*control_flow = ControlFlow::Exit;
}

Expand Down

0 comments on commit 09da4fb

Please sign in to comment.