* Update to the new rust-toolchain format * Remove unneeded docs * Update CI for toolchain file * Update ci.yaml * Update ci.yaml * Update deploy_docs.yml * Update ci.yaml * Update deploy_docs.yml * Remove redundant `rustup component add` commands from ci.yaml. * Shorten "Continuous integration" to "CI" in ci.yaml. * Add a helpful message above the TOML in rust-toolchain. * Don't update rustup in ci.yaml, GHA already has the right version. Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Co-authored-by: Eduard-Mihai Burtescu <eddyb@lyken.rs>
3.0 KiB
Building Rust-GPU
Getting started
-
Clone the repository.
git clone --recurse-submodules https://github.com/EmbarkStudios/rust-gpu -
optional Install SPIRV-Tools and add it to your
PATH. You can skip this step if you just want to run examples with the defaults. See Using installed SPIRV-Tools if you decide to go with this option. -
Next, look at the examples folder. There are two kinds of targets here: [runners] and [shaders]. The projects inside
shadersare "GPU crates", i.e. ones that will be compiled one or more SPIR-V modules. Therunnerprojects are normal, CPU crates that use some graphics backend (currently, we have awgpurunner, a Vulkan runner throughash, and a barebones pure software CPU runner) to actually run one of the "GPU crate" shaders.Run the example:
cargo run --bin example-runner-wgpuThis will build
rustc_codegen_spirv, the compiler, then use that compiler to buildsky-shaderinto a SPIR-V module, then finally, build awgpusample app (modified fromwgpu's examples) using the built SPIR-V module to display the shader in a window.
Using installed SPIRV-Tools
By default, all of the crates and examples in this repo will compile the spirv-tools-sys crate, including a lot of C++ code from SPIRV-Tools. If you don't want to build the C++ code because you already have SPIRV-Tools installed, or just don't want to spend more time compiling, you can build/run the crate with the use-installed-tools feature.
cargo run \
--manifest-path examples/example-runner/Cargo.toml \
--features use-installed-tools \
--no-default-features
You should see warning: use-installed-tools feature on, skipping compilation of C++ code during the compilation, but otherwise the build will function just the same as if you compiled the C++ code, with the exception that it will fail if you don't have SPIRV-Tools installed correctly.