-
Notifications
You must be signed in to change notification settings - Fork 908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Device::as_hal
crashes after ID removal in #6134
#6169
Comments
Platform is Windows. I was running a modified version of the Will push a repro branch soon. |
Try https://github.com/MarijnS95/wgpu/compare/repro-6169 with: $ WGPU_BACKEND=dx12 cargo r -p wgpu-examples hello_triangle
...
thread 'main' panicked at wgpu\src\context.rs:737:5:
assertion failed: data.is::<T>()
stack backtrace:
... Note that in this caseit's already failing for |
Confirmed locally on my M1 Mac that the suggested repro crashes, and that latest diff --git a/examples/src/hello_triangle/mod.rs b/examples/src/hello_triangle/mod.rs
index 7c82d49cf0..0100b79024 100644
--- a/examples/src/hello_triangle/mod.rs
+++ b/examples/src/hello_triangle/mod.rs
@@ -12,7 +12,10 @@
let instance = wgpu::Instance::default();
- let surface = instance.create_surface(&window).unwrap();
+ unsafe { instance.as_hal::<wgpu::hal::metal::Api>() };
+
+ let mut surface = instance.create_surface(&window).unwrap();
+ unsafe { surface.as_hal::<wgpu::hal::metal::Api, _, _>(|s| ()) };
let adapter = instance
.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::default(),
@@ -22,6 +25,7 @@
})
.await
.expect("Failed to find an appropriate adapter");
+ unsafe { adapter.as_hal::<wgpu::hal::metal::Api, _, _>(|a| ()) };
// Create the logical device and command queue
let (device, queue) = adapter
@@ -38,6 +42,7 @@
)
.await
.expect("Failed to create device");
+ unsafe { device.as_hal::<wgpu::hal::metal::Api, _, _>(|d| ()) };
// Load the shaders from disk
let shader = device.create_shader_module(wgpu::ShaderModuleDescriptor { |
Yep, the repro branch no longer crashes after rebasing, thanks! |
Description
@MarijnS95 noted in this comment from #6134 that
Device::as_hal
appears to have regressed to crashing when called in some (?) cases.Repro steps
TBD by @MarijnS95.
Expected vs observed behavior
We should keep previous behavior, that is,
Device::as_hal
should not crash.Platform
Windows on DX12.
The text was updated successfully, but these errors were encountered: