简体   繁体   English

如何指定Metal Shader语言版本?

[英]How to specify Metal Shader Language version?

My app got Binary Rejected for the third time. 我的应用程序第三次被“ Binary Rejected ”。 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 iPhone 6siPhone XiPad Pro 12.9上运行良好

I'm testing on iOS 12 with app target iOS 11 我正在使用目标iOS 11iOS 12进行测试

As Metal for iOS can not be run in the simulator, I have not tested on iOS 11 由于iOS版Metal无法在模拟器中运行,因此我尚未在iOS 11进行过测试

So I got Crashlytics and got some info for the crash_info_entry_0 key: 所以我得到了Crashlytics,并获得了有关crash_info_entry_0键的一些信息:

...Error Domain=AGXMetalA8X Code=3 "Function ... is using language version 2.1 which is incompatible with this OS."... ...错误域= AGXMetalA8X代码= 3“功能...正在使用与该OS不兼容的语言版本2.1。” ...

It occurred on an iPad Air 2 (A8) running iOS 11.4.1 它发生在运行iOS 11.4.1iPad Air 2 (A8)

So I guess the problem is that iOS 11 dose not support Metal language version 2.1 所以我想问题是iOS 11不支持金属language version 2.1

How do I change the language version to 2.0 ? 如何将语言版本更改为2.0

Update 1: 更新1:

After checking my Metal Lib, it did indeed have a target of iOS 12 . 在检查我的Metal Lib之后,确实确实有iOS 12的目标。 Tho it ran fine with app target of iOS 11 . 它与iOS 11应用程序目标运行良好。 I've now changed the Metal Lib target to iOS 11 , I hope that changes the Metal Language Version too... 我现在已经将Metal Lib目标更改为iOS 11 ,希望也能更改Metal Language版本...

I wish the Compiler or App Store Uploader would catch this. 我希望编译器或App Store上载器能够抓住这一点。

Update 2: 更新2:

It worked! 有效! Changing the iOS version target of the Metal Lib also changes the Metal Shader Language version. 更改Metal Lib的iOS版本目标也会更改Metal Shader Language版本。

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. 在包含Metal代码的目标中,有一个名为“ Metal语言修订版”的构建设置(实际键为MTL_LANGUAGE_REVISION ,有效值包括Metal12Metal20 ,分别对应于语言版本1.2和2.0),它允许您指定首选语言MSL版本。 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. 如果未设置,则此设置选择适合当前SDK和部署目标的默认值,在您的情况下似乎过于激进了。 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. 如果您不使用MSL 2.1功能,则可以在目标设置的“构建设置”部分中将其显式设置为“金属2.0”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM