From a09d11637e7d53f127f8b68998ac0e2e4fe21868 Mon Sep 17 00:00:00 2001 From: Daniel Keitel Date: Sat, 16 Sep 2023 05:51:27 +0200 Subject: [PATCH] fixed rt hal example after trunk merge --- wgpu-hal/examples/ray-traced-triangle/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wgpu-hal/examples/ray-traced-triangle/main.rs b/wgpu-hal/examples/ray-traced-triangle/main.rs index cb29a53f44..5d66aa6cec 100644 --- a/wgpu-hal/examples/ray-traced-triangle/main.rs +++ b/wgpu-hal/examples/ray-traced-triangle/main.rs @@ -13,6 +13,7 @@ use std::{ ptr::{self, copy_nonoverlapping}, time::Instant, }; +use winit::window::WindowButtons; const COMMAND_BUFFER_PER_CONTEXT: usize = 100; const DESIRED_FRAMES: u32 = 3; @@ -237,14 +238,14 @@ impl Example { let (adapter, features) = unsafe { let mut adapters = instance.enumerate_adapters(); if adapters.is_empty() { - return Err(hal::InstanceError); + panic!("No adapters found"); } let exposed = adapters.swap_remove(0); dbg!(exposed.features); (exposed.adapter, exposed.features) }; - let surface_caps = - unsafe { adapter.surface_capabilities(&surface) }.ok_or(hal::InstanceError)?; + let surface_caps = unsafe { adapter.surface_capabilities(&surface) } + .expect("Surface doesn't support presentation"); log::info!("Surface caps: {:#?}", surface_caps); let hal::OpenDevice { device, mut queue } = @@ -1078,6 +1079,7 @@ fn main() { height: 512, }) .with_resizable(false) + .with_enabled_buttons(WindowButtons::CLOSE) .build(&event_loop) .unwrap();