且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何指定Metal Shader语言版本?

更新时间:2023-02-25 21:20:27

在包含金属代码的目标中,有一个名为金属语言修订版"的构建设置(实际键为MTL_LANGUAGE_REVISION,有效值包括Metal20,分别对应于语言版本1.2和2.0),可让您指定首选的MSL版本.如果未设置,则此设置选择适合于当前SDK和部署目标的默认值,在您的情况下似乎过于激进了.如果您不使用MSL 2.1功能,则可以在目标设置的构建设置"部分中将其明确设置为金属2.0".

In targets that contain Metal code, there is a build setting called "Metal language revision" (the actual key is MTL_LANGUAGE_REVISION, and valid values include Metal12 and Metal20, corresponding to language versions 1.2 and 2.0, respectively) that allows you to specify your preferred MSL version. When not set, this setting choses a default that is suitable for the current SDK and deployment target, which seems to be overly aggressive in your case. If you aren't using MSL 2.1 features, you can explicitly set this to "Metal 2.0" in the Build Settings section of your target's settings.