102 {
103 [super viewDidLoad];
104 if (!fGrContext) {
105 [self setMetalDevice:MTLCreateSystemDefaultDevice()];
106 [self setMetalQueue:[[self metalDevice] newCommandQueue]];
108 }
110 NSLog(@"Metal is not supported on this device");
111 self.view = [[UIView alloc] initWithFrame:self.view.frame];
112 return;
113 }
114 MTKView* mtkView = (MTKView*)[self view];
115 [mtkView setDevice:[self metalDevice]];
116 [mtkView setBackgroundColor:[UIColor blackColor]];
119 [viewDelegate setGrContext:fGrContext.get()];
120 [viewDelegate setMetalQueue:[self metalQueue]];
122 [mtkView setDelegate:viewDelegate];
123}
id< MTLDevice > metalDevice
id< MTLCommandQueue > metalQueue
void mtkView:drawableSizeWillChange:(nonnull MTKView *view, [drawableSizeWillChange] CGSize size)