objc2-metal-kit 0.3.2

Bindings to the MetalKit framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
use objc2_app_kit::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
use objc2_foundation::*;
use objc2_metal::*;
#[cfg(feature = "objc2-quartz-core")]
use objc2_quartz_core::*;

use crate::*;

extern_class!(
    /// View for rendering metal content
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalkit/mtkview?language=objc)
    #[unsafe(super(NSView, NSResponder, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2-app-kit")]
    #[cfg(target_os = "macos")]
    pub struct MTKView;
);

#[cfg(all(feature = "objc2-app-kit", feature = "objc2-quartz-core"))]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl CALayerDelegate for MTKView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAccessibility for MTKView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for MTKView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for MTKView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSAppearanceCustomization for MTKView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSCoding for MTKView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSDraggingDestination for MTKView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSObjectProtocol for MTKView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for MTKView {}
);

#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl MTKView {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// Initalize the view with a frame and device
        ///
        /// Parameter `frameRect`: The frame rectangle for the created view object.
        ///
        /// Parameter `device`: The MTLDevice to be used by the view to create Metal objects
        #[unsafe(method(initWithFrame:device:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame_device(
            this: Allocated<Self>,
            frame_rect: CGRect,
            device: Option<&ProtocolObject<dyn MTLDevice>>,
        ) -> Retained<Self>;

        /// Returns a view initalized from data in a given unarchiver
        ///
        /// Parameter `coder`: An unarchiver object
        ///
        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;

        /// The delegate handling common view operations
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn MTKViewDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn MTKViewDelegate>>);

        /// The MTLDevice used to create Metal objects
        ///
        /// This must be explicitly set by the application unless it was passed into the initializer. Defaults to nil
        #[unsafe(method(device))]
        #[unsafe(method_family = none)]
        pub fn device(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;

        /// Setter for [`device`][Self::device].
        #[unsafe(method(setDevice:))]
        #[unsafe(method_family = none)]
        pub fn setDevice(&self, device: Option<&ProtocolObject<dyn MTLDevice>>);

        #[cfg(feature = "objc2-quartz-core")]
        /// The drawable to be used for the current frame.
        ///
        /// currentDrawable is updated at the end -draw (i.e. after the delegate's drawInMTKView method is called)
        #[unsafe(method(currentDrawable))]
        #[unsafe(method_family = none)]
        pub fn currentDrawable(&self) -> Option<Retained<ProtocolObject<dyn CAMetalDrawable>>>;

        /// If the currentDrawable can be used for sampling or texture read operations
        ///
        /// This defaults to YES. This property controls whether or not the returned drawables' MTLTextures may only be used for framebuffer attachments (YES) or whether they may also be used for texture sampling and pixel read/write operations (NO). A value of YES allows the CAMetalLayer to allocate the MTLTexture objects in ways that are optimized for display purposes that makes them unsuitable for sampling. The recommended value for most applications is YES.
        #[unsafe(method(framebufferOnly))]
        #[unsafe(method_family = none)]
        pub fn framebufferOnly(&self) -> bool;

        /// Setter for [`framebufferOnly`][Self::framebufferOnly].
        #[unsafe(method(setFramebufferOnly:))]
        #[unsafe(method_family = none)]
        pub fn setFramebufferOnly(&self, framebuffer_only: bool);

        /// The usage flags set on the depth attachment.
        ///
        /// This property controls the texture usage flags set on the MTKView's depth-stencil attachment on creation.  This value defaults to MTLTextureUsageRenderTarget. The recommended value for most applications is MTLTextureUsageRenderTarget. Changing this value re-creates the depth attachment, but any data currently in the depth attachment will be lost.
        #[unsafe(method(depthStencilAttachmentTextureUsage))]
        #[unsafe(method_family = none)]
        pub fn depthStencilAttachmentTextureUsage(&self) -> MTLTextureUsage;

        /// Setter for [`depthStencilAttachmentTextureUsage`][Self::depthStencilAttachmentTextureUsage].
        #[unsafe(method(setDepthStencilAttachmentTextureUsage:))]
        #[unsafe(method_family = none)]
        pub fn setDepthStencilAttachmentTextureUsage(
            &self,
            depth_stencil_attachment_texture_usage: MTLTextureUsage,
        );

        /// The texture usage flags for the multisample color attachment.
        ///
        /// This property controls the texture usage flags set on the the multisample color attachment attachment.  This value defaults to MTLTextureUsageRenderTarget. The recommended value for most applications is MTLTextureUsageRenderTarget. Changing this value re-creates the multisample color attachment, but any data currently in the multisample color attachment will be lost.
        #[unsafe(method(multisampleColorAttachmentTextureUsage))]
        #[unsafe(method_family = none)]
        pub fn multisampleColorAttachmentTextureUsage(&self) -> MTLTextureUsage;

        /// Setter for [`multisampleColorAttachmentTextureUsage`][Self::multisampleColorAttachmentTextureUsage].
        #[unsafe(method(setMultisampleColorAttachmentTextureUsage:))]
        #[unsafe(method_family = none)]
        pub fn setMultisampleColorAttachmentTextureUsage(
            &self,
            multisample_color_attachment_texture_usage: MTLTextureUsage,
        );

        /// If the layer should be presented synchronously
        ///
        /// Defaults to NO. When NO, changes to the layer's render buffer appear on-screen asynchronously to normal layer updates. When YES, changes to the MTL content are sent to the screen via the standard CATransaction mechanisms.
        #[unsafe(method(presentsWithTransaction))]
        #[unsafe(method_family = none)]
        pub fn presentsWithTransaction(&self) -> bool;

        /// Setter for [`presentsWithTransaction`][Self::presentsWithTransaction].
        #[unsafe(method(setPresentsWithTransaction:))]
        #[unsafe(method_family = none)]
        pub fn setPresentsWithTransaction(&self, presents_with_transaction: bool);

        /// The pixelFormat for the drawable's texture.
        #[unsafe(method(colorPixelFormat))]
        #[unsafe(method_family = none)]
        pub fn colorPixelFormat(&self) -> MTLPixelFormat;

        /// Setter for [`colorPixelFormat`][Self::colorPixelFormat].
        #[unsafe(method(setColorPixelFormat:))]
        #[unsafe(method_family = none)]
        pub fn setColorPixelFormat(&self, color_pixel_format: MTLPixelFormat);

        /// The pixelFormat used to create depthStencilTexture
        #[unsafe(method(depthStencilPixelFormat))]
        #[unsafe(method_family = none)]
        pub fn depthStencilPixelFormat(&self) -> MTLPixelFormat;

        /// Setter for [`depthStencilPixelFormat`][Self::depthStencilPixelFormat].
        #[unsafe(method(setDepthStencilPixelFormat:))]
        #[unsafe(method_family = none)]
        pub fn setDepthStencilPixelFormat(&self, depth_stencil_pixel_format: MTLPixelFormat);

        /// The storage mode for the depthStencilTexture. Defaults to MTLStorageModePrivate.
        #[unsafe(method(depthStencilStorageMode))]
        #[unsafe(method_family = none)]
        pub fn depthStencilStorageMode(&self) -> MTLStorageMode;

        /// Setter for [`depthStencilStorageMode`][Self::depthStencilStorageMode].
        #[unsafe(method(setDepthStencilStorageMode:))]
        #[unsafe(method_family = none)]
        pub fn setDepthStencilStorageMode(&self, depth_stencil_storage_mode: MTLStorageMode);

        /// The sample count used to to create multisampleColorTexture
        ///
        /// This defaults to 1.  If sampleCount is greater than 1 a multisampled color texture will be created and the currentDrawable's texture will be set as the resolve texture in the currentRenderPassDescriptor and the store action will be set to MTLStoreActionMultisampleResolve
        #[unsafe(method(sampleCount))]
        #[unsafe(method_family = none)]
        pub fn sampleCount(&self) -> NSUInteger;

        /// Setter for [`sampleCount`][Self::sampleCount].
        #[unsafe(method(setSampleCount:))]
        #[unsafe(method_family = none)]
        pub fn setSampleCount(&self, sample_count: NSUInteger);

        /// The clear color value used to generate the currentRenderPassDescriptor
        ///
        /// This defaults to (0.0, 0.0, 0.0, 1.0)
        #[unsafe(method(clearColor))]
        #[unsafe(method_family = none)]
        pub fn clearColor(&self) -> MTLClearColor;

        /// Setter for [`clearColor`][Self::clearColor].
        #[unsafe(method(setClearColor:))]
        #[unsafe(method_family = none)]
        pub fn setClearColor(&self, clear_color: MTLClearColor);

        /// The clear depth value used to generate the currentRenderPassDescriptor
        ///
        /// This defaults to 1.0
        #[unsafe(method(clearDepth))]
        #[unsafe(method_family = none)]
        pub fn clearDepth(&self) -> c_double;

        /// Setter for [`clearDepth`][Self::clearDepth].
        #[unsafe(method(setClearDepth:))]
        #[unsafe(method_family = none)]
        pub fn setClearDepth(&self, clear_depth: c_double);

        /// The clear stencil value used to generate currentRenderPassDescriptor
        ///
        /// This defaults to 0
        #[unsafe(method(clearStencil))]
        #[unsafe(method_family = none)]
        pub fn clearStencil(&self) -> u32;

        /// Setter for [`clearStencil`][Self::clearStencil].
        #[unsafe(method(setClearStencil:))]
        #[unsafe(method_family = none)]
        pub fn setClearStencil(&self, clear_stencil: u32);

        /// A packed depth and stencil texture to be attached to a MTLRenderPassDescriptor
        ///
        /// The view will generate the depth buffer using the specified depthPixelFormat.  This will be nil if depthStencilPixelFormat is MTLPixelFormatInvalid.
        #[unsafe(method(depthStencilTexture))]
        #[unsafe(method_family = none)]
        pub fn depthStencilTexture(&self) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;

        /// A multisample color texture that will be resolved into the currentDrawable's texture
        ///
        /// The view will generate the multisample color buffer using the specified colorPixelFormat.  This will be nil if sampleCount is less than or equal to 1.
        #[unsafe(method(multisampleColorTexture))]
        #[unsafe(method_family = none)]
        pub fn multisampleColorTexture(&self) -> Option<Retained<ProtocolObject<dyn MTLTexture>>>;

        /// Release the depthStencilTexture and multisampleColorTexture
        ///
        /// Can be called by the app to release the textures in order to conserve memory when it goes into the background.   The view will recreate multisampleColorTexture or depthStencilTexture upon the next access of the respective properties.  Both multisampleColorTexture and depthStencilTexture will be recreated in the access to currentRenderPassDescriptor.
        #[unsafe(method(releaseDrawables))]
        #[unsafe(method_family = none)]
        pub fn releaseDrawables(&self);

        /// A render pass descriptor generated from the currentDrawable's texture and the view's depth, stencil, and sample buffers and clear values.
        ///
        /// This is a convience property.  The view does not use this descriptor and there is no requirement for an app to use this descriptor.
        #[unsafe(method(currentRenderPassDescriptor))]
        #[unsafe(method_family = none)]
        pub fn currentRenderPassDescriptor(&self) -> Option<Retained<MTLRenderPassDescriptor>>;

        /// A render pass descriptor generated from the currentDrawable's texture and the view's depth, stencil, and sample buffers and clear values.
        ///
        /// This is a convience property.  The view does not use this descriptor and there is no requirement for an app to use this descriptor.
        #[unsafe(method(currentMTL4RenderPassDescriptor))]
        #[unsafe(method_family = none)]
        pub fn currentMTL4RenderPassDescriptor(&self)
            -> Option<Retained<MTL4RenderPassDescriptor>>;

        /// The rate you want the view to redraw its contents.
        ///
        /// When your application sets its preferred frame rate, the view chooses a frame rate as close to that as possible based on the capabilities of the screen the view is displayed on. The actual frame rate chosen is usually a factor of the maximum refresh rate of the screen to provide a consistent frame rate. For example, if the maximum refresh rate of the screen is 60 frames per second, that is also the highest frame rate the view sets as the actual frame rate. However, if you ask for a lower frame rate, it might choose 30, 20, 15 or some other factor to be the actual frame rate. Your application should choose a frame rate that it can consistently maintain. The default value is 60 frames per second.
        #[unsafe(method(preferredFramesPerSecond))]
        #[unsafe(method_family = none)]
        pub fn preferredFramesPerSecond(&self) -> NSInteger;

        /// Setter for [`preferredFramesPerSecond`][Self::preferredFramesPerSecond].
        #[unsafe(method(setPreferredFramesPerSecond:))]
        #[unsafe(method_family = none)]
        pub fn setPreferredFramesPerSecond(&self, preferred_frames_per_second: NSInteger);

        /// Controls whether the view responds to setNeedsDisplay.
        ///
        /// If true, then the view behaves similarily to a UIView or NSView, responding to calls to setNeedsDisplay. When the view has been marked for display, the view is automatically redisplayed on each pass through the application’s event loop. Setting enableSetNeedsDisplay to true will also pause the MTKView's internal render loop and updates will instead be event driven. The default value is false.
        #[unsafe(method(enableSetNeedsDisplay))]
        #[unsafe(method_family = none)]
        pub fn enableSetNeedsDisplay(&self) -> bool;

        /// Setter for [`enableSetNeedsDisplay`][Self::enableSetNeedsDisplay].
        #[unsafe(method(setEnableSetNeedsDisplay:))]
        #[unsafe(method_family = none)]
        pub fn setEnableSetNeedsDisplay(&self, enable_set_needs_display: bool);

        /// Controls whether to resize the drawable as the view changes size.
        ///
        /// If true, the size of the currentDrawable's texture, depthStencilTexture, and multisampleColorTexture will automatically resize as the view resizes.  If false, these textures will take on the size of drawableSize and drawableSize will not change. The default value is true.
        #[unsafe(method(autoResizeDrawable))]
        #[unsafe(method_family = none)]
        pub fn autoResizeDrawable(&self) -> bool;

        /// Setter for [`autoResizeDrawable`][Self::autoResizeDrawable].
        #[unsafe(method(setAutoResizeDrawable:))]
        #[unsafe(method_family = none)]
        pub fn setAutoResizeDrawable(&self, auto_resize_drawable: bool);

        #[cfg(feature = "objc2-core-foundation")]
        /// The current size of drawable textures
        ///
        /// The size currentDrawable's texture, depthStencilTexture, and multisampleColorTexture.  If autoResizeDrawable is true this value will be updated as the view's size changes. If autoResizeDrawable is false, this can be set to fix the size of the drawable textures.
        #[unsafe(method(drawableSize))]
        #[unsafe(method_family = none)]
        pub fn drawableSize(&self) -> CGSize;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`drawableSize`][Self::drawableSize].
        #[unsafe(method(setDrawableSize:))]
        #[unsafe(method_family = none)]
        pub fn setDrawableSize(&self, drawable_size: CGSize);

        #[cfg(feature = "objc2-core-foundation")]
        /// The preferred drawable size reported by the backing NSView to match a NSView's native resolution.
        ///
        /// this value can be observed via key-value observation to determine if the current native drawable size has changed.
        #[unsafe(method(preferredDrawableSize))]
        #[unsafe(method_family = none)]
        pub fn preferredDrawableSize(&self) -> CGSize;

        /// The preferred device is updated per-frame by the system in order to identify the most efficient GPU for presentation (e.g. the one being used for compositing).
        ///
        /// This value is determined by the underlying CAMetalLayer and this property is a convenience accessor for it.
        #[unsafe(method(preferredDevice))]
        #[unsafe(method_family = none)]
        pub fn preferredDevice(&self) -> Option<Retained<ProtocolObject<dyn MTLDevice>>>;

        /// Controls whether the draw methods should countinue at preferredFramesPerSecond
        ///
        /// If true, the delegate will receive drawInMTKView: messages or the subclass will receive drawRect: messages at a rate of preferredFramesPerSecond based on an internal timer. The default value is false.
        #[unsafe(method(isPaused))]
        #[unsafe(method_family = none)]
        pub fn isPaused(&self) -> bool;

        /// Setter for [`isPaused`][Self::isPaused].
        #[unsafe(method(setPaused:))]
        #[unsafe(method_family = none)]
        pub fn setPaused(&self, paused: bool);

        #[cfg(feature = "objc2-core-graphics")]
        /// The colorspace of the rendered frames. '
        ///
        /// If nil, no colormatching occurs.  If non-nil, the rendered content will be colormatched to the colorspace of the context containing this layer (typically the display's colorspace).  This property aliases the olorspace property or the view's CAMetalLayer
        #[unsafe(method(colorspace))]
        #[unsafe(method_family = none)]
        pub fn colorspace(&self) -> Option<Retained<CGColorSpace>>;

        #[cfg(feature = "objc2-core-graphics")]
        /// Setter for [`colorspace`][Self::colorspace].
        #[unsafe(method(setColorspace:))]
        #[unsafe(method_family = none)]
        pub fn setColorspace(&self, colorspace: Option<&CGColorSpace>);

        /// Manually ask the view to draw new contents. This causes the view to call either the drawInMTKView (delegate) or drawRect (subclass) method.
        ///
        /// Manually ask the view to draw new contents. This causes the view to call either the drawInMTKView (delegate) or drawRect (subclass) method. This should be used when the view's paused proprety is set to true and enableSetNeedsDisplay is set to false.
        #[unsafe(method(draw))]
        #[unsafe(method_family = none)]
        pub fn draw(&self);
    );
}

/// Methods declared on superclass `NSView`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl MTKView {
    extern_methods!(
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSResponder`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl MTKView {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2-app-kit")]
#[cfg(target_os = "macos")]
impl MTKView {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

extern_protocol!(
    /// Allows an object to render into the view and respond to resize events
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalkit/mtkviewdelegate?language=objc)
    pub unsafe trait MTKViewDelegate: NSObjectProtocol + MainThreadOnly {
        #[cfg(all(feature = "objc2-app-kit", feature = "objc2-core-foundation"))]
        #[cfg(target_os = "macos")]
        /// Called whenever the drawableSize of the view will change
        ///
        /// Delegate can recompute view and projection matricies or regenerate any buffers to be compatible with the new view size or resolution
        ///
        /// Parameter `view`: MTKView which called this method
        ///
        /// Parameter `size`: New drawable size in pixels
        #[unsafe(method(mtkView:drawableSizeWillChange:))]
        #[unsafe(method_family = none)]
        fn mtkView_drawableSizeWillChange(&self, view: &MTKView, size: CGSize);

        #[cfg(feature = "objc2-app-kit")]
        #[cfg(target_os = "macos")]
        /// Called on the delegate when it is asked to render into the view
        ///
        /// Called on the delegate when it is asked to render into the view
        #[unsafe(method(drawInMTKView:))]
        #[unsafe(method_family = none)]
        fn drawInMTKView(&self, view: &MTKView);
    }
);