Recently, I’m working on an open source project that translates OpenGL ES draw calls to Metal draw calls on Apple platforms (iOS & macOS). It is a fork of Google’s ANGLE project: https://github.com/kakashidinho/metalangle. This project is named MetalANGLE for now. Inspired by cross-API translation libraries such as MoltenVK (Vulkan to Metal), DXVK (DirectX to Vulkan), etc. that became increasingly popular recently. Though I think MetalANGLE won’t be as popular as those projects since many people have moved on from OpenGL by now.

There were many reasons leading me to start this project:

  • Apple have deprecated OpenGL (ES) on their platforms and urge everyone to use Metal instead. Hence, developing a translation layer to convert OpenGL draw calls to Metal would help cross-platform apps (some of which might have been developed long ago) survive future removal of OpenGL from Apple platforms.
  • Apple’s native OpenGL performance has become noticeably slower after recent OS updates. I don’t know the exact reason, but probably because it has been deprecated and they don’t allocate much resource to maintain or update it anymore. Thus, re-implementing OpenGL (ES for now) on top of Metal would improve the performance of some old games.
  • It has been 5 years since I touched Graphics coding again. It is certainly a long time, and a lot of things have happened in industry. 5 years ago, Direct3D 11 and OpenGL still dominated the industry. Now, Direct3D 12, Vulkan, and Metal are almost everywhere. Working on OpenGL ES to Metal converter project is a good opportunity for me to start learning modern graphics API’s paradigm. As wells as studying the difference in the design between old graphics API such as OpenGL and modern ones.
  • I was bored and want to find something interesting to do. Coincidentally, I happen to use MacBook daily, hence this project naturally came into mind.
  • It was a nice learning experience to fork from and contribute back your changes to a Google project.
  • I always like to do Graphics coding, unfortunately, there aren’t many chances to find a direct Graphics related works here in SEA region. After starting working on this project, I realized how much I still love doing these low level Graphics programming. Overtime, it also helps me learn many new GPU architectural concepts as well as shortcomings that I didn’t know before. For example, flushing in the middle of a rendering pass to switch to a compute pass just to convert data is slow on tiled GPUs.

After 6 months of development, all OpenGL ES 2.0’s features have been completed. Currently, I have started working on some features of OpenGL ES 3.0. Most of them seems pretty doable for now. The only exception is Transform Feedback, an efficient implementation using Vertex Shader’s writable buffer as well as command buffer’s reordering to avoid flushing render pass could be tricky.

Recently, I also received feedback emails from some users of MetalANGLE. While this project might not be much, I am very happy that this work is useful. It may be the most useful open source project I have done until now.

Part 2