Software:Metal (API)

From HandWiki
(Redirected from Metal Shading Language)
Short description: iOS, macOS, and tvOS graphics rendering API
Metal
Metal 3 Logo.png
File:Vainglory Halcyon Fold map.tif
Apple used the mobile multiplayer online battle arena game Vainglory to demonstrate Metal's graphics capabilities at the iPhone 6's September 2014 announcement event.[1]
Developer(s)Apple Inc.
Initial releaseJune 2014; 9 years ago (2014-06)
Stable release
24 / October 2022; 1 year ago (2022-10)
Written inShading language: C++14, Runtime/API: Objective-C
Operating systemiOS, iPadOS, macOS, tvOS
Type3D graphics and compute API
LicenseProprietary
Websitedeveloper.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.

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:

  • Image filtering algorithms
  • Neural network processing
  • Advanced math operations
  • Ray tracing

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.

Title Developer (macOS version) Game engine MacOS release date (OpenGL) Metal-based release date Metal support notes
EVE Online CCP Games N/A 14/10/2021
Civilization VI Aspyr Media LORE 24/10/2016 Metal support since 5 April 2019[citation needed]
Batman Feral Interactive Unreal Engine 3 18/10/2013 Metal support since 21 February 2019 with v1.2[citation needed]
Dota 2 Valve Source 2 18/07/2013 MoltenVK was announced on 26/02/2018.[18] The option to use this became available on 31/05/2018.[19]
Quake II id Software Quake II engine 09/02/2019 A port using MoltenVK was released as vkQuake2.[20]
Tomb Raider Feral Interactive Foundation Engine 17/01/2014 Metal support with v1.2 in July 2019[citation needed]
Rise of the Tomb Raider Feral Interactive Foundation Engine 12/04/2018
Shadow of the Tomb Raider Feral Interactive Foundation Engine 2019
F1 2016 Feral Interactive EGO Engine 4.0 06/04/2017
Life Is Strange 2 Feral Interactive Unreal Engine 4 2019
Life Is Strange Feral Interactive Unity Engine 13/09/2018
Divinity Larian Studios Divinity Engine 2 31/01/2019
Baldur's Gate III Larian Studios Divinity Engine 4.0 22/09/2023 Metal support in early access since 06/10/2020[citation needed]
Company of Heroes 2 Feral Interactive Essence Engine 3 21/01/2015 Metal support since 19/10/2018[citation needed]
Hitman Feral Interactive Glacier 2 20/06/2017
Sid Meier's Railroads! Feral Interactive Gamebryo 01/11/2012 Metal support since 18/12/2018[citation needed]
Warhammer 40,000 Feral Interactive Essence Engine 4 9/6/2017
Total War: Rome Remastered Feral Interactive TW Engine 2 29/4/2021
Total War Feral Interactive TW Engine 3 23/5/2019
Total War Feral Interactive TW Engine 3 19/4/2017
Total War Feral Interactive TW Engine 3 20/11/2018
Total War Saga Feral Interactive TW Engine 3 24/05/2018
Total War Saga Feral Interactive TW Engine 3 13/08/2020
Medieval II Feral Interactive TW Engine 2 17/12/2015 Metal support since 25 October 2018[citation needed]
Empire Feral Interactive TW Engine 3 4/3/2009 Metal support since 16 December 2019[citation needed]
Napoleon Feral Interactive TW Engine 3 2/7/2013 Metal support since 25 October 2019 with v1.2[citation needed]
Total War Feral Interactive TW Engine 3 31/7/2014 Metal support since 4 October 2019[citation needed]
Total War: Shogun 2: Fall of the Samurai Feral Interactive TW Engine 3 18/12/2014 Metal support since 4 October 2019[citation needed]
Bioshock Remastered Feral Interactive Unreal Engine 2.5 22/8/2017
Bioshock 2 Remastered Feral Interactive Unreal Engine 2.5 22/10/2020
F1 2017 Feral Interactive EGO Engine 4.0 25/8/2017
Deus Ex Feral Interactive Dawn Engine 12/12/2017
DiRT Rally Feral Interactive EGO Engine 2.5 16/11/2017
Ballistic Overkill Aquiris Game Studio Unity Engine 5 28/3/2017
BattleTech Harebrained Schemes Unity Engine 5 24/4/2018
Mafia III Aspyr Media Illusion Engine 11/5/2017
World of Warcraft Blizzard Entertainment WoW Engine 23/11/2004 Metal support since August 2016[citation needed]
Starcraft Blizzard Entertainment Modified Warcraft II engine 20/11/2001 Metal support since 02/07/2020 with v1.23.5[citation needed]
StarCraft II Blizzard Entertainment SC2 Engine 27/7/2010 Metal support in beta since 24/1/2017[citation needed]
Heroes of the Storm Blizzard Entertainment SC2 Engine 2/6/2015 Metal support in beta since 24/1/2017 (temporarily removed on Template:DTS[21] until ?)[citation needed]
Fortnite Epic Games Unreal Engine 4 25/7/2017
Obduction Cyan Worlds Unreal Engine 4 29/3/2017
Everspace Rockfish Unreal Engine 4 26/5/2017
Ark Studio Wildcard Unreal Engine 4 29/8/2017
Observer Bloober Team Unreal Engine 4 24/10/2017
Unreal Tournament Epic Games Unreal Engine 4 Cancelled Metal support since January 2017[citation needed]
Refunct Dominique Grieshofer Unreal Engine 4 5/9/2016
Cities Paradox Interactive Unity Engine 5 10/3/2015 Metal support since Template:DTS[citation needed]
Universe Sandbox Giant Army Unity Engine 5 TBA Metal support in beta since June 2017[citation needed]
War Thunder Gaijin Entertainment Dagor Engine 4 1/11/2012 Metal support added 24/5/2017 (removed in ? 2018 and reintroduced 27/8/2020)[citation needed]
The Witness Thekla, Inc Thekla Engine 8/3/2017
Micro Machines World Series Virtual Programming Unity Engine 5 30/6/2017
Guardians of the Galaxy Telltale Games Telltale Tool 18/4/2017
Batman Telltale Games Telltale Tool 08/08/2017
Minecraft: Story Mode - Season Two Telltale Games Telltale Tool 11/7/2017
ARMA 3 Virtual Programming Real Virtuality TBA Metal support in beta since 17/9/2017[citation needed]
MXGP3 Virtual Programming Unreal Engine 4 23/11/2018
Gravel Virtual Programming Unreal Engine 4 20/1/2019
X-Plane 11 Laminar Research N/A 30/5/2017 Metal support in beta since 2/4/2020[22]
Headlander Double Fine Productions Buddha Engine 18/11/2016
The Sims 4 Maxis SmartSim 17/02/2015 Metal support added 12/11/2019[citation needed]
The Elder Scrolls Online Zenimax Online Studios N/A 04/04/2014 22/10/2018 OpenGL Renderer replaced with Vulkan via MoltenVK wrapper (translates Vulkan API calls to Metal) in patch 4.2.5
Sky: Children of the Light Thatgamecompany N/A 18/07/2019 Native Metal support added since pre-global live in November 2017
Resident Evil Village Capcom RE Engine 28/10/2022 First macOS game with MetalFX support

See also

References

  1. McWhertor, Michael (September 9, 2014). "This is the game Apple used to show off iPhone 6". Polygon. Vox Media. http://www.polygon.com/2014/9/9/6127259/vainglory-iphone-6-moba-game-apple. 
  2. "Getting started with Metal-CPP - Metal". https://developer.apple.com/metal/cpp/. 
  3. Apple Inc.. "Metal Shading Language Specification". https://developer.apple.com/metal/Metal-Shading-Language-Specification.pdf. 
  4. "Setting Up a Command Structure". Apple Inc.. https://developer.apple.com/documentation/metal/setting_up_a_command_structure. 
  5. "Metal Shading Language Guide". September 8, 2014. https://developer.apple.com/library/prerelease/ios/documentation/Metal/Reference/MetalShadingLanguageGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40014364. 
  6. Apple Inc.. "Setting Resource Storage Mode". https://developer.apple.com/documentation/metal/setting_resource_storage_modes. 
  7. "Synchronizing a Managed Resource". Apple Inc.. https://developer.apple.com/documentation/metal/synchronizing_a_managed_resource. 
  8. "GPU Selection in macOS". Apple Inc.. https://developer.apple.com/documentation/metal/gpu_selection_in_macos. 
  9. "Metal Performance Shaders". https://developer.apple.com/documentation/metalperformanceshaders. 
  10. Machkovech, Same (2 June 2014). "Apple gets heavy with gaming, announces Metal development platform". Ars Technica. Condé Nast. https://arstechnica.com/apple/2014/06/apple-gets-heavy-with-gaming-announces-metal-development-platform/. 
  11. Smith, Colin; Meza, Starlayne (8 June 2015). "Apple Announces OS X El Capitan with Refined Experience & Improved Performance". Newsroom. San Francisco: Apple. https://www.apple.com/pr/library/2015/06/08Apple-Announces-OS-X-El-Capitan-with-Refined-Experience-Improved-Performance.html. 
  12. "Archived copy of the Metal homepage, November 2017". Apple. 20 November 2017. https://developer.apple.com/metal/. 
  13. "Bring your Metal app to Apple Silicon Macs". https://developer.apple.com/videos/play/wwdc2020/10631. 
  14. "Discover Metal 3". https://developer.apple.com/videos/play/wwdc2022/10066. 
  15. "Program Metal in C++ with metal-cpp". https://developer.apple.com/videos/play/wwdc2022/10160. 
  16. Chiappetta, Marco (11 December 2018). "Apple Turns Its Back On Customers And NVIDIA With macOS Mojave". https://www.forbes.com/sites/marcochiappetta/2018/12/11/apple-turns-its-back-on-customers-and-nvidia-with-macos-mojave. 
  17. Apple Inc.. "WWDC 2017 Platforms State of the Union". https://developer.apple.com/videos/play/wwdc2017/102/. 
  18. "Vulkan Applications Enabled on Apple Platforms" (in en-us). Khronos Group Press Release. https://www.khronos.org/news/press/vulkan-applications-enabled-on-apple-platforms. 
  19. Larabel, Michael (June 1, 2018). "Initial Vulkan Performance On macOS With Dota 2 Is Looking Very Good". Phoronix. https://www.phoronix.com/scan.php?page=news_item&px=Dota-2-Initial-Mac-Vulkan. 
  20. Kondrak, Krzysztof [@k_kondrak] (February 9, 2019). "vkQuake2 gets MacOS support". https://twitter.com/k_kondrak/status/1094192063292297217. 
  21. "HEROES OF THE STORM BALANCE PATCH NOTES — NOVEMBER 29, 2017" (in en). 29 November 2017. https://news.blizzard.com/en-us/heroes-of-the-storm/21273597/heroes-of-the-storm-balance-patch-notes-november-29-2017. 
  22. "X-Plane 11.50 Public Beta 1: Vulkan and Metal Are Here" (in en-US). 2020-04-02. https://developer.x-plane.com/2020/04/x-plane-11-50-public-beta-1-vulkan-and-metal-are-here/. 

External links