Metal (API) explained

Metal
Developer:Apple Inc.
Latest Release Version:24
Programming Language:Shading language

C++14, Runtime/API: Objective-C

Operating System:iOS, iPadOS, macOS, tvOS
Genre:3D graphics and compute API
License:Proprietary

Metal is a low-level, low-overhead hardware-accelerated 3D graphic and compute shader API created by Apple, debuting in iOS 8. Metal combines functions similar to OpenGL and OpenCL in one API. It is intended to improve performance by offering low-level access to the GPU hardware for apps on iOS, iPadOS, macOS, and tvOS. It can be compared to low-level APIs on other platforms such as Vulkan and DirectX 12.

Metal is an object-oriented API that can be invoked using the Swift, Objective-C or C++17[1] programming languages. Full-blown GPU execution is controlled via the Metal Shading Language. According to Apple promotional materials: "MSL [Metal Shading Language] is a single, unified language that allows tighter integration between the graphics and compute programs. Since MSL is C++-based, you will find it familiar and easy to use."[2]

Features

Metal aims to provide low-overhead access to the GPU. Commands are encoded beforehand and then submitted to the GPU for asynchronous execution. The application controls when to wait for the execution to complete thus allowing application developers to increase throughput by encoding other commands while commands are executed on the GPU or save power by explicitly waiting for GPU execution to complete. Additionally, command encoding is CPU independent thus applications can encode commands to each CPU thread independently. Lastly, render states are pre-computed beforehand, allowing the GPU driver to know in advance how to configure and optimize the render pipeline before command execution.[3]

Metal improves the capabilities of GPGPU programming by using compute shaders. Metal uses a specific shading language based on C++14, implemented using Clang and LLVM.[4]

Metal allows application developers to create Metal resources such as buffers, textures. Resources can be allocated on the CPU, GPU, or both and provides facilities to update and synchronize allocated resources. Metal can also enforce a resource's state during a command encoder's lifetime.[5] [6]

On macOS, Metal can provide application developers the discretion to specify which GPU to execute. Application developers can choose between the low-power integrated GPU of the CPU, the discrete GPU (on certain MacBooks and Macs) or an external GPU connected through Thunderbolt. Application developers also have the preference on how GPU commands are executed on which GPUs and provides suggestion on which GPU a certain command is most efficient to execute (commands to render a scene can be executed by the discrete GPU while post-processing and display can be handled by the integrated GPU).[7]

Metal Performance Shaders

Metal Performance Shaders is a highly optimized library of graphics functions that can help application developers achieve great performance at the same time decrease work on maintaining GPU family specific functions.[8] It provides functions including:

History

Metal has been available since June 2, 2014 on iOS devices powered by Apple A7 or later,[9] and since June 8, 2015 on Macs (2012 models or later) running OS X El Capitan.[10]

On June 5, 2017, at WWDC, Apple announced the second version of Metal, to be supported by macOS High Sierra, iOS 11 and tvOS 11. Metal 2 is not a separate API from Metal and is supported by the same hardware. Metal 2 enables more efficient profiling and debugging in Xcode, accelerated machine learning, lower CPU workload, support for virtual reality on macOS, and specificities of the Apple A11 GPU, in particular.[11]

At the 2020 WWDC, Apple announced the migration of the Mac to Apple silicon. Macs using Apple silicon will feature Apple GPUs with a feature set combining what was previously available on macOS and iOS, and will be able to take advantage of features tailored to the tile based deferred rendering (TBDR) architecture of Apple GPUs.[12]

At the 2022 WWDC, Apple announced the third version of Metal (Metal 3), which would debut with the release of macOS Ventura, iOS 16 and iPadOS 16. Metal 3 introduces the MetalFX upscaling framework, which renders complex scenes in less time per frame with high-performance upscaling and anti-aliasing, mesh shaders support.[13] Also announced possibility to use C/C++ for Metal API.[14]

Supported GPUs

The first version of Metal supports the following hardware and software:[15]

The second version of Metal supports the following hardware and software:

The third version of Metal supports the following hardware and software:

Adoption

According to Apple, more than 148,000 applications use Metal directly, and 1.7 million use it through high-level frameworks, as of June 2017.[16] macOS games using Metal for rendering are listed below.

TitleDeveloper (macOS version)Game engineMacOS release date (OpenGL/DirectX)Metal-based release dateMetal support notes
EVE OnlineCCP GamesN/APreviously available on macOS via DirectX 9.0 from November 2007 until February 2009; native macOS version using Metal released 14 November 2021
Civilization VIAspyr MediaLOREMetal support since 5 April 2019
Feral InteractiveUnreal Engine 3Metal support since 21 February 2019 with v1.2
Dota 2ValveSource 2MoltenVK was announced on .[17] The option to use this became available on .[18]
Quake IIid SoftwareQuake II engineA port using MoltenVK was released as vkQuake2.[19]
Tomb RaiderFeral InteractiveFoundation EngineMetal support with v1.2 in July 2019
Rise of the Tomb RaiderFeral InteractiveFoundation Engine
Shadow of the Tomb RaiderFeral InteractiveFoundation Engine
F1 2016Feral InteractiveEGO Engine 4.0
Life Is Strange 2Feral InteractiveUnreal Engine 4
Feral InteractiveUnity Engine
Larian StudiosDivinity Engine 2
Baldur's Gate IIILarian StudiosDivinity Engine 4.0Metal support in early access since
Company of Heroes 2Feral InteractiveEssence Engine 3Metal support since
HitmanFeral InteractiveGlacier 2
Sid Meier's Railroads!Feral InteractiveGamebryoMetal support since
Feral InteractiveEssence Engine 4
Total War: Rome RemasteredFeral InteractiveTW Engine 2
Feral InteractiveTW Engine 3
Feral InteractiveTW Engine 3
Feral InteractiveTW Engine 3
Feral InteractiveTW Engine 3
Feral InteractiveTW Engine 3
Feral InteractiveTW Engine 2Metal support since 25 October 2018
Feral InteractiveTW Engine 3Metal support since 16 December 2019
Feral InteractiveTW Engine 3Metal support since 25 October 2019 with v1.2
Feral InteractiveTW Engine 3Metal support since 4 October 2019
Feral InteractiveTW Engine 3Metal support since 4 October 2019
Bioshock RemasteredFeral InteractiveUnreal Engine 2.5
Bioshock 2 RemasteredFeral InteractiveUnreal Engine 2.5
F1 2017Feral InteractiveEGO Engine 4.0
Feral InteractiveDawn Engine
DiRT RallyFeral InteractiveEGO Engine 2.5
Ballistic OverkillAquiris Game StudioUnity Engine 5
BattleTechHarebrained SchemesUnity Engine 5
Mafia IIIAspyr MediaIllusion Engine
World of WarcraftBlizzard EntertainmentWoW EngineMetal support since August 2016
StarcraftBlizzard EntertainmentModified Warcraft II engineMetal support since with v1.23.5
StarCraft IIBlizzard EntertainmentSC2 EngineMetal support in beta since
Heroes of the StormBlizzard EntertainmentSC2 EngineMetal support in beta since (temporarily removed on [20] until ?)
FortniteEpic GamesUnreal Engine 4
ObductionCyan WorldsUnreal Engine 4
EverspaceRockfishUnreal Engine 4
Studio WildcardUnreal Engine 4
ObserverBloober TeamUnreal Engine 4
Unreal TournamentEpic GamesUnreal Engine 4Metal support since January 2017
RefunctDominique GrieshoferUnreal Engine 4
Paradox InteractiveUnity Engine 5Metal support since
Universe SandboxGiant ArmyUnity Engine 5Metal support in beta since June 2017
War ThunderGaijin EntertainmentDagor Engine 4Metal support added (removed in ? 2018 and reintroduced)
The WitnessThekla, IncThekla Engine
Micro Machines World SeriesVirtual ProgrammingUnity Engine 5
Telltale GamesTelltale Tool
Telltale GamesTelltale Tool
Telltale GamesTelltale Tool
ARMA 3Virtual ProgrammingReal VirtualityMetal support in beta since
MXGP3Virtual ProgrammingUnreal Engine 4
GravelVirtual ProgrammingUnreal Engine 4
X-Plane 11Laminar ResearchN/AMetal support in beta since [21]
HeadlanderDouble Fine ProductionsBuddha Engine
The Sims 4MaxisSmartSimMetal support added
The Elder Scrolls OnlineZenimax Online StudiosN/AOpenGL Renderer replaced with Vulkan via MoltenVK wrapper (translates Vulkan API calls to Metal) in patch 4.2.5
Sky: Children of the LightThatgamecompanyN/ANative Metal support added since pre-global live in November 2017
Resident Evil VillageCapcomRE EngineFirst macOS game with MetalFX support

See also

External links

Notes and References

  1. Web site: Getting started with Metal-CPP - Metal.
  2. Web site: Apple Inc.. Metal Shading Language Specification.
  3. Web site: Apple Inc.. Setting Up a Command Structure.
  4. Web site: Metal Shading Language Guide. September 8, 2014. September 10, 2014.
  5. Web site: Apple Inc.. Setting Resource Storage Mode.
  6. Web site: Synchronizing a Managed Resource. Apple Inc..
  7. Web site: GPU Selection in macOS. Apple Inc..
  8. Web site: Metal Performance Shaders.
  9. Web site: Apple gets heavy with gaming, announces Metal development platform . . . 2 June 2014 . Same . Machkovech.
  10. Web site: Apple Announces OS X El Capitan with Refined Experience & Improved Performance . Newsroom . . 8 June 2015 . . Colin . Smith . Starlayne . Meza.
  11. Web site: Archived copy of the Metal homepage, November 2017 . Apple Developer . . . 20 November 2017 . bot: unknown . https://web.archive.org/web/20171120014933/https://developer.apple.com/metal/ . November 20, 2017 . mdy-all .
  12. Web site: Bring your Metal app to Apple Silicon Macs. developer.apple.com. 2020-07-13.
  13. Web site: Discover Metal 3. developer.apple.com. 2022-06-24.
  14. Web site: Program Metal in C++ with metal-cpp. developer.apple.com. 2022-09-10.
  15. Web site: Apple Turns Its Back On Customers And NVIDIA With macOS Mojave. Marco . Chiappetta. Forbes. 11 December 2018.
  16. Web site: Apple Inc.. WWDC 2017 Platforms State of the Union.
  17. News: Vulkan Applications Enabled on Apple Platforms. Khronos Group Press Release. 2021-02-24. en-us.
  18. Web site: Initial Vulkan Performance On macOS With Dota 2 Is Looking Very Good. Larabel. Michael. Phoronix. June 1, 2018. June 5, 2018.
  19. Kondrak . Krzysztof. k_kondrak . 1094192063292297217 . February 9, 2019 . vkQuake2 gets MacOS support . February 9, 2019.
  20. Web site: 29 November 2017. HEROES OF THE STORM BALANCE PATCH NOTES — NOVEMBER 29, 2017. news.blizzard.com. en.
  21. Web site: X-Plane 11.50 Public Beta 1: Vulkan and Metal Are Here. 2020-04-02. X-Plane Developer. en-US. 2020-04-02.