rust-gpu v0.2
Created by @bcata6 using rust-gpu
(Rust source) with shaders originally from https://shadertoy.com/
Hello everyone, and welcome to the second release of rust-gpu
! Our project aimed at making Rust a first class language and ecosystem for GPU programming. You can read more about why we at Embark started this project in the original announcement.
First of all we'd like to welcome @eddyb, who will be working as a collaborator with the rust-gpu team on the compiler backend, and has already been contributing a lot of improvements to rust-gpu
!
We're still not really cutting releases for rust-gpu
, but we wanted to highlight some of the changes that have been happening over the past month. For more information on how to get started with using it in your projects, be sure to check out the new Rust-GPU Dev Guide!
Community
- SHADERed, an IDE designed for building shaders have released a plugin and added support for running
rust-gpu
in SHADERed lite, their in-browser editor. Now you can to write Rust shaders on the web and in an IDE! Check out their blog post for more details on the new features.
SPIR-V Backend
- We've added a new structurizer, which means that you can now use
match
expressions andcontinue
s! - Added the
#[spirv(flat)]
attribute that matches SPIR-V's "Flat" decorator. - Textures are now supported. You can now use the GPU's image memory to sample and manipulate textures.
- Panicking code is now supported.
- Added support for SPIR-V 1.0.
- You can now use procedural macros, such as the
unroll
crate in your shaders. - We've also made some improvements to error messages about constant pointers.
- Thanks to a community contribution we now also have initial support for compute shaders. Though support is still pretty bare bones for now this is an important start towards supporting different shaders in
rust-gpu
. - Added initial support in Rust and
rust-gpu
for inline SPIR-V with theasm!
nightly feature. You can now write inline SPIR-V in your Rust code (example below). This is an important step towards implementing a lot of functionality around SPIR-V's features, such as the aforementioned new texture support.asm! { "%typeSampledImage = OpTypeSampledImage typeof*{1}", "%image = OpLoad typeof*{1} {1}", "%sampler = OpLoad typeof*{2} {2}", "%coord = OpLoad typeof*{3} {3}", "%sampledImage = OpSampledImage %typeSampledImage %image %sampler", "%result = OpImageSampleImplicitLod typeof*{0} %sampledImage %coord", "OpStore {0} %result", in(reg) &mut result, in(reg) &image, in(reg) &sampler, in(reg) &coord }
spirv-std
- All Storage Classes (e.g.
Input
/Output
) are now defined inspirv_std::storage_class
. - Rust's language items such
rust_eh_personality
andpanic_handler
are now defined inspirv-std
for SPIR-V targets. This reduces the amount of boilerplate code you need in your shader, and helpsspirv-std
feel a bit more likestd
. You can still define your own language items by disabling thelang_items
feature.
Misc
rust-gpu
now has testing support for building on Android. You can now also run the WGPU example on Android devices to test out your shaders.
Contributors
Thank you to all the contributors who helped make this release possible! 🎉