このページには、Metal の使用に際しての要件および Metal と互換性のある機能の一覧を掲載しています。
Unity は、iOS、tvOS、macOS 用に Unity プレイヤーで Metal をサポートしています。また、macOS 用に Unity エディターで Metal をサポートしています。
Unity は、Unity がサポートする全ての Apple デバイス用に Metal をサポートしています。
機能 | ビルトインレンダーパイプライン | ユニバーサルレンダーパイプライン (URP) | HD レンダーパイプライン (HDRP) | カスタムのスクリプタブルレンダーパイプライン (SRP) |
---|---|---|---|---|
Metal | あり | あり | あり (macOS のみ) | あり |
一部の Metal デバイスは、16 ビットの half
データ型をサポートしていません。Unity シェーダーはこうしたデバイスでは half
を 32 ビットの float
として表現します。同様に、real
データ型は、モバイルデバイスでは half
、デスクトッププラットフォームでは float
として Unity シェーダーによって表現されます。このセクションの説明は、half
データ型を使用して、half
をサポートしないデバイスにアプリケーションをデプロイしたい場合に関連するものです。
half
を適切な場所に使用することで、操作を高速化し、メモリを節約し、モバイルデバイスのバッテリーを節約できます。高精度が必要ない値には half
使用するのが最善です。本セクションの情報を参照して、コードを、half
をサポートしないデバイスに確実に対応するようにしてください。
シェーダーのデータ型と、それらがサポートする精度についての詳細は、シェーダーのデータ型と精度 を参照してください。
16 ビット浮動小数点数は 32 ビット浮動小数点数に比べて低精度です。half
を使用して、それをサポートするデバイスでアプリケーションをテストすれば、多くの場合は、低精度に起因する問題を確認してそれを修正することができます。しかし、half
をサポートしない (そして half
を float
で代用する) デバイスでアプリケーションをテストした場合、後に half
をサポートするデバイスでアプリケーションを実行した時に発生する精度の問題が見落とされる可能性があります。
half
をサポートしないデバイスに Unity アプリケーションをデプロイしたい場合は、float
が half
に置き換えられてもコードが正常に機能することを確認してください。half
をサポートする Metal GPU は、バッファ (定数バッファも含む) が 16 ビット値が含んでいることも想定しています。half
をサポートしない GPU は、これらのバッファが 32 ビット値を含んでいることを想定しています。バッファに値を書き込む時に、CPU 側のコードでこのことを考慮する必要があります。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.