File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,13 @@ declare_class!(
152
152
#[ method( drawInMTKView: ) ]
153
153
#[ allow( non_snake_case) ]
154
154
unsafe fn drawInMTKView( & self , _view: & MTKView ) {
155
+ // FIXME: icrate `MTKView` doesn't have a generated binding for `currentDrawable` yet
156
+ // (because it needs a definition of `CAMetalDrawable`, which we don't support yet) so
157
+ // we have to use a raw `msg_send_id` call here instead.
158
+ let current_drawable: Option <Id <ProtocolObject <dyn MTLDrawable >>> =
159
+ msg_send_id![ & * self . mtk_view, currentDrawable] ;
160
+
161
+ let Some ( current_drawable) = current_drawable else { return ; } ;
155
162
let Some ( command_buffer) = self . command_queue. commandBuffer( ) else { return ; } ;
156
163
let Some ( pass_descriptor) = ( unsafe { self . mtk_view. currentRenderPassDescriptor( ) } ) else { return ; } ;
157
164
let Some ( encoder) = command_buffer. renderCommandEncoderWithDescriptor( & pass_descriptor) else { return ; } ;
@@ -179,12 +186,6 @@ declare_class!(
179
186
} ;
180
187
encoder. endEncoding( ) ;
181
188
182
- // FIXME: icrate `MTKView` doesn't have a generated binding for `currentDrawable` yet
183
- // (because it needs a definition of `CAMetalDrawable`, which we don't support yet) so
184
- // we have to use a raw `msg_send_id` call here instead.
185
- let current_drawable: Id <ProtocolObject <dyn MTLDrawable >> =
186
- msg_send_id![ & * self . mtk_view, currentDrawable] ;
187
-
188
189
command_buffer. presentDrawable( & current_drawable) ;
189
190
190
191
command_buffer. commit( ) ;
You can’t perform that action at this time.
0 commit comments