Hardware ray tracing works on Apple Silicon via experimental MoltenVK (PR #2771) — TouchDesigner doesn't request it on macOS yet. Test results on M5 Max

Hi all,

I’ve been looking into why hardware ray tracing (Ray POP, GLSL POP ray queries, Sprinkle POP volume mode) is unavailable on macOS, and I wanted to share some measurements, because the situation has changed on the driver side.

**TL;DR:** with an experimental build of MoltenVK that adds Vulkan ray tracing, my M5 Max exposes `VK_KHR_acceleration_structure` / `VK_KHR_ray_query` / `VK_KHR_ray_tracing_pipeline`, a real ray-query compute test passes, and performance is in the billions of rays per second. TouchDesigner, however, never requests those extensions on macOS, so the Ray POP still falls back to software. The remaining blocker is now on the TouchDesigner side, and I’d love to see this enabled (even as an opt-in experimental option).

### Setup

- MacBook Pro, Apple M5 Max (40-core GPU), 128 GB, macOS 27.0, Xcode installed

- TouchDesigner 2025.33230 (ships MoltenVK 1.4.1 in `Contents/Frameworks/libMoltenVK.dylib`, linked directly, no Vulkan loader)

- MoltenVK PR #2771 “WIP: Add Metal ray query and ray tracing support” by dttdrv: WIP: Add Metal ray query and ray tracing support by dttdrv · Pull Request #2771 · KhronosGroup/MoltenVK · GitHub

- Build: `./fetchDependencies --macos` then `make macos`. With CMake 4.x I needed `export CMAKE_POLICY_VERSION_MINIMUM=3.5`. Builds cleanly (warnings only).

### 1. Driver capability (standalone Vulkan test, outside TouchDesigner)

I wrote a small C++/Vulkan test linked against the built `libMoltenVK.dylib`.

Without the env var, the device advertises none of the ray tracing extensions (same as today). With `MVK_CONFIG_ENABLE_EXPERIMENTAL_RAY_TRACING=1`:

| Extension / feature | Advertised |

|—|—|

| VK_KHR_acceleration_structure | yes |

| VK_KHR_ray_query | yes |

| VK_KHR_ray_tracing_pipeline | yes |

| VK_KHR_deferred_host_operations | yes |

| VK_KHR_pipeline_library | yes |

| VK_KHR_ray_tracing_maintenance1 | yes |

| VK_KHR_ray_tracing_position_fetch | no |

| accelerationStructure / rayQuery / rayTracingPipeline features | all true |

| bufferDeviceAddress | true |

### 2. Correctness

One triangle in a BLAS + TLAS, a compute shader using `GL_EXT_ray_query` (`rayQueryInitializeEXT` / `rayQueryProceedEXT` / `rayQueryGetIntersectionTEXT`) shooting a 16×16 grid of rays, results read back and compared against a CPU reference:

- **256 / 256 rays correct**, hit distance exactly 1.0 for every hit, misses where expected.

- The SPIR-V → MSL translation of ray queries works through the PR’s SPIRV-Cross fork.

### 3. Performance

Same compute shader, a wavy grid of 1024×1024 quads = **2,097,152 triangles**, acceleration structure built with `PREFER_FAST_TRACE`, one ray per pixel at 3840×2160:

| Step | Time |

|—|—|

| BLAS build (2.1M triangles) | 43.7 ms |

| TLAS build (1 instance) | 1.2 ms |

| Tracing 8,294,400 rays (one 4K frame), best of 5 | **2.33 ms** |

That’s roughly **3.5 billion rays/second** (wall-clock, including queue submit and wait). The hardware is clearly there.

### 4. What TouchDesigner does with it

To see what TD would do with such a driver, I made a *copy* of TouchDesigner.app, replaced only `libMoltenVK.dylib` in the copy with the experimental build, and launched it with the env var set. The app runs normally. Then, Ray POP with a Grid POP as rays and a Sphere POP as collision geometry:

- Setting **Hardware Ray Tracing** to *Fast Trace* or *Fast Build* gives: `Warning: Hardware Ray Tracing not supported, disabling.` Results are bit-identical to *Off*, with the same cook times.

- Software cook times for reference on this machine: 1,000,000 rays vs 50,000 triangles ≈ **364 ms**; 4,000,000 rays vs 450,000 triangles ≈ **13–14 s** per cook. (Not apples to apples with my raw test, since the Ray POP computes more per hit, but it gives the order of magnitude we’re leaving on the table.)

To understand why, I added logging (nothing else) to my MoltenVK build. On macOS, TouchDesigner:

- gets 141 device extensions from `vkEnumerateDeviceExtensionProperties`, **including** `VK_KHR_acceleration_structure` and `VK_KHR_ray_query`;

- queries `vkGetPhysicalDeviceFeatures2` with a pNext chain that includes buffer device address, descriptor indexing, timeline semaphores etc., but **no** `VkPhysicalDeviceAccelerationStructureFeaturesKHR` / `VkPhysicalDeviceRayQueryFeaturesKHR`;

- creates the device with 19 extensions, and `VK_KHR_acceleration_structure`, `VK_KHR_ray_query`, `VK_KHR_deferred_host_operations`, `VK_KHR_spirv_1_4` are **not** among them.

So the macOS build appears to decide up front not to ask for ray tracing, regardless of what the driver advertises. That’s completely understandable given the state of MoltenVK until now, but it means that even with a capable driver the Ray POP has no path to the hardware.

### Caveats

- PR #2771 is still WIP. Reviewers have flagged performance/memory issues and a bug with compacted-size alignment. I’m not suggesting shipping it as is.

- The official MoltenVK release (1.4.2) has no ray tracing. LunarG’s KosmicKrisp driver (Vulkan 1.4 on Metal 4) doesn’t expose it yet either, as far as I can tell.

- My test is minimal: one geometry, opaque triangles, ray queries from a compute shader. I haven’t exercised ray tracing pipelines, updates/refits, or large instance counts.

### Request

1. When a MoltenVK with ray tracing lands (merged PR or a later release), please bundle it and let the macOS build request `VK_KHR_acceleration_structure` / `VK_KHR_ray_query` when the driver advertises them, so the Ray POP, GLSL POP ray queries and Sprinkle POP volume mode light up on Apple Silicon.

2. In the meantime, would an **opt-in experimental preference or environment variable** be feasible, so that macOS users who build their own MoltenVK can test hardware ray tracing in TouchDesigner and report back? Even a “use at your own risk” switch would let the community help validate this before it’s official.

I’m happy to test experimental builds, share my test program, logs and traces, or run anything else that would help. With Apple Silicon GPUs now having proper RT hardware and tools like the Ray POP, T3D and the Pathtracer gaining traction, this would be a big deal for Mac users.

Thanks for reading!

Hi @Dennex11x1, thanks for the research and comprehensive summary.

Regarding 1., we are regularly updating Molten VK, and will definitely update when the raytracing extensions become available.
Regarding 2., unfortunately it most likely won’t happen as it would open the door to crashes that would become much harder to debug on our side.

Best,
Vincent