Using MTLBinaryArchives

Hello - I have a few follow up questions from the WWDC presentation on the new binary archive feature for pipeline descriptors. I am experimenting with this snippet of code:

Code Block objective-c
id<MTLBinaryArchive> binary = [device newBinaryArchiveWithDescriptor:descriptor error:&error];
if (error) @throw error;
id<MTLFunction> vtx = [library newFunctionWithName:@"vertexShader"];
id<MTLFunction> frg = [library newFunctionWithName:@"fragmentShader"];
MTLRenderPipelineDescriptor * psd = [MTLRenderPipelineDescriptor new];
psd.vertexDescriptor = [MTLVertexDescriptor newDefaultMTLVertexDescriptor];
psd.vertexFunction = vtx;
psd.fragmentFunction = frg;
psd.binaryArchives = @[binary];
id<MTLRenderPipelineState> pso = [device newRenderPipelineStateWithDescriptor:psd error:&error];

An exception breakpoint hits on Line 13:

Code Block objective-c
[MTLDebugBinaryArchive findProgramObjectForFunction:]: unrecognized selector sent to instance

If I comment out line 11 (psd.binaryArchives = @[binary]), the pipeline compiles as expected. Any ideas why an exception is being thrown if I set the binary archive? The binary serializes to disk and deserializes back into the test app without any errors.

My second question relates to the statement in the presentation to the effect that the binary can only be used by the same device that created it. Does this mean we have to create an archive for A9, A10, A11, etc.? And further, does that mean we need a device with every different kind of chip in it to ship an app that can leverage this feature on a variety of devices?

Thanks in advance.



Using MTLBinaryArchives
 
 
Q