Created
March 27, 2020 20:30
-
-
Save quentinfasquel/366d4d8b89ed581f1f3fdaf9f2e119b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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