2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Metal 3.0 を使うには,macOS Ventura 13 にアップグレードするだけではなく,Xcode 14.1 にする必要がある

Last updated at Posted at 2022-10-29

タイトルで言いたいことはほぼ表せました!

MTLCompileOptions( https://developer.apple.com/documentation/metal/mtlcompileoptions )で,MTLLanguageVersion( https://developer.apple.com/documentation/metal/mtllanguageversion )というのが指定できます.これによって,MetalをコンパイルするときのMetalのバージョン番号を指定することができます.

今回得た知見は,Objective-Cで MTLLanguageVersion3_0,Swiftで MTLLanguageVersion.version3_0を含むコードをエラーなしでコンパイルするためには,macOS Ventura 13にアップグレードするだけでは足りず,Xcode 14.1 にする必要があるということです.

またObjective-CでMTLLanguageVersion3_0はマクロとして宣言されているので,#ifdefを用いることで,定義されているかどうかを判別できることもわかりました.

20221103 追記: macOS Monterey 12.6.1 で Xcode 14.1 をインストールできたので試したのですが,MTLLanguageVersion3_0 を含めると,下記ウォーニングが出ます.

warning: 'MTLLanguageVersion3_0' is only available on macOS 13.0 or newer [-Wunguarded-availability-new]

また,MTLDevice.newLibraryWithSource:options:error:メソッドでエラーになって実行できないということも確認できました.

20221103 追記その2: Xcode 14.1の正式リリースが出ました.macOS Ventura 13 + Xcode 14.1 の組み合わせで動作確認できました.

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?