Rendering CIImage results in a blank image on macOS 10.15.7 (19H1030)


After installing the Security Update 2021-002 Catalina, rendering a Core Image image stopped working properly. The code below results in a blank image:

    let ciContext = CIContext(options: [.useSoftwareRenderer: true])
    guard let srcPath = Bundle.main.path(forResource: "Flowers", ofType: "jpg"),
        let ciImage = CIImage(contentsOf: URL(fileURLWithPath: srcPath)) else { return }
    let dstUrl = URL(fileURLWithPath: NSString("~/Desktop/1.jpg").expandingTildeInPath)
    guard let destination = CGImageDestinationCreateWithURL(dstUrl as CFURL, kUTTypeJPEG, 1, nil) else { return }
    guard let cgImage = ciContext.createCGImage(ciImage, from: ciImage.extent) else { return }
    CGImageDestinationAddImage(destination, cgImage, nil)

The following error is printed to the console:

** OpenCL Error Notification: [CL_DEVICE_NOT_AVAILABLE] : OpenCL Error : Error: build program driver returned (-1) **
** OpenCL Error Notification: OpenCL Warning : clBuildProgram failed: could not build program for 0xffffffff (Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz) (err:-1) ** Native OpenCL program build failed:

The temporary solution to fix this issue is to disable software rendering by setting the useSoftwareRenderer option to false when creating a CIContext.

Any help would be greatly appreciated.

asked on Stack Overflow Apr 29, 2021 by Vika

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0