Selecting Metal 3.2 as language causes crash on iPhone 11 Pro (iOS 17.1.1)

XCode 16 seems to have an issue with stitchable kernels in Core Image which gives build errors as stated in this question. As a workaround, I selected Metal 3.2 as Metal Language Revision in XCode project. It works on newer devices like iPhone 13 pro and above but metal texture creation fails on older devices like iPhone 11 pro. Is this a known issue and is there a workaround? I tried selecting Metal language revision to 2.4 but the same build errors occur as reported in this question. Here is the code where assertion failure happens on iPhone 11 Pro.

let vertexShader = library.makeFunction(name: "vertexShaderPassthru")
            let fragmentShaderYUV = library.makeFunction(name: "fragmentShaderYUV")
            
            let pipelineDescriptorYUV = MTLRenderPipelineDescriptor()
            pipelineDescriptorYUV.rasterSampleCount = 1
            pipelineDescriptorYUV.colorAttachments[0].pixelFormat = .bgra8Unorm
            pipelineDescriptorYUV.depthAttachmentPixelFormat = .invalid
            
            pipelineDescriptorYUV.vertexFunction = vertexShader
            pipelineDescriptorYUV.fragmentFunction = fragmentShaderYUV
            
            do {
                try pipelineStateYUV = metalDevice?.makeRenderPipelineState(descriptor: pipelineDescriptorYUV)
            }
            catch {
                assertionFailure("Failed creating a render state pipeline. Can't render the texture without one.")
                return
            }

Answered by DTS Engineer in 808180022

As mentioned elsewhere, you may use the original extern “c” method for custom CI kernels as a workaround on iPhone 11.

For details please watch Explore Core Image kernel improvements.

Dear Apple Engineers/DTS,

Is there any answer for this question?

As mentioned elsewhere, you may use the original extern “c” method for custom CI kernels as a workaround on iPhone 11.

For details please watch Explore Core Image kernel improvements.

That requires modifying hundreds of CI kernel methods, not a good workaround.

Selecting Metal 3.2 as language causes crash on iPhone 11 Pro (iOS 17.1.1)
 
 
Q