Skip to content

Commit

Permalink
Support for setting config in shader's Cargo.toml
Browse files Browse the repository at this point in the history
Values are set in the TOML section: `[package.metadata.rust-gpu.*]`.
So now the priority, from least to most, is:
* Workspace metadata
* Shader crate's metadata
* CLI args

Fixes #15

Notable changes:
* All `clap` args for the `build` and `install` subcommands are now
  defined in the `spirv-builder-cli` crate. This makes passing all the
  config between `cargo gpu` and `spirv-builder-cli` trivial as `serde`
  now does all the heavy lifting of creating and reading the JSON
  arguments.
* There is no longer a `toml` subcommand. The shader crate's `Cargo.toml`s
  are always read and their configs used as the base for CLI args to
  override.

TODO:
* [ ] Reuse the `get_cargo_toml_as_json()` function to parse the
      shader crate's `spirv-std` dependency. This will simplify the code
      and be more reliable.
* [ ] `cargo gpu show targets`
* [ ] `cargo gpu show capabilities`
* [ ] `cargo gpu show etensions`
* [ ] I'm still a bit confused about the `target` and `shader_target`
      arguments, are they both needed?
  • Loading branch information
tombh committed Jan 6, 2025
1 parent 955afa4 commit 66db529
Show file tree
Hide file tree
Showing 18 changed files with 925 additions and 500 deletions.
31 changes: 31 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ members = [
]

exclude = [
# Can't be included because it depends on a specific Rust toolchain and considering that
# the reason it exists is to prevent Rust toolchain requirements from polluting workspaces
# then let's just not try to workaround it.
"crates/spirv-builder-cli",

# This currently needs to be excluded because it depends on a version of `rust-gpu` that
Expand All @@ -22,6 +25,7 @@ directories = "5.0.1"
env_home = "0.1.0"
env_logger = "0.10"
http = "1.2.0"
itertools = "0.14.0"
log = "0.4"
relative-path = "1.9.3"
serde = { version = "1.0.214", features = ["derive"] }
Expand Down Expand Up @@ -51,5 +55,3 @@ pub_with_shorthand = { level = "allow", priority = 1 }
partial_pub_fields = { level = "allow", priority = 1 }
pattern_type_mismatch = { level = "allow", priority = 1 }
std_instead_of_alloc = { level = "allow", priority = 1 }


Loading

0 comments on commit 66db529

Please sign in to comment.