Skip to content

Instantly share code, notes, and snippets.

@quentinfasquel
Created March 27, 2020 20:30
Show Gist options
  • Save quentinfasquel/366d4d8b89ed581f1f3fdaf9f2e119b3 to your computer and use it in GitHub Desktop.
Save quentinfasquel/366d4d8b89ed581f1f3fdaf9f2e119b3 to your computer and use it in GitHub Desktop.
import CoreImage
import Metal
private func defaultMetalLibrary() throws -> Data {
let url = Bundle.main.url(forResource: "default", withExtension: "metallib")!
return try Data(contentsOf: url)
}
extension CIKernel {
/// Init CI kernel with just a `functionName` directly from default metal library
convenience init(functionName: String) throws {
let metalLibrary = try defaultMetalLibrary()
try self.init(functionName: functionName, fromMetalLibraryData: metalLibrary)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment