xcodecompilationshadermetal

Manually Compile Metal Shaders


I'm interested in moving away from Xcode and manually compiling Metal shaders in a project for a mixed-language application.

I have no idea how to do this, though. Xcode hides the details of shader compilation and subsequent loading into the application at runtime (you just call device.newDefaultLibrary()). Is this even possible, or will I have to use runtime shader compilation for my purposes?


Solution

  • Generally, you have three ways to load a shader library in Metal: