File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -75,12 +75,23 @@ impl GuiController {
75
75
adapter_info. name,
76
76
adapter_info. device_type
77
77
) ;
78
- let surface_format = surface
79
- . get_capabilities ( & adapter)
80
- . formats
81
- . first ( )
82
- . cloned ( )
83
- . expect ( "At least one format should be supported" ) ;
78
+ let preferred_formats = [
79
+ // by egui
80
+ wgpu:: TextureFormat :: Rgba8Unorm ,
81
+ wgpu:: TextureFormat :: Bgra8Unorm ,
82
+ ] ;
83
+ let supported_formats = surface. get_capabilities ( & adapter) . formats ;
84
+ let surface_format = preferred_formats
85
+ . iter ( )
86
+ . find ( |format| supported_formats. contains ( format) )
87
+ . copied ( )
88
+ . unwrap_or_else ( || {
89
+ supported_formats
90
+ . first ( )
91
+ . copied ( )
92
+ . expect ( "At least one format should be supported" )
93
+ } ) ;
94
+ tracing:: info!( "Using surface format {:?}" , surface_format) ;
84
95
let size = window. inner_size ( ) ;
85
96
surface. configure (
86
97
& device,
You can’t perform that action at this time.
0 commit comments