File tree 1 file changed +14
-3
lines changed
1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -37,17 +37,28 @@ If you're writing a bigger application and you want to integrate SPIR-V shader
37
37
crates to display, it's recommended to use ` spirv-builder ` in a build script.
38
38
39
39
1 . Copy the [ ` rust-toolchain ` ] file to your project. (You must use the same version of Rust as ` rust-gpu ` .)
40
- 2 . Create a ` build.rs ` in your project root.
40
+ 2 . Reference ` spirv-builder ` in your Cargo.toml:
41
+ ``` toml
42
+ [build-dependencies ]
43
+ spirv-builder = { git = " https://github.com/EmbarkStudios/rust-gpu" }
44
+ ```
45
+ (we currently do not publish spirv-builder on crates.io)
46
+ 3. Create a `build.rs` in your project root.
41
47
42
48
# ### `build.rs`
43
49
Paste the following into the `main` for your build script.
50
+
44
51
```rust,no_run
45
- SpirvBuilder::new(path_to_shader)
46
- .spirv_version(1, 0)
52
+ SpirvBuilder::new(path_to_shader, target)
47
53
.print_metadata(MetadataPrintout::Full)
48
54
.build()?;
49
55
```
50
56
57
+ The values available for the ` target ` parameter are available [ here] ( ./platform-support.md ) .
58
+ For example, if building for vulkan 1.1, use ` "spirv-unknown-vulkan1.1" ` .
59
+
60
+ The ` SpirvBuilder ` struct has numerous configuration options available, see rustdoc for documentation.
61
+
51
62
#### ` main.rs `
52
63
``` rust,no_run
53
64
const SHADER: &[u8] = include_bytes!(env!("<shader_name>.spv"));
You can’t perform that action at this time.
0 commit comments