Commit b1f186f3 authored by Tobias Due Munk's avatar Tobias Due Munk

Fix custom CIBlendKernel not working on iOS 13 beta 2

parent 1543f1d1
......@@ -15,7 +15,13 @@ let task4: Effect = { originalImage, depthMap in
let metalLibraryUrl = Bundle.main.url(forResource: "default", withExtension: "metallib")!
let metalLibraryData = try! Data(contentsOf: metalLibraryUrl)
// Find the kernel of interest.
let filter = try! CIBlendKernel(functionName: "task4", fromMetalLibraryData: metalLibraryData)
// Use the kernel to process the images
return filter.apply(foreground: foreground, background: background)
if #available(iOS 13, *) {
let filter = try! CIColorKernel(functionName: "task4", fromMetalLibraryData: metalLibraryData)
return filter.apply(extent: foreground.extent, arguments: [foreground, background])
} else {
let filter = try! CIBlendKernel(functionName: "task4", fromMetalLibraryData: metalLibraryData)
return filter.apply(foreground: foreground, background: background)
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment