From e61a0f04f23b34939dd254ee922a5011ce922d1a Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Tue, 27 Aug 2024 23:27:26 +0200 Subject: [PATCH] Repro 6169 --- examples/src/hello_triangle/mod.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/src/hello_triangle/mod.rs b/examples/src/hello_triangle/mod.rs index 7c82d49cf07..1880a0a923f 100644 --- a/examples/src/hello_triangle/mod.rs +++ b/examples/src/hello_triangle/mod.rs @@ -12,7 +12,10 @@ async fn run(event_loop: EventLoop<()>, window: Window) { let instance = wgpu::Instance::default(); - let surface = instance.create_surface(&window).unwrap(); + unsafe { instance.as_hal::() }; + + let mut surface = instance.create_surface(&window).unwrap(); + unsafe { surface.as_hal::(|s| ()) }; let adapter = instance .request_adapter(&wgpu::RequestAdapterOptions { power_preference: wgpu::PowerPreference::default(), @@ -22,6 +25,7 @@ async fn run(event_loop: EventLoop<()>, window: Window) { }) .await .expect("Failed to find an appropriate adapter"); + unsafe { adapter.as_hal::(|a| ()) }; // Create the logical device and command queue let (device, queue) = adapter @@ -38,6 +42,7 @@ async fn run(event_loop: EventLoop<()>, window: Window) { ) .await .expect("Failed to create device"); + unsafe { device.as_hal::(|d| ()) }; // Load the shaders from disk let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor {