@@ -272,14 +272,11 @@ fn describe_adapters(adapters: &[Arc<wgpu::Adapter>]) -> String {
272
272
} else if adapters. len ( ) == 1 {
273
273
adapter_info_summary ( & adapters[ 0 ] . get_info ( ) )
274
274
} else {
275
- let mut list_string = String :: new ( ) ;
276
- for adapter in adapters {
277
- if !list_string. is_empty ( ) {
278
- list_string += ", " ;
279
- }
280
- list_string += & format ! ( "{{{}}}" , adapter_info_summary( & adapter. get_info( ) ) ) ;
281
- }
282
- list_string
275
+ adapters
276
+ . iter ( )
277
+ . map ( |a| format ! ( "{{{}}}" , adapter_info_summary( & a. get_info( ) ) ) )
278
+ . collect :: < Vec < _ > > ( )
279
+ . join ( ", " )
283
280
}
284
281
}
285
282
@@ -646,12 +643,27 @@ pub fn adapter_info_summary(info: &wgpu::AdapterInfo) -> String {
646
643
summary += & format ! ( ", driver_info: {driver_info:?}" ) ;
647
644
}
648
645
if * vendor != 0 {
649
- // TODO(emilk): decode using https://github.com/gfx-rs/wgpu/blob/767ac03245ee937d3dc552edc13fe7ab0a860eec/wgpu-hal/src/auxil/mod.rs#L7
650
- summary += & format ! ( ", vendor: 0x{vendor:04X}" ) ;
646
+ summary += & format ! ( ", vendor: {} (0x{vendor:04X})" , parse_vendor_id( * vendor) ) ;
651
647
}
652
648
if * device != 0 {
653
649
summary += & format ! ( ", device: 0x{device:02X}" ) ;
654
650
}
655
651
656
652
summary
657
653
}
654
+
655
+ /// Tries to parse the adapter's vendor ID to a human-readable string.
656
+ pub fn parse_vendor_id ( vendor_id : u32 ) -> & ' static str {
657
+ match vendor_id {
658
+ wgpu:: hal:: auxil:: db:: amd:: VENDOR => "AMD" ,
659
+ wgpu:: hal:: auxil:: db:: apple:: VENDOR => "Apple" ,
660
+ wgpu:: hal:: auxil:: db:: arm:: VENDOR => "ARM" ,
661
+ wgpu:: hal:: auxil:: db:: broadcom:: VENDOR => "Broadcom" ,
662
+ wgpu:: hal:: auxil:: db:: imgtec:: VENDOR => "Imagination Technologies" ,
663
+ wgpu:: hal:: auxil:: db:: intel:: VENDOR => "Intel" ,
664
+ wgpu:: hal:: auxil:: db:: mesa:: VENDOR => "Mesa" ,
665
+ wgpu:: hal:: auxil:: db:: nvidia:: VENDOR => "NVIDIA" ,
666
+ wgpu:: hal:: auxil:: db:: qualcomm:: VENDOR => "Qualcomm" ,
667
+ _ => "Unknown" ,
668
+ }
669
+ }
0 commit comments