I was just testing things and noticed an interesting, both expected and unexpected gotcha: changing rust-gpu dependency doesn't result in shader recompilation when cargo-gpu doesn't change.
I use cargo-gpu-install specifically in build.rs and do not have rust-gpu in build dependencies. So while cargo-gpu reads the version/revision of rust-gpu to decide what backend version to use, changing rust-gpu doesn't have any impact on anything that would result in build.rs being recompiled, as such shader is still built with the old version.
One solution might be to include the Cargo.toml of both the crate and probably the workspace root (if any) too in cargo::rerun-if-changed, though it will also result in too many unnecessary recompilations, so it is not perfect.
I do not have a great solution, but wanted to raise this as a concern that might be quite confusing to others and probably worth fixing.
I was just testing things and noticed an interesting, both expected and unexpected gotcha: changing
rust-gpudependency doesn't result in shader recompilation whencargo-gpudoesn't change.I use
cargo-gpu-installspecifically inbuild.rsand do not haverust-gpuin build dependencies. So whilecargo-gpureads the version/revision ofrust-gputo decide what backend version to use, changingrust-gpudoesn't have any impact on anything that would result inbuild.rsbeing recompiled, as such shader is still built with the old version.One solution might be to include the
Cargo.tomlof both the crate and probably the workspace root (if any) too incargo::rerun-if-changed, though it will also result in too many unnecessary recompilations, so it is not perfect.I do not have a great solution, but wanted to raise this as a concern that might be quite confusing to others and probably worth fixing.