This repository was archived by the owner on Apr 15, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ pub enum Info {
1919 SpirvSource ( SpirvSourceDep ) ,
2020 /// The git commitsh of this cli tool.
2121 Commitsh ,
22+ /// All the available SPIR-V capabilities that can be set with `--capability`
23+ Capabilities ,
2224}
2325
2426/// `cargo gpu show`
@@ -53,8 +55,27 @@ impl Show {
5355 Info :: Commitsh => {
5456 println ! ( "{}" , std:: env!( "GIT_HASH" ) ) ;
5557 }
58+ Info :: Capabilities => {
59+ println ! ( "All available options to the `cargo gpu build --capability` argument:" ) ;
60+ #[ expect(
61+ clippy:: use_debug,
62+ reason = "It's easier to just use `Debug` formatting than implementing `Display`"
63+ ) ]
64+ for capability in Self :: capability_variants_iter ( ) {
65+ println ! ( " {capability:?}" ) ;
66+ }
67+ }
5668 }
5769
5870 Ok ( ( ) )
5971 }
72+
73+ /// Iterator over all `Capability` variants.
74+ fn capability_variants_iter ( ) -> impl Iterator < Item = spirv_builder_cli:: spirv:: Capability > {
75+ // Since spirv::Capability is repr(u32) we can iterate over
76+ // u32s until some maximum
77+ #[ expect( clippy:: as_conversions, reason = "We know all variants are repr(u32)" ) ]
78+ let last_capability = spirv_builder_cli:: spirv:: Capability :: CacheControlsINTEL as u32 ;
79+ ( 0 ..=last_capability) . filter_map ( spirv_builder_cli:: spirv:: Capability :: from_u32)
80+ }
6081}
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ pub struct BuildArgs {
5454 pub debug : bool ,
5555
5656 /// Enables the provided SPIR-V capabilities.
57- /// See: `impl core::str::FromStr for spirv_builder::Capability `
57+ /// See: `cargo gpu show capabilities `
5858 #[ arg( long, value_parser=Self :: spirv_capability) ]
5959 pub capability : Vec < spirv:: Capability > ,
6060
You can’t perform that action at this time.
0 commit comments