Introducing rust-gpu v0.1 🐉
Today, we're releasing a very early version of rust-gpu - a new project to make Rust a first-class language and ecosystem for GPU code!
GPU programming has historically been done with HLSL or GLSL, simple programming languages that have evolved along with rendering APIs over the years. However, as game engines have evolved, these languages have failed to provide mechanisms for dealing with large codebases, and have generally stayed behind the curve compared to other programming languages.
Our hope with this project is that we push the industry forward by bringing Rust, an existing low-level, safe, and high performance language, to the GPU. And with it come some additional great benefits: a package/module system that's one of the industry's best, built in safety against race-conditions or out of bounds memory access, a wide range of libraries and tools to improve programmer workflows, and many others!
If we do this project right, developers could use open-source crates that provide the graphical effects needed to create beautiful experiences. Instead of sharing snippets of code on forum posts, they could simply add the right crates.
Why Embark?
At Embark, we've been building our own new game engine from the ground up in Rust. We have previous experience in-house developing the RLSL prototype, and we have a team of excellent rendering engineers that are familiar with the problems in current shading languages both from games, game engines and other industries. So, we believe we are uniquely positioned to attempt solving this problem.
We want to streamline our own internal development with a single great language, build an open source graphics ecosystem and community, facilitate code-sharing between GPU and CPU, and most importantly: to enable our (future) users, and fellow developers, to more rapidly build great looking and engaging experiences.
Who are we?
- Leading the project:
- @khyperia - compiler engineer with experience from Microsoft & Mozilla
- @Jasper-Bekkers - rendering engineer with experience from Frostbite & SEED, and head of Traverse Research
- @XAMPPRocky & @arirawr, will be helping to manage the open development of the project.
- @VZout, @repi, @MaikKlein, @h3r2tic, @hrydgard, @emilk, @NiklasNummelin - devs that will try to write all their shaders in Rust!
But we can't do this alone. That's why we've decided to develop this project in the open,alongside the rest of the Rust and graphics programming communities. Please connect with us if you are interested in collaborating
Current Status
Compiling and running very simple graphics shaders works, and a significant portion of the core library also compiles.
With this we've been able to create some first real shaders in Rust, such as this sky shader written (source):
However, many things aren't implemented yet: for example, loops and switches aren't supported yet!
That means that while being technically usable, this project is far from being production-ready.
Project Scope
The scope of this overall project is quite broad, but is in multiple stages
rustc
compiler backend to generate SPIR-V, plugging in via-Z codegen-backend
.- This is the same mechanism that rustc_codegen_cranelift and rustc_codegen_gcc use.
- Currently only SPIR-V support is planned, Vulkan's open compiler target
- Possible a future version could suppport DXIL (the target for DirectX) or WGSL (the WebGPU shading language that's bijective with SPIR-V)
- Focus on Vulkan graphics shaders first, then after Vulkan compute shaders
- Cargo and crates.io support to develop and publish SPIR-V crates
- High-level render graph to take advantage of this, make it easy for users to develop and use rendering effects.
An in-depth exploration of our roadmap and milestones can be found here.
Open Development
We'll have weekly meetings on Discord, with open agendas shared in GitHub issues. RFCs and other discussions will also be handled in GitHub.
Want to get started?
- Join us on Discord to discuss and share your ideas on this project
- Check out our Roadmap and Milestones
- Read about the project's scope
- Get started and run our example shader
- See our open issues