Executing Shaders in Metal and OpenGL

Toggle between renderers to make sure your shader code compiles in both the Metal and OpenGL environments.


On devices that support it, the GLSL code you provide to SKShader is automatically converted to Metal shading language and run on a Metal renderer. On older devices, shader code is run in OpenGL. It's important to be mindful of this for debugging purposes because some issues may appear in one renderer but not the other.

You can specify which renderer your device uses—for example, forcing a Metal-enabled device to use SpriteKit's OpenGL renderer for debugging purposes—by adding a PrefersOpenGL to your app's Info.plist key with a value of true. See Requesting the OpenGL Renderer for more information.