A stealth announcement at WWDC23 is that Apple has significantly lowered the barrier of entry to port PC games to the Mac. A new Game Porting Toolkit “provides an emulation environment to run your existing, unmodified Windows game,” says Aiswariya Sreenivassan — a GPU, graphics and displays software engineer at Apple.
It’s a big gap to clear, which is why the Mac has been left behind in recent years. PC games are compiled for the Intel x86 architecture that the Mac just finished moving away from. The unified Apple silicon architecture bears little resemblance to the standard gaming PC with discrete graphics cards and memory. Apple’s Metal 3 library is very different from DirectX, Unity, Unreal and Vulkan — the usual suspects across the computing pond.
Apple’s new tools could open the floodgates for Mac ports of popular PC games. According to a game engine programmer I spoke with, the Game Porting Toolkit demo is “really impressive.” If the tools work as well in practice as in Apple’s demo, they “would be incredibly useful,” said the developer, who works for a major game developer and asked to remain anonymous.
How to bring a PC game to Mac
The old way to port a PC game to Mac required a hell of a lot of work. It involved “recompiling your source code; converting thousands of custom shaders from HLSL; re-implementing your graphics subsystem; and converting your use of audio, input, display, and HDR rendering” before developers could get a running prototype, according to Apple’s video about the Game Porting Toolkit. Then came a long process of debugging and optimizing for polish.
Apple’s tools, outlined in the WWDC session video “Bring your game to Mac: Make a game plan,” can help engineers skip straight to the last step. This could have a monumental effect on the languishing Mac gaming industry.
Skip over weeks of work
Apple’s new Game Porting Toolkit translates PC-specific code. Windows APIs for keyboard and game controller input, audio output, Direct3D and more are translated into macOS equivalents.
For the graphics shaders (which add lighting, environment and perspective effects to the 3D geometry), Apple’s Metal Shader Converter will “automatically convert all of your existing HLSL GPU shaders to Metal.” It’s that simple — from then on, Metal will take full advantage of the graphics cores in the M-series chips for Mac.
The translation layer for the display driver even supports advanced features like HDR and tone mapping, regardless of “whether it’s based on floating-point or 10-bit integer range, or HDR10 or PQ10 shaders,” according to Apple. That way, your game will look right at home whether you have the Pro Display XDR or the cheap LG 24UD58-B (like me).
Take it to the next level
That’s not where the story ends. Developers can improve on performance by using MetalFX upscaling, which in practice can double the possible framerate, according to Apple.
Rendering at the full 4K or 5K resolution most modern Macs offer takes exponentially more resources. MetalFX Upscaling works by rendering the game at a lower resolution using the GPU cores, then upscaling it using the Mac’s powerful machine learning hardware cores. Since PCs don’t have them, they’re totally free for developers to take advantage of when porting to Mac — they’d otherwise just be sitting idly.
A Mac port doesn’t come totally for free
Creating the game is only the first step. “A developer will still have to do some amount of work,” as the aforementioned game engine programmer told me. “There’s also the question of whether a developer wants to spend money [on quality assurance] and support the game with patches.”
Testing, supporting, publishing and distributing a game for Mac are still essential parts of the process outside what Apple’s tools can provide.
Further watching for the technical details
This information comes from Apple’s WWDC23 session video “Bring your game to Mac: Make a game plan.” To explore how this works in greater depth, Apple published two follow-up videos: