DEV Community

lleqsnoom
lleqsnoom

Posted on Originally published at mielony.com

Path-Tracing Doom on macOS: Metal Ray Tracing on Apple Silicon

There is no Vulkan ray tracing on macOS. Apple ships Metal, so a Vulkan RT app runs only through MoltenVK — and MoltenVK's ray tracing is an experimental, unmerged pull request, not an installable driver. On that missing layer, the 1993 game's path tracer runs: every pixel traced per frame, direct and bounced light, reflections, soft shadows — at ~44 FPS at 800p on an M4 Max.

Path-traced Doom 2 on Apple Silicon

The short version

I ported path-traced Doom 2 to Apple Silicon on a patched MoltenVK with Metal RT. It translates SPIR-V to Metal Shading Language and runs the same RTGL1 path tracer and Doom port as the Intel Arc article. The port ships as a self-contained zip (game + path tracer + patched MoltenVK + SDL); you supply Doom2.wad.

Download + every patch: https://mielony.com/blog/path-tracing-doom-on-macos/

Why macOS is different

On Intel Arc the bug class was "assumptions about the device." macOS goes further — there is no Vulkan loader at all. The game links MoltenVK (Vulkan-on-Metal), which stops at Vulkan 1.2 graphics/compute. Ray tracing (VK_KHR_acceleration_structure, VK_KHR_ray_tracing_pipeline) exists only on an unmerged MoltenVK PR (#2771), which maps the Vulkan RT entry points onto Metal behind MVK_CONFIG_ENABLE_EXPERIMENTAL_RAY_TRACING=1.

What broke, layer by layer

  • Driver. MoltenVK fails vkCreateDevice if any requested feature is unsupported, and the path tracer asks for its full set up front — the patch clears every feature bit the device does not report. SPIRV-Cross's MSL backend lacked Metal types for ray-tracing built-ins like gl_LaunchIDEXT, so every ray-generation shader failed to compile until a +21-line patch added them.
  • Renderer. An sRGB swapchain double-encoded the already display-ready image; a missing barrier loaded stale tiles — 8×8 and 16×16 artifacts on a tile-based Apple GPU.
  • Game. Metal surface from SDL_Metal_CreateView, true fullscreen, HighDPI matching the panel backing store (3456×2234), and a green FPS: n HUD counter.

Performance

Doom 2 demo1 on the M4 Max: 43.8 FPS at 800p, 51.7 FPS at 450p internal. rt_renderscale sets internal render height, and RT cost scales with it — not the window. For comparison, the Intel Arc A770 reaches 90 FPS at 450p internal on the same renderer.

Should you bother?

Only if the Mac is the point. It runs 44–52 FPS at low internal resolutions, has no music, stands on an open unmerged PR, and needs a commercial Doom 2 IWAD plus a ModDB lighting addon. If nothing ties you to macOS, Arc/Linux or an RTX machine is smoother — same renderer either way.

Full write-up with benchmarks, build scripts and every patch: https://mielony.com/blog/path-tracing-doom-on-macos/

Top comments (0)