Shared custom includes between metal files

Is it possible to have several .metal files in you Xcode project that includes not only the standard libraries but also custom include files with C++ functions or common definitions that are used by your shaders? I have some inline functions that I don't want to copy to all the other .metal files that needs them also.

Replies

Yeah, sure. Just like any other headers. I even had a project that had some C macros/functions carefully crafted do that they'd compile both in Metal and in ObjectiveC.

Yes, also you can declare those functions in header file and implement in any .metal file. I can be wrong, but it seems like compiler forces functions inlining anyway, thus there is no call overhead.