File tree Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Expand file tree Collapse file tree 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -146,20 +146,15 @@ impl Plugin for RenderPlugin {
146
146
if let Some ( backends) = options. backends {
147
147
let windows = app. world . resource_mut :: < bevy_window:: Windows > ( ) ;
148
148
let instance = wgpu:: Instance :: new ( backends) ;
149
- let surface = {
150
- if let Some ( window) = windows. get_primary ( ) {
151
- if let Some ( raw_window_handle) = window. raw_window_handle ( ) {
152
- unsafe {
153
- let handle = raw_window_handle. get_handle ( ) ;
154
- Some ( instance. create_surface ( & handle) )
155
- }
156
- } else {
157
- None
158
- }
159
- } else {
160
- None
161
- }
162
- } ;
149
+
150
+ let surface = windows
151
+ . get_primary ( )
152
+ . and_then ( |window| window. raw_window_handle ( ) )
153
+ . map ( |wrapper| unsafe {
154
+ let handle = wrapper. get_handle ( ) ;
155
+ instance. create_surface ( & handle)
156
+ } ) ;
157
+
163
158
let request_adapter_options = wgpu:: RequestAdapterOptions {
164
159
power_preference : options. power_preference ,
165
160
compatible_surface : surface. as_ref ( ) ,
You can’t perform that action at this time.
0 commit comments