Experimenting Underway To Handle Mesa Vulkan Drivers Written In Rust


While there is Rusticl as the first Rust language code within Mesa as a modern OpenCL implementation in Gallium3D, for possible future driver efforts there is some initial exploratory work being done around coming up with bindings to support writing of Vulkan drivers with Rust.

Faith Ekstrand of Collabora wrote a blog post today about the exploration work being done for Rust usage within Mesa Vulkan drivers. Additionally, there is a draft merge request adding some preliminary infrastructure and abstractions for Vulkan drivers written in Rust.

Among the design goals for this work are for the Rust Vulkan driver wrappers to be as clean and «Rust-like» as possible, tracking mutability and lifetimes, and using Vulkan allocators whenever possible.

Rust bindings started for Vulkan drivers.

This effort is off to a nice start but Faith Ekstrand concludes the blog post with, «What I’ve done so far barely scratches the surface of what we need to do to fully wrap the Mesa Vulkan runtime into something Rust-friendly. As I have time, I hope to do further experiments and write more blog posts about my findings. So far, for the problems I’ve looked at, I’ve been able to find solutions which will keep the majority of the driver code ergonomic and, most importantly, safe.»

Another important takeaway is: «I don’t expect to see any actual Mesa Vulkan drivers in Rust for a few years yet. My current goal is merely to explore the possibility.» Aside from any new reverse-engineered drivers to come for smaller hardware targets, it’s unlikely anytime soon we’ll see any of the major Mesa Vulkan drivers be rewritten in Rust for the sake of rewriting it in Rust.