有没有办法以编程方式获得 Metal 中特定功能的限制?

Is there a way to programmatically get limitations of a particular feature in Metal?

我看到 Apple GPU 硬件和 iOS/MacOS 版本的组合决定了一个功能集。我可以使用下面的 swift 片段查询我的 MTLDevice 支持哪些功能集。

device.supportsFeatureSet(MTLFeatureSet.osx_GPUFamily1_v1)

我还需要参考下面link中的table来了解个别功能限制。

Metal Feature Set

有没有办法以编程方式了解这一点?例如,知道每个 renderPass 支持多少个 colorAttachments 吗?

不,没有API查询给定设备的硬件和软件限制。