File tree Expand file tree Collapse file tree 2 files changed +40
-3
lines changed
node-graph/graster-nodes/shaders Expand file tree Collapse file tree 2 files changed +40
-3
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,22 @@ pub fn main() -> Result<(), Box<dyn std::error::Error>> {
6
6
7
7
let shader_crate = PathBuf :: from ( concat ! ( env!( "CARGO_MANIFEST_DIR" ) , "/.." ) ) ;
8
8
9
- // install the toolchain and build the `rustc_codegen_spirv` codegen backend with it
10
- let backend = cargo_gpu:: Install :: from_shader_crate ( shader_crate. clone ( ) ) . run ( ) ?;
9
+ let rustc_codegen_spirv_path = std:: env:: var ( "RUSTC_CODEGEN_SPIRV_PATH" ) . unwrap_or_default ( ) ;
10
+ let mut builder = if rustc_codegen_spirv_path. is_empty ( ) {
11
+ // install the toolchain and build the `rustc_codegen_spirv` codegen backend with it
12
+ cargo_gpu:: Install :: from_shader_crate ( shader_crate. clone ( ) )
13
+ . run ( ) ?
14
+ . to_spirv_builder ( shader_crate, "spirv-unknown-naga-wgsl" )
15
+ } else {
16
+ // use the `RUSTC_CODEGEN_SPIRV` environment variable to find the codegen backend
17
+ let mut builder = cargo_gpu:: spirv_builder:: SpirvBuilder :: new ( shader_crate. clone ( ) , "spirv-unknown-naga-wgsl" ) ;
18
+ builder. rustc_codegen_spirv_location = Some ( PathBuf :: from ( rustc_codegen_spirv_path) ) ;
19
+ builder. toolchain_overwrite = Some ( "nightly" . to_string ( ) ) ;
20
+ builder. path_to_target_spec = Some ( PathBuf :: from ( concat ! ( env!( "CARGO_MANIFEST_DIR" ) , "/spirv-unknown-naga-wgsl.json" ) ) ) ;
21
+ builder
22
+ } ;
11
23
12
24
// build the shader crate
13
- let mut builder = backend. to_spirv_builder ( shader_crate, "spirv-unknown-naga-wgsl" ) ;
14
25
builder. print_metadata = MetadataPrintout :: DependencyOnly ;
15
26
builder. spirv_metadata = SpirvMetadata :: Full ;
16
27
builder. shader_crate_features . default_features = false ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "allows-weak-linkage" : false ,
3
+ "arch" : " spirv" ,
4
+ "crt-objects-fallback" : " false" ,
5
+ "crt-static-allows-dylibs" : true ,
6
+ "crt-static-respected" : true ,
7
+ "data-layout" : " e-m:e-p:32:32:32-i64:64-n8:16:32:64" ,
8
+ "dll-prefix" : " " ,
9
+ "dll-suffix" : " .spv.json" ,
10
+ "dynamic-linking" : true ,
11
+ "emit-debug-gdb-scripts" : false ,
12
+ "env" : " naga-wgsl" ,
13
+ "linker-flavor" : " unix" ,
14
+ "linker-is-gnu" : false ,
15
+ "llvm-target" : " spirv-unknown-naga-wgsl" ,
16
+ "main-needs-argc-argv" : false ,
17
+ "metadata" : {
18
+ "description" : null ,
19
+ "host_tools" : null ,
20
+ "std" : null ,
21
+ "tier" : null
22
+ },
23
+ "panic-strategy" : " abort" ,
24
+ "simd-types-indirect" : false ,
25
+ "target-pointer-width" : " 32"
26
+ }
You can’t perform that action at this time.
0 commit comments