-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Rust-GPU support #5634
Description
What problem does this solve or what need does it fill?
rust-gpu is an admirable open-source effort to implement a rustc compiler backend for generating SPIR-V intermediate code. Embark Studios is already actively using this project to generate Vulkan shaders from Rust for an in-house project. Seeing that WebGPU also uses SPIR-V as an intermediate, support for WebGPU is a likely eventuality. This would allow a single language to be used for an entire project, with support for compiling to desktop, mobile, and web platforms. And not just any language, but Rust, the king of languages.
In the words of the developers:
Historically in games GPU programming has been done through writing either HLSL, or to a lesser extent GLSL. These are 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.
In part this is because it's a niche language for a niche market, and in part this has been because the industry as a whole has sunk quite a lot of time and effort into the status quo. While over-all better alternatives to both languages exist, none of them are in a place to replace HLSL or GLSL. Either because they are vendor locked, or because they don't support the traditional graphics pipeline. Examples of this include CUDA and OpenCL. And while attempts have been made to create language in this space, none of them have gained any notable traction in the gamedev community.
Our hope with this project is that we push the industry forward by bringing an existing, low-level, safe, and high performance language to the GPU; namely Rust. And with it come some additional benefits that can't be overlooked: 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 tools and utilities to improve programmer workflows, and many others!
rust-gpu seems to fit perfectly with Bevy's mission and values. It would be terribly disheartening if Bevy never supports the project.
What solution would you like?
Rust-GPU might be a bit too early in development for Bevy to fully support it, but even if you decide not to implement it anytime soon, It is definitely something you'll want to do at some point. So, any restructuring of the Bevy internals that would need to be done to support the project should be done slowly and early-on, to reduce the amount of major changes needed to add support down the line.
Or, if you feel like rust-gpu support could be easily implemented starting now, without concerns for stability issues, then by all means please do so. I don't really know the structure of Bevy internals atm, so y'all probably are a better judge of that than me
What alternative(s) have you considered?
There is always the option to explicitly NOT support the project, but in my opinion, rust-gpu really looks like it is the perfect fit for the bevy project, and a great addition to the still-being-worked-on graphics and shader system. Of course, I'm not a Bevy developer, so I could be wrong.
Additional context
You may have heard of RLSL, an archived and abandoned project that had a similar mission. I'll have you know that the creator of RLSL is one of the minds behind rust-gpu, and has taken everything he learned from the previous project and applied it to this new incarnation of his original mission.