Disable auto translation of OpenGL Shaders to Metal

During one of the Metal WWDC presentations, they mentioned that OpenGL shaders will automatically get translated to Metal, no work needs to be done on the developer's end.


There's a known bug in iOS 9.x SpriteKit where any shader that uses gl_FragCoord (very common) crashes with a Metal error on Metal compatible devices (it works fine in the simulator or devices that do not support Metal).


My question is: Is there any way to stop this auto translation of OpenGL shaders to Metal? A compiler flag or anything to tell the program to never use Metal or translate anything to Metal?

Replies

When will Apple pay attention to SpriteKit, my games are all broken in iOS9, im receiving bad reviews, and its not my fault. This is terrible.

By default, SpriteKit and SceneKit render with Metal in iOS 9 and OS X El Capitan, however, there is a facility to use OpenGL.


IMPORTANT: For optimal performance, Metal rendering in SpriteKit and SceneKit is enabled by default. Setting PrefersOpenGL rendering key is not recommended unless it is determined necessary for other reasons.


To do that:

  1. Edit your app's Info.plist
  2. Add the
    PrefersOpenGL
    key with a bool value of YES

Fortunately, you're not the only one affected by iOS 9 issues. You could try setting PrefersOpenGL to YES in your Info.plist (as stated in the post below). I'm going to give it a shot later this evening. But Bobjt is right... it may cause you to take a perf hit. You have to decide if this is acceptable or not. (all assuming this fixes anything at all in such regards)


That said... a few well-known devs have removed their games from purchase from the AppStore due to issues with the OS update in general. I'm trying very hard not to do this, but we may have no choice, until Apple resolves these issues properly.

The real problem is gl_FragCoord and gl_FragColor

are gone. Is there a work around until they reappear?