Skip to content

cargo-gpu doesn't recompile things when rust-gpu dependency changes #575

Closed

Description

@nazar-pc

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.

Activity

  1. Firestar99 commented on Apr 8, 2026

    @Firestar99
    Member

    I assume with updating rust-gpu you actually mean changing the spirv-std rev.

    Yea a cargo::rerun-if-changed would do it, though I'd give it the Cargo.lock instead to also notice automated upgrades by cargo update.

    Though, I'll delay fixing this issue until cargo-gpu is merged into rust-gpu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions