File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ mod multi_instance {
2+ #![ cfg( not( target_arch = "wasm32" ) ) ]
3+
4+ async fn get ( ) -> wgpu:: Adapter {
5+ let adapter = {
6+ let instance = wgpu:: Instance :: new ( & wgpu:: InstanceDescriptor {
7+ backends : wgpu:: Backends :: from_env ( ) . unwrap_or_default ( ) ,
8+ ..Default :: default ( )
9+ } ) ;
10+ instance
11+ . request_adapter ( & wgpu:: RequestAdapterOptions :: default ( ) )
12+ . await
13+ . unwrap ( )
14+ } ;
15+
16+ log:: info!( "Selected adapter: {:?}" , adapter. get_info( ) ) ;
17+
18+ adapter
19+ }
20+
21+ #[ test]
22+ pub fn multi_instance ( ) {
23+ {
24+ env_logger:: init ( ) ;
25+
26+ // Sequential instances.
27+ for _ in 0 ..3 {
28+ pollster:: block_on ( get ( ) ) ;
29+ }
30+
31+ // Concurrent instances
32+ let _instances: Vec < _ > = ( 0 ..3 ) . map ( |_| pollster:: block_on ( get ( ) ) ) . collect ( ) ;
33+ }
34+ }
35+ }
36+
137mod request_adapter_error {
238 fn id ( backends : wgpu:: Backends ) -> wgpu:: InstanceDescriptor {
339 wgpu:: InstanceDescriptor {
You can’t perform that action at this time.
0 commit comments