mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-25 08:51:05 +01:00
test: repair multi-instance tests (#7388)
This commit is contained in:
1 parent
c37a005f63
commit
1e172b2e14
2 files changed
+36
-33
No files matched your search
@@ -1,33 +0,0 @@
|
||||
#![cfg(not(target_arch = "wasm32"))]
|
||||
|
||||
async fn get() -> wgpu::Adapter {
|
||||
let adapter = {
|
||||
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
|
||||
backends: wgpu::util::backend_bits_from_env().unwrap_or_default(),
|
||||
..Default::default()
|
||||
});
|
||||
instance
|
||||
.request_adapter(&wgpu::RequestAdapterOptions::default())
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
log::info!("Selected adapter: {:?}", adapter.get_info());
|
||||
|
||||
adapter
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multi_instance() {
|
||||
{
|
||||
env_logger::init();
|
||||
|
||||
// Sequential instances.
|
||||
for _ in 0..3 {
|
||||
pollster::block_on(get());
|
||||
}
|
||||
|
||||
// Concurrent instances
|
||||
let _instances: Vec<_> = (0..3).map(|_| pollster::block_on(get())).collect();
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,39 @@
|
||||
mod multi_instance {
|
||||
#![cfg(not(target_arch = "wasm32"))]
|
||||
|
||||
async fn get() -> wgpu::Adapter {
|
||||
let adapter = {
|
||||
let instance = wgpu::Instance::new(&wgpu::InstanceDescriptor {
|
||||
backends: wgpu::Backends::from_env().unwrap_or_default(),
|
||||
..Default::default()
|
||||
});
|
||||
instance
|
||||
.request_adapter(&wgpu::RequestAdapterOptions::default())
|
||||
.await
|
||||
.unwrap()
|
||||
};
|
||||
|
||||
log::info!("Selected adapter: {:?}", adapter.get_info());
|
||||
|
||||
adapter
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn multi_instance() {
|
||||
{
|
||||
env_logger::init();
|
||||
|
||||
// Sequential instances.
|
||||
for _ in 0..3 {
|
||||
pollster::block_on(get());
|
||||
}
|
||||
|
||||
// Concurrent instances
|
||||
let _instances: Vec<_> = (0..3).map(|_| pollster::block_on(get())).collect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mod request_adapter_error {
|
||||
fn id(backends: wgpu::Backends) -> wgpu::InstanceDescriptor {
|
||||
wgpu::InstanceDescriptor {
|
||||
|
||||
Reference in new issue
Block a user