Rust GPU, a set of tools for developing shaders in Rust

The game development company Embark Studios has released the first experimental release of the project rust GPU, which aims to use the Rust language to develop GPU code. 

The desire to use Rust to write programs for GPU stems not only from the safety features and high performance, but also of the need to obtain modern tools to work with packages and modules to improve the efficiency of the development process.

Rust GPU development company Embark Studios also uses Rust in its game engine and it is working to facilitate the exchange of Rust code between the CPU and the GPU.

According to them, historically, in games, GPU programming has been done by writing HLSL or, to a lesser extent, GLSL. These are simple programming languages ​​that have evolved alongside rendering APIs over the years.

However, as game engines have evolved, these languages ​​have not provided mechanisms for dealing with large code bases and, in general, they have lagged behind compared to other programming languages.

While there are generally better alternatives for both languages, neither of them is in a position to replace HLSL or GLSL.

Either because they are blocked by the provider or because they are not supported with 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 noticeable traction in the gamedev community.

Rust GPU continues to develop ideas from the RLSL project, in which an attempt was made to create a Rust compiler to the SPIR-V generic shader intermediate, which is proposed in the Vulkan API and supported in OpenGL 4.6.

At its current stage of development, the Rust GPU already allows you to run simple graphical shaders and compile a significant portion of Rust's basic standard library. At the same time, the project is still far from ready for widespread use, for example loops are not yet supported by shaders.

At Embark, we've been building our own game engine from scratch in Rust. We have prior experience in the in-house development of the RLSL prototype and we have a team of excellent rendering engineers who are familiar with the problems of today's shader languages, both from games, game engines and other industries. Therefore, we believe that we are in a unique position to try to solve this problem.

We want to streamline our own in-house development with a single great language, build an open source graphics community and ecosystem, facilitate code sharing between GPU and CPU, and most importantly, enable our (future) users and fellow developers have more Quickly create engaging and engaging experiences.

Based on the code in the Rust language, a representation of the SPIR-V shaders is formed, for whose generation a special backend for the Rust compiler has been developed, which works by analogy with the cranelift code generator used to compile into a representation WebAssembly.

The current approach is to support the Vulkan graphics API and SPIR-V views, but generators are planned for the future of DXIL (DirectX) and WGSL (WebGPU) shader views. Building on Cargo and, tools are being developed to develop and publish packages with shaders in SPIR-V format.

Finally, if you want to know more about this project, you can check the details in the project's repository, the link is this.

As for those who are interested in being able to know the code, they should know that the code is published under the MIT and Apache 2.0 licenses and it is possible to obtain it from the link below.

And they can also consult the documentation, which is already prepared for developers so that they can work on Linux, Windows and Mac. consult the guide at this link.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

A comment, leave yours

Leave a Comment

Your email address will not be published.



  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Autopilot said

    Rust takes off, hopefully not another "deadly Scala."