Offline compilation of metal shader files

Hi,


I am trying to compile my metal shader files into an .metallib file using the command line utilities. The instructions in the documentation involve the use of 3 command line tools: metal, metal-ar and metallib. However, I have downloaded the command line tools (for Xcode 6.4) and no where on my computer are these files located (according to spotlight), also the terminal doesn't recognise these commands. To date I have been using xcode to compile my shaders source files into to the default library, but now I want to take the metal shader source code out of the app and only include a precompiled metallib file. Any help in this matter would be greatly appreciated. OS X 10.10.5, Xcode 6.4


Cheers,


Gary

I found them, for anyone else looking for them they are in the xcode application (spotlight doesn't find them): /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/bin


Cheers,


Gary

Even though I found the command line utilities to build a .metallib file from a .metal file, I still cant achieve this using the terminal. Is there anyone who has experience doing this that could give me a couple of pointers, or is there any other way to create the .metallib file, so I dont need to include shader source files in my app?


Cheers,


Gary

The GLSL optimizer tests project uses this command to validate the output of their glsl -> metal translation, I imagine something like this is what you're looking for?


/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/usr/bin/metal metalTemp.metal -o metalTemp.o -std=ios-metal1.0 -Wno-parentheses-equality


EDIT: original reply had a link to glsl optimizer github page but was stuck in moderation, so just google for it if you're interested 😀

Offline compilation of metal shader files
 
 
Q