From 64bf58a05665d9033bf705871ac7f9ba4f1f71f4 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Wed, 19 Jul 2023 23:51:42 +0200 Subject: [PATCH] Add a basic test for mismatched devices (#3926) --- tests/tests/device.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/tests/device.rs b/tests/tests/device.rs index cfd9ac960..945d5476d 100644 --- a/tests/tests/device.rs +++ b/tests/tests/device.rs @@ -9,3 +9,30 @@ fn device_initialization() { // intentionally empty }) } + +#[test] +#[ignore] +fn device_mismatch() { + initialize_test(TestParameters::default().failure(), |ctx| { + // Create a bind group uisng a lyaout from another device. This should be a validation + // error but currently crashes. + let (device2, _) = + pollster::block_on(ctx.adapter.request_device(&Default::default(), None)).unwrap(); + + { + let bind_group_layout = + device2.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { + label: None, + entries: &[], + }); + + let _bind_group = ctx.device.create_bind_group(&wgpu::BindGroupDescriptor { + label: None, + layout: &bind_group_layout, + entries: &[], + }); + } + + ctx.device.poll(wgpu::Maintain::Poll); + }); +}