Reputation: 1271
I'm trying to make a cocoa touch framework that will be performing some parallel computations on OSX/iOS and I'm having some issues with setting up the tests. Whenever I try to run :
library = device.newDefaultLibrary()!
I get hit by the error :
/Library/Caches/com.apple.xbs/Sources/Metal/Metal-55.2.8/Framework/MTLLibrary.mm:1016: failed assertion `filepath must not be nil.'
I was also trying to load shaders straight from the bundle without success.
How do I load up metal shaders properly so I can use them within a framework / tests?
Thanks!
Upvotes: 2
Views: 912
Reputation: 9533
You can load a Metal library from your framework with this code:
let library = try! sceneKitView.device!.newLibraryWithFile(NSBundle(forClass: TheNameOfThisClass.self).URLForResource("default", withExtension: "metallib")!.path!)
BUT I filed rdar://22618641 in September 2015 with a sample project that demonstrates that you can’t load precompiled Metal libraries from frameworks — you get the same error you saw above when you try to use the library.
(Well, you CAN load the library, you just can’t actually use it.)
Upvotes: 1