Metal Support by OS

We are developing Metal shaders that make extensive use of function_constant. However, when testing on 10.11 we are getting the following warnings and errors:


<program source>:34:32: warning: unknown attribute 'function_constant' ignored

constant bool normal_defined [[function_constant(0)]];


<program source>:34:15: error: variable in constant address space must be initialized

constant bool normal_defined [[function_constant(0)]];


Looking at the feature set documentation (https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf) it seems to show (at least to how I'm interpeting it) that function contants are supported everywhere, but looking at the page for MTLFunctionConstant (https://developer.apple.com/documentation/metal/mtlfunctionconstant?language=objc) shows 10.12+.


Is there any way to tell what features are supported in each OS version without looking at each individual page of documentation?

Replies

I see basic version references for macos at it's wiki, but I don't see a per os feature cross-reference.

In the documentation it is written that MTLFunctionConstantValues are supported in mac 10.12 and newer. You write that you are testing with 10.11. It seems that this is the reason why you get the errors.


https://developer.apple.com/documentation/metal/mtlfunctionconstantvalues


Maybe I am wrong but as I understand the feature set table the number of function constants mentioned there has nothing to do with the API calls or the attribute function_constant(0).

For things like this the Metal Shading Language guide helps. If you check the function constants reference there it's available since Metal 1.2. The API docs show 1.2 is availabel in iOS 10.0 and macOS 10.12 or later: https://developer.apple.com/documentation/metal/mtllanguageversion/version1_2