Go to the source code of this file.
◆ GetMetalContext()
Definition at line 15 of file metal_context_helper.mm.
15 {
17 sk_cfp<id<MTLDevice>>
device;
18#if defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR)
19 device.reset(MTLCreateSystemDefaultDevice());
20#else
21 sk_cfp<NSArray<id <MTLDevice>>*> availableDevices(MTLCopyAllDevices());
22
23 for (id<MTLDevice> dev in availableDevices.get()) {
24 if (!dev.isLowPower) {
26 break;
27 }
28 if (dev.isRemovable) {
30 break;
31 }
32 }
34 device.reset(MTLCreateSystemDefaultDevice());
35 }
36#endif
37
39 sk_cfp<id<MTLCommandQueue>>
queue([*
device newCommandQueue]);
41 return backendContext;
42}
sk_cfp< GrMTLHandle > fDevice
sk_cfp< GrMTLHandle > fQueue