@@ -95,13 +95,13 @@ which may slow down full rebuilds a bit. Please read [this
9595issue] ( https://github.com/EmbarkStudios/rust-gpu/issues/448 ) for more
9696information, there's a few important caveats to know about this.
9797
98- ### Using ` .cargo/config `
98+ ### Using ` .cargo/config.toml `
9999
100100> ** Note** This method will require manually rebuilding ` rust-gpu ` each
101101 time there has been changes to the repository.
102102
103103If 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
105105necessary flags. Before you can do that however you need to do a couple of steps
106106first to build the compiler backend.
107107
@@ -112,17 +112,23 @@ Now you should have a `librustc_codegen_spirv` dynamic library available in
112112` target/release ` . You'll need to keep this somewhere stable that you can
113113reference from your shader project.
114114
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.
120126
121127``` toml
122128[build ]
123- target = " spirv-unknown-spv1.3 "
129+ target = " <path_to_target_spec> "
124130rustflags = [
125- " -Zcodegen-backend=<path_to_librustc_codegen_spirv >" ,
131+ " -Zcodegen-backend=<absolute_path_to_librustc_codegen_spirv >" ,
126132 " -Zbinary-dep-depinfo" ,
127133 " -Csymbol-mangling-version=v0" ,
128134 " -Zcrate-attr=feature(register_tool)" ,
0 commit comments