@@ -95,13 +95,13 @@ which may slow down full rebuilds a bit. Please read [this
95
95
issue] ( https://github.com/EmbarkStudios/rust-gpu/issues/448 ) for more
96
96
information, there's a few important caveats to know about this.
97
97
98
- ### Using ` .cargo/config `
98
+ ### Using ` .cargo/config.toml `
99
99
100
100
> ** Note** This method will require manually rebuilding ` rust-gpu ` each
101
101
time there has been changes to the repository.
102
102
103
103
If you just want to build a shader crate, and don't need to automatically
104
- compile the SPIR-V binary at build time, you can use ` .cargo/config ` to set the
104
+ compile the SPIR-V binary at build time, you can use ` .cargo/config.toml ` to set the
105
105
necessary flags. Before you can do that however you need to do a couple of steps
106
106
first to build the compiler backend.
107
107
@@ -112,17 +112,23 @@ Now you should have a `librustc_codegen_spirv` dynamic library available in
112
112
` target/release ` . You'll need to keep this somewhere stable that you can
113
113
reference from your shader project.
114
114
115
- Now we need to add our ` .cargo/config ` file. This is a configuration file that
116
- tells cargo how to build for SPIR-V. You need provide the target you're
117
- compiling for (see [ platform support] ( ./platform-support.md ) ) and provide a path
118
- to your built ` rustc_codegen_spirv ` dynamic library. We have to also provide
119
- some additional options.
115
+ Copy the ` rust-gpu/rust-toolchain.toml ` file to your project. You must use the same
116
+ version of Rust as ` rust-gpu ` so that dynamic codegen library can be loaded by ` rustc ` .
117
+
118
+ Now we need to add our ` .cargo/config.toml ` file that can be used to teach ` cargo `
119
+ how to build SPIR-V. Here are a few things we need to mention there.
120
+
121
+ - Path to a spec of a target you're compiling for (see [ platform support] ( ./platform-support.md ) ).
122
+ These specs reside in a directory inside the ` spirv-builder ` crate and an example relative path
123
+ could look like ` ../rust-gpu/crates/spirv-builder/target-specs/spirv-unknown-spv1.3.json ` .
124
+ - Absolute path to the ` rustc_codegen_spirv ` dynamic library that we built above.
125
+ - Some additional options.
120
126
121
127
``` toml
122
128
[build ]
123
- target = " spirv-unknown-spv1.3 "
129
+ target = " <path_to_target_spec> "
124
130
rustflags = [
125
- " -Zcodegen-backend=<path_to_librustc_codegen_spirv >" ,
131
+ " -Zcodegen-backend=<absolute_path_to_librustc_codegen_spirv >" ,
126
132
" -Zbinary-dep-depinfo" ,
127
133
" -Csymbol-mangling-version=v0" ,
128
134
" -Zcrate-attr=feature(register_tool)" ,
0 commit comments