mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-25 00:04:11 +00:00
Fix up some outdated documentation (#650)
This commit is contained in:
parent
e7b109b1c5
commit
c829157b8b
@ -37,17 +37,28 @@ If you're writing a bigger application and you want to integrate SPIR-V shader
|
||||
crates to display, it's recommended to use `spirv-builder` in a build script.
|
||||
|
||||
1. Copy the [`rust-toolchain`] file to your project. (You must use the same version of Rust as `rust-gpu`.)
|
||||
2. Create a `build.rs` in your project root.
|
||||
2. Reference `spirv-builder` in your Cargo.toml:
|
||||
```toml
|
||||
[build-dependencies]
|
||||
spirv-builder = { git = "https://github.com/EmbarkStudios/rust-gpu" }
|
||||
```
|
||||
(we currently do not publish spirv-builder on crates.io)
|
||||
3. Create a `build.rs` in your project root.
|
||||
|
||||
#### `build.rs`
|
||||
Paste the following into the `main` for your build script.
|
||||
|
||||
```rust,no_run
|
||||
SpirvBuilder::new(path_to_shader)
|
||||
.spirv_version(1, 0)
|
||||
SpirvBuilder::new(path_to_shader, target)
|
||||
.print_metadata(MetadataPrintout::Full)
|
||||
.build()?;
|
||||
```
|
||||
|
||||
The values available for the `target` parameter are available [here](./platform-support.md).
|
||||
For example, if building for vulkan 1.1, use `"spirv-unknown-vulkan1.1"`.
|
||||
|
||||
The `SpirvBuilder` struct has numerous configuration options available, see rustdoc for documentation.
|
||||
|
||||
#### `main.rs`
|
||||
```rust,no_run
|
||||
const SHADER: &[u8] = include_bytes!(env!("<shader_name>.spv"));
|
||||
|
Loading…
Reference in New Issue
Block a user