Core Image Kernel Language Shader Gets Translated to Metal and Translation Fails under iOS 10

Originator:Benjamin.Encz
Number:rdar://28639380 Date Originated:05-Oct-2016
Status:Open Resolved:
Product:iOS Product Version:10.0
Classification:Severe Bug Reproducible:Always
 
Summary:
When writing a Core Image Kernel Language Shader, it automatically gets translated to Metal under iOS 10. In our case this translation fails because the `greaterThanEqual` function is apparently unavailable. This is especially severe since there seems to be no way of deactivating this automatic translation for UIKit apps.

Here’s the output from my example project:

Metal library creation failed with error: Error Domain=MTLLibraryErrorDomain Code=3 "Compilation failed: 



program_source:48:22: error: use of undeclared identifier 'greaterThanEqual'

  bool isWhite = all(greaterThanEqual(float3(pixel), float3(tolerance)));

                     ^

" UserInfo={NSLocalizedDescription=Compilation failed: 



program_source:48:22: error: use of undeclared identifier 'greaterThanEqual'

  bool isWhite = all(greaterThanEqual(float3(pixel), float3(tolerance)));

                     ^

Steps to Reproduce:

I’ve uploaded a minimal example project that reproduces the issue here: https://github.com/Ben-G/AppleBugProjects/tree/master/MetaliOS10Issue/SheetCompareTestiOS10

It simply loads an image, applies a Core Image Kernel Shader to it and attempts to add it to a UIImageView. On iOS 10 devices this operation fails with output shown above.

Expected Results:
The shader keeps working as it did on iOS 8 and iOS 9.

Actual Results:
The automatic translation fails and results in an empty image instead of an image that is transformed through the shader.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!