How to find Xcode documentation for metal functions?

Hi folks,

I’m following along with the Metal by Tutorials book, and I’m having a lot of fun. Thanks for the great book!

I see that functions like normalize and saturate are metal functions in the metal namespace. But when I use Xcode docs (option click, etc) on these functions, I see “No quick help” and if I search the docs for these functions in the docs, I don’t find anything. I also looked in Apple’s Metal Shading Language Specification, but I see no mention of the word “saturate” in that document. Since I’m so new to all this, I’m not even sure I’m looking in the right places - can anyone point me to the docs for the metal functions that we’re using in our shaders? Am I missing an Xcode docset?


Hi @alexshepard and welcome to the forums :wave: - I’m glad you’re enjoying the book!

You’re not missing a docset. Metal Shading Language is a subset of C++, so functions like normalize are part of C++.

saturate, (I think) is a special MSL one, so is listed in the MSL Specification in section 6.2 Common Functions.

If you have trouble working out what a function does, please ask here, and I’ll get back to you as soon as I am able.

1 Like

Thanks so much for the quick reply Caroline!

1 Like

I hate to raise expectations :stuck_out_tongue: - it won’t always be that quick!

1 Like

You might want to try exporting the MSL to a different format. You’d think because it’s a PDF that the search function would work, but in my experience, most of the time it doesn’t. I converted it to a Word doc and the search works much much better.

1 Like