I met a problem about using xcrun command line tool building a metallib file from metal source , but I use swift codes as follows:
let mstr : String? = Bundle.main.path(forResource: "PS", ofType: "metallib")//it is ok
styleLib = try! device!.makeLibrary(filepath: mstr!)//it crashed here with error
It gives a error like this:
fatal error: 'try!' expression unexpectedly raised an error: Error Domain=MTLLibraryErrorDomain Code=1 "This library format is not supported on this platform (or was built with an old version of the tools)" UserInfo={NSLocalizedDescription=This library format is not supported on this platform (or was built with an old version of the tools)}: file /Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-800.0.63/src/swift/stdlib/public/core/ErrorType.swift, line 178
It seems that my command line tool is old ,but I update it , errors like that also occured.
Anyone meet this?