Instance Method


Makes a copy of this kernel object for a new device.


- (instancetype)copyWithZone:(NSZone *)zone device:(id<MTLDevice>)device;



The zone in which to allocate the kernel object.


The Metal device for the new kernel object.

Return Value

A copy of this kernel object.


The same kernel objects should not be used to encode separate kernel operations on multiple command buffers from multiple threads. Many kernels have mutable properties that might be changed by another thread while the kernel is being encoded. If you need to use a kernel from multiple threads, make a copy of it for each additional thread using copyWithZone: or copyWithZone:device:. Note that the copyWithZone: method makes a copy of the kernel object on the same device.

This method fails if the device is not supported. Query the MPSSupportsMTLDevice function to determine whether the device is supported.

See Also


- initWithDevice:

Initializes a new kernel object.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software