Metal (API) – Wikipedia

before-content-x4

iOS, macOS, and tvOS graphics rendering API

after-content-x4

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[edit]

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 offers application developers the flexibility where to create Metal resources (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]

after-content-x4

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[edit]

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[edit]

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[edit]

The first version and the second version of Metal API supports the following hardware and software stated as below:[16]

The third version of Metal API supports the following hardware and software stated as below:

Adoption[edit]

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.

See also[edit]

References[edit]

  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.

External links[edit]


after-content-x4