Mesa's Vulkan Driver Allows CPU Ray Tracing In Quake RTX But Don't Toss That GPU

q2rtx mesa lavapipe cpu
Back in the day, before the ubiquity of discrete graphics cards with powerful programmable engines, 3D games used what we now term "software rendering." This means that the graphics renderer ran purely on the system's CPU, rather than benefiting from dedicated hardware acceleration. This practice persisted longer than you might realize; Unreal Tournament 2004 had a software renderer for systems with speedy CPUs but crappy GPUs.

Now that even integrated graphics are powerful enough to handle current games in full HD resolution, you might think that there's no point in CPU-based "software" rendering. Well, surprise! Any Windows PC actually includes software fallbacks for DirectX in case the GPU driver utterly fails. Most applications, including games, will refuse to run on the CPU fallback for performance reasons, but it does exist.

software quake
The original Quake used 8-bit color so it could be software-rendered on 486 CPUs.

That's likely the exact reason that Mesa's Lavapipe software renderer exists, too: to ensure that programs don't completely fail when Vulkan hardware acceleration isn't available. To serve that mission, Lavapipe needs to support as much of Vulkan as possible, and that means implementing support for Vulkan API extensions like VK_KHR_acceleration_structure, VK_KHR_deferred_host_operations, and VK_KHR_ray_query. Wait, "ray?"

That's right: thanks to the hard work of Mesa developer Konstantin Seurer, the Lavapipe software rendering pipeline for the open-source Mesa project now supports CPU-based Vulkan ray-tracing. It's honestly quite a thing to see working at all, but naturally, the performance isn't great. Konstantin shared a screenshot (top) of Quake II RTX running on the CPU codepath, and don't be fooled by that "1 FPS" in the Rivatuner overlay—that "1629.2ms" frametime means it's actually running closer to 0.5 FPS.

Obviously, this isn't playable performance, but that's not the point of the function in the first place. With that said, we think it actually might be possible to wring quite a bit more performance out of the function if someone wanted to implement massive multi-threading support. In the screenshot, Quake II RTX is only using some 34% of the developer's CPU, so it doesn't look like it's very multi-threaded at all.

Back in 2008, Intel showed off a fully ray-traced version of Id Software's Enemy Territory: Quake Wars being rendered on a quad-socket machine with four six-core "Dunnington" CPUs (Core 2 architecture.) The frame rate wasn't great and there was nothing going on in the game—no players or AI spawned in—but it was still impressive for the time. We have to think that a multi-threaded ray-tracer running on something like the Threadripper in the Dell Precision workstation we just reviewed could easily handle Quake II RTX. Hopefully someone steps up to code it, just because we think it'd be really cool to see.