I am creating a framework which includes several metal files, while creating default library using device?.makeDefaultLibrary()
(when this framework is embedded in a project), application is crashing. It turns out that without specifying Bundle()
to makeDefaultLibrary()
it only searches for library in main bundle, but as per requirement compiler should search for library in embedded framework's bundle (a .metallib file is being generated while creating Framework).
I have tried specifying bundle as below:
A.
let frameworkBundle = Bundle(for: type(of: self))
let bundleLib = try device?.makeDefaultLibrary(bundle: frameworkBundle)
B.
let frameworkBundle = Bundle(identifier: "com.myframework")
let bundleLib = try device?.makeDefaultLibrary(bundle: frameworkBundle)
Still the application is crashing, I have also noticed that in both the above methods frameworkBundle is returned as nil.