EmbarkStudios/rust-gpu

spirv-builder should declare dependencies on Cargo.toml files.

Opened this issue · 4 comments

eddyb commented

For #403 I changed the workspace Cargo.toml, but that didn't result in a rebuild of sky-shader, whereas something like this does cause a rebuild (of example-runner-wgpu, in this example):

[profile.dev.package."example-runner-wgpu"]
opt-level = 3

So I think we need spirv-builder to get the workspace Cargo.toml (and Cargo.lock, I suppose) paths from Cargo somehow, and also list those out as "rebuild if changed".

Hm, thinking about this, is this something that should be fixed in rust-gpu, with manually finding the Cargo.toml somehow (or even more somehow, extracting from cargo), or something that cargo should do when ingesting rustc's .d file and outputting its custom cargo-mangled .d file? (the difference between deps/compute_shader.d and libcompute_shader.d) - if cargo automatically included the relevant files in its .d file, rust-gpu would "just work".

oisyn commented

There currently is no example or test within rust-gpu that actually uses spirv-builder

eddyb commented

that actually uses spirv-builder

To be clear, there is, but not from a build script (except for... Android and wasm, I think?)

And that's because of the hot reloading feature. IMO we should do both: build them in the build script, and have hot reloading as an optional Cargo package feature, so people can know what they can ignore from the example, when they don't want to implement hot reloading themselves (and ideally all the logic that ash and wgpu examples want to share should be in one shared crate).

This issue is now being tracked at: Rust-GPU/rust-gpu#134