Metal (API)

Last updated

Metal
Developer(s) Apple Inc.
Initial releaseJune 2014;9 years ago (2014-06)
Stable release
24 / October 2022;1 year ago (2022-10)
Written in Shading language: C++14, Runtime/API: Objective-C
Operating system iOS, iPadOS, macOS, tvOS
Type 3D graphics and compute API
License Proprietary
Website developer.apple.com/metal/

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.

Contents

Metal is an object-oriented API that can be invoked using the Swift, Objective-C or C++17 [2] 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." [3]

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. [4]

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. [5]

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. [6] [7]

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). [8]

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. [9] It provides functions including:

History

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

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. [12]

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. [13]

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. [14] Also announced possibility to use C/C++ for Metal API. [15]

Supported GPUs

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

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. [17] macOS games using Metal for rendering are listed below.

TitleDeveloper (macOS version)Game engineMacOS release date (OpenGL)Metal-based release dateMetal support notes
EVE Online CCP Games N/A14 October 2021
Civilization VI Aspyr Media LORE24 October 2016Metal support since 5 April 2019[ citation needed ]
Batman: Arkham City Feral Interactive Unreal Engine 3 18 October 2013Metal support since 21 February 2019 with v1.2[ citation needed ]
Dota 2 Valve Source 2 18 July 2013 MoltenVK was announced on 26 February 2018. [18] The option to use this became available on 31 May 2018. [19]
Quake II id Software Quake II engine 9 February 2019A port using MoltenVK was released as vkQuake2. [20]
Tomb Raider Feral Interactive Foundation Engine17 January 2014Metal support with v1.2 in July 2019[ citation needed ]
Rise of the Tomb Raider Feral Interactive Foundation Engine12 April 2018
Shadow of the Tomb Raider Feral Interactive Foundation Engine2019
F1 2016 Feral Interactive EGO Engine 4.0 6 April 2017
Life Is Strange 2 Feral Interactive Unreal Engine 4 2019
Life Is Strange: Before the Storm Feral Interactive Unity Engine 13 September 2018
Divinity: Original Sin II Larian Studios Divinity Engine 231 January 2019
Baldur's Gate III Larian Studios Divinity Engine 4.022 September 2023Metal support in early access since 6 October 2020[ citation needed ]
Company of Heroes 2 Feral Interactive Essence Engine 3 21 January 2015Metal support since 19 October 2018[ citation needed ]
Hitman Feral Interactive Glacier 220 June 2017
Sid Meier's Railroads! Feral Interactive Gamebryo 1 November 2012Metal support since 18 December 2018[ citation needed ]
Warhammer 40,000: Dawn of War III Feral Interactive Essence Engine 4 9 June 2017
Total War: Rome Remastered Feral Interactive TW Engine 229 April 2021
Total War: Three Kingdoms Feral Interactive TW Engine 323 May 2019
Total War: Warhammer Feral Interactive TW Engine 319 April 2017
Total War: Warhammer II Feral Interactive TW Engine 320 November 2018
Total War Saga: Thrones of Britannia Feral Interactive TW Engine 324 May 2018
Total War Saga: Troy Feral Interactive TW Engine 313 August 2020
Medieval II: Total War Feral Interactive TW Engine 217 December 2015Metal support since 25 October 2018[ citation needed ]
Empire: Total War Feral Interactive TW Engine 34 March 2009Metal support since 16 December 2019[ citation needed ]
Napoleon: Total War Feral Interactive TW Engine 32 July 2013Metal support since 25 October 2019 with v1.2[ citation needed ]
Total War: Shogun 2 Feral Interactive TW Engine 331 July 2014Metal support since 4 October 2019[ citation needed ]
Total War: Shogun 2: Fall of the Samurai Feral Interactive TW Engine 318 December 2014Metal support since 4 October 2019[ citation needed ]
Bioshock Remastered Feral Interactive Unreal Engine 2.5 22 August 2017
Bioshock 2 Remastered Feral Interactive Unreal Engine 2.5 22 October 2020
F1 2017 Feral Interactive EGO Engine 4.0 25 August 2017
Deus Ex: Mankind Divided Feral Interactive Dawn Engine12 December 2017
DiRT Rally Feral Interactive EGO Engine 2.5 16 November 2017
Ballistic OverkillAquiris Game Studio Unity Engine 5 28 March 2017
BattleTech Harebrained Schemes Unity Engine 5 24 April 2018
Mafia III Aspyr Media Illusion Engine11 May 2017
World of Warcraft Blizzard Entertainment WoW Engine23 November 2004Metal support since August 2016[ citation needed ]
Starcraft Blizzard Entertainment Modified Warcraft II engine20 November 2001Metal support since 2 July 2020 with v1.23.5[ citation needed ]
StarCraft II Blizzard Entertainment SC2 Engine27 July 2010Metal support in beta since 24 January 2017[ citation needed ]
Heroes of the Storm Blizzard Entertainment SC2 Engine2 June 2015Metal support in beta since 24 January 2017 (temporarily removed on 29 November 2017 [21] until ?)[ citation needed ]
Fortnite Epic Games Unreal Engine 4 25 July 2017
Obduction Cyan Worlds Unreal Engine 4 29 March 2017
Everspace Rockfish Unreal Engine 4 26 May 2017
Ark: Survival Evolved Studio Wildcard Unreal Engine 4 29 August 2017
Observer Bloober Team Unreal Engine 4 24 October 2017
Unreal Tournament Epic Games Unreal Engine 4 Cancelled cross.svgCancelledMetal support since January 2017[ citation needed ]
RefunctDominique Grieshofer Unreal Engine 4 5 September 2016
Cities: Skylines Paradox Interactive Unity Engine 5 10 March 2015Metal support since 18 May 2017[ citation needed ]
Universe Sandbox Giant Army Unity Engine 5 TBAMetal support in beta since June 2017[ citation needed ]
War Thunder Gaijin Entertainment Dagor Engine 41 November 2012Metal support added 24 May 2017 (removed in ? 2018 and reintroduced 27 August 2020)[ citation needed ]
The Witness Thekla, IncThekla Engine8 March 2017
Micro Machines World Series Virtual Programming Unity Engine 5 30 June 2017
Guardians of the Galaxy: The Telltale Series Telltale Games Telltale Tool 18 April 2017
Batman: The Enemy Within Telltale Games Telltale Tool 8 August 2017
Minecraft: Story Mode - Season Two Telltale Games Telltale Tool 11 July 2017
ARMA 3 Virtual Programming Real VirtualityTBAMetal support in beta since 17 September 2017[ citation needed ]
MXGP3 Virtual Programming Unreal Engine 4 23 November 2018
Gravel Virtual Programming Unreal Engine 4 20 January 2019
X-Plane 11 Laminar Research N/A30 May 2017Metal support in beta since 2 April 2020 [22]
Headlander Double Fine Productions Buddha Engine18 November 2016
The Sims 4 Maxis SmartSim17 February 2015Metal support added 12 November 2019[ citation needed ]
The Elder Scrolls Online Zenimax Online Studios N/A4 April 201422 October 2018OpenGL Renderer replaced with Vulkan via MoltenVK wrapper (translates Vulkan API calls to Metal) in patch 4.2.5
Sky: Children of the LightThatgamecompanyN/A18 July 2019Native Metal support added since pre-global live in November 2017
Resident Evil Village Capcom RE Engine 28 October 2022First macOS game with MetalFX support

See also

Related Research Articles

<span class="mw-page-title-main">DirectX</span> Collection of multimedia related APIs on Microsoft platforms

Microsoft DirectX is a collection of application programming interfaces (APIs) for handling tasks related to multimedia, especially game programming and video, on Microsoft platforms. Originally, the names of these APIs all began with "Direct", such as Direct3D, DirectDraw, DirectMusic, DirectPlay, DirectSound, and so forth. The name DirectX was coined as a shorthand term for all of these APIs and soon became the name of the collection. When Microsoft later set out to develop a gaming console, the X was used as the basis of the name Xbox to indicate that the console was based on DirectX technology. The X initial has been carried forward in the naming of APIs designed for the Xbox such as XInput and the Cross-platform Audio Creation Tool (XACT), while the DirectX pattern has been continued for Windows APIs such as Direct2D and DirectWrite.

<span class="mw-page-title-main">OpenGL</span> Cross-platform graphics API

OpenGL is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve hardware-accelerated rendering.

<span class="mw-page-title-main">Graphics processing unit</span> Specialized electronic circuit; graphics accelerator

A graphics processing unit (GPU) is a specialized electronic circuit initially designed to accelerate computer graphics and image processing. After their initial design, GPUs were found to be useful for non-graphic calculations involving embarrassingly parallel problems due to their parallel structure. Other non-graphical uses include the training of neural networks and cryptocurrency mining.

Direct3D and OpenGL are both application programming interfaces (APIs) that can be used in applications to render 2D and 3D computer graphics. As of 2005, graphics processing units (GPUs) almost always implement one version of both of these APIs. Examples include: DirectX 9 and OpenGL 2 circa 2004; DirectX 10 and OpenGL 3 circa 2008; and most recently, DirectX 11 and OpenGL 4 circa 2011. GPUs that support more recent versions of the standards are backwards compatible with applications that use the older standards; for example, one can run older DirectX 9 games on a more recent DirectX 11-certified GPU.

Core Image is a pixel-accurate, near-realtime, non-destructive image processing technology in Mac OS X. Implemented as part of the QuartzCore framework of Mac OS X 10.4 and later, Core Image provides a plugin-based architecture for applying filters and effects within the Quartz graphics rendering layer. The framework was later added to iOS in iOS 5.

<span class="mw-page-title-main">Shader</span> Type of program in a graphical processing unit (GPU)

In computer graphics, a shader is a computer program that calculates the appropriate levels of light, darkness, and color during the rendering of a 3D scene—a process known as shading. Shaders have evolved to perform a variety of specialized functions in computer graphics special effects and video post-processing, as well as general-purpose computing on graphics processing units.

<span class="mw-page-title-main">OpenGL ES</span> Subset of the OpenGL API for embedded systems

OpenGL for Embedded Systems is a subset of the OpenGL computer graphics rendering application programming interface (API) for rendering 2D and 3D computer graphics such as those used by video games, typically hardware-accelerated using a graphics processing unit (GPU). It is designed for embedded systems like smartphones, tablet computers, video game consoles and PDAs. OpenGL ES is the "most widely deployed 3D graphics API in history".

Mesa, also called Mesa3D and The Mesa 3D Graphics Library, is an open source implementation of OpenGL, Vulkan, and other graphics API specifications. Mesa translates these specifications to vendor-specific graphics hardware drivers.

<span class="mw-page-title-main">Free and open-source graphics device driver</span> Software that controls computer-graphics hardware

A free and open-source graphics device driver is a software stack which controls computer-graphics hardware and supports graphics-rendering application programming interfaces (APIs) and is released under a free and open-source software license. Graphics device drivers are written for specific hardware to work within a specific operating system kernel and to support a range of APIs used by applications to access the graphics hardware. They may also control output to the display if the display driver is part of the graphics hardware. Most free and open-source graphics device drivers are developed by the Mesa project. The driver is made up of a compiler, a rendering API, and software which manages access to the graphics hardware.

The Intel Graphics Media Accelerator (GMA) is a series of integrated graphics processors introduced in 2004 by Intel, replacing the earlier Intel Extreme Graphics series and being succeeded by the Intel HD and Iris Graphics series.

X-Video Motion Compensation (XvMC), is an extension of the X video extension (Xv) for the X Window System. The XvMC API allows video programs to offload portions of the video decoding process to the GPU video-hardware. In theory this process should also reduce bus bandwidth requirements. Currently, the supported portions to be offloaded by XvMC onto the GPU are motion compensation and inverse discrete cosine transform (iDCT) for MPEG-2 video. XvMC also supports offloading decoding of mo comp, iDCT, and VLD for not only MPEG-2 but also MPEG-4 ASP video on VIA Unichrome hardware.

Adreno is a series of graphics processing unit (GPU) semiconductor intellectual property cores developed by Qualcomm and used in many of their SoCs.

<span class="mw-page-title-main">OpenCL</span> Open standard for programming heterogenous computing systems, such as CPUs or GPUs

OpenCL is a framework for writing programs that execute across heterogeneous platforms consisting of central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), field-programmable gate arrays (FPGAs) and other processors or hardware accelerators. OpenCL specifies programming languages for programming these devices and application programming interfaces (APIs) to control the platform and execute programs on the compute devices. OpenCL provides a standard interface for parallel computing using task- and data-based parallelism.

Video Decode and Presentation API for Unix (VDPAU) is a royalty-free application programming interface (API) as well as its implementation as free and open-source library distributed under the MIT License. VDPAU is also supported by Nvidia.

Intel Quick Sync Video is Intel's brand for its dedicated video encoding and decoding hardware core. Quick Sync was introduced with the Sandy Bridge CPU microarchitecture on 9 January 2011 and has been found on the die of Intel CPUs ever since.

<span class="mw-page-title-main">Mantle (API)</span> Low-overhead rendering API

Mantle was a low-overhead rendering API targeted at 3D video games. AMD originally developed Mantle in cooperation with DICE, starting in 2013. Mantle was designed as an alternative to Direct3D and OpenGL, primarily for use on personal computers, although Mantle supports the GPUs present in the PlayStation 4 and in the Xbox One. In 2015, Mantle's public development was suspended and in 2019 completely discontinued, as DirectX 12 and the Mantle-derived Vulkan rose in popularity.

Stage3D is an Adobe Flash Player API for rendering interactive 3D graphics with GPU-acceleration, within Flash games and applications. Flash Player or AIR applications written in ActionScript 3 may use Stage3D to render 3D graphics, and such applications run natively on Windows, Mac OS X, Linux, Apple iOS and Google Android. Stage3D is similar in purpose and design to WebGL.

Vulkan is a low-level low-overhead, cross-platform API and open standard for 3D graphics and computing. It was intended to address the shortcomings of OpenGL, and allow developers more control over the GPU. It is designed to support a wide variety of GPUs, CPUs and operating systems, it is also designed to work with modern multi-core CPUs.

Video Core Next is AMD's brand for its dedicated video encoding and decoding hardware core. It is a family of hardware accelerator designs for encoding and decoding video, and is built into AMD's GPUs and APUs since AMD Raven Ridge, released January 2018.

<span class="mw-page-title-main">RDNA (microarchitecture)</span> GPU microarchitecture and accompanying instruction set architecture

RDNA is a graphics processing unit (GPU) microarchitecture and accompanying instruction set architecture developed by AMD. It is the successor to their Graphics Core Next (GCN) microarchitecture/instruction set. The first product lineup featuring RDNA was the Radeon RX 5000 series of video cards, launched on July 7, 2019. The architecture is also used in mobile products. It is manufactured and fabricated with TSMC's N7 FinFET graphics chips used in the Navi series of AMD Radeon graphics cards.

References

  1. McWhertor, Michael (September 9, 2014). "This is the game Apple used to show off iPhone 6". Polygon . Vox Media. Archived from the original on September 11, 2014. Retrieved September 9, 2014.
  2. "Getting started with Metal-CPP - Metal".
  3. Apple Inc. "Metal Shading Language Specification" (PDF).
  4. "Setting Up a Command Structure". Apple Inc.
  5. "Metal Shading Language Guide". September 8, 2014. Retrieved September 10, 2014.
  6. Apple Inc. "Setting Resource Storage Mode".
  7. "Synchronizing a Managed Resource". Apple Inc.
  8. "GPU Selection in macOS". Apple Inc.
  9. "Metal Performance Shaders".
  10. Machkovech, Same (June 2, 2014). "Apple gets heavy with gaming, announces Metal development platform". Ars Technica . Condé Nast.
  11. Smith, Colin; Meza, Starlayne (June 8, 2015). "Apple Announces OS X El Capitan with Refined Experience & Improved Performance". Newsroom. San Francisco: Apple.
  12. "Archived copy of the Metal homepage, November 2017". Apple Developer. Apple. November 20, 2017. Archived from the original on November 20, 2017 via Wayback Machine.{{cite web}}: CS1 maint: bot: original URL status unknown (link)
  13. "Bring your Metal app to Apple Silicon Macs". developer.apple.com. Retrieved July 13, 2020.
  14. "Discover Metal 3". developer.apple.com. Retrieved June 24, 2022.
  15. "Program Metal in C++ with metal-cpp". developer.apple.com. Retrieved September 10, 2022.
  16. Chiappetta, Marco (December 11, 2018). "Apple Turns Its Back On Customers And NVIDIA With macOS Mojave". Forbes .
  17. Apple Inc. "WWDC 2017 Platforms State of the Union".
  18. "Vulkan Applications Enabled on Apple Platforms". Khronos Group Press Release. Retrieved February 24, 2021.
  19. Larabel, Michael (June 1, 2018). "Initial Vulkan Performance On macOS With Dota 2 Is Looking Very Good". Phoronix. Retrieved June 5, 2018.
  20. Kondrak, Krzysztof [@k_kondrak] (February 9, 2019). "vkQuake2 gets MacOS support" (Tweet). Retrieved February 9, 2019 via Twitter.
  21. "HEROES OF THE STORM BALANCE PATCH NOTES — NOVEMBER 29, 2017". news.blizzard.com. November 29, 2017.
  22. "X-Plane 11.50 Public Beta 1: Vulkan and Metal Are Here". X-Plane Developer. April 2, 2020. Retrieved April 2, 2020.