How to specify Metal Shader Language version?

被刻印的时光 ゝ 提交于 2020-01-16 05:12:07

问题


My app got Binary Rejected for the third time. The crashlogs are no help (I've symbolized them, but they do not contain any print logs...).

Runs fine on iPhone 6s, iPhone X and iPad Pro 12.9

I'm testing on iOS 12 with app target iOS 11

As Metal for iOS can not be run in the simulator, I have not tested on iOS 11

So I got Crashlytics and got some info for the crash_info_entry_0 key:

...Error Domain=AGXMetalA8X Code=3 "Function ... is using language version 2.1 which is incompatible with this OS."...

It occurred on an iPad Air 2 (A8) running iOS 11.4.1

So I guess the problem is that iOS 11 dose not support Metal language version 2.1

How do I change the language version to 2.0?

Update 1:

After checking my Metal Lib, it did indeed have a target of iOS 12. Tho it ran fine with app target of iOS 11. I've now changed the Metal Lib target to iOS 11, I hope that changes the Metal Language Version too...

I wish the Compiler or App Store Uploader would catch this.

Update 2:

It worked! Changing the iOS version target of the Metal Lib also changes the Metal Shader Language version.


回答1:


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.



来源:https://stackoverflow.com/questions/52767403/how-to-specify-metal-shader-language-version

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!