File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ pub enum Info {
19
19
SpirvSource ( SpirvSourceDep ) ,
20
20
/// The git commitsh of this cli tool.
21
21
Commitsh ,
22
+ /// All the available SPIR-V capabilities that can be set with `--capability`
23
+ Capabilities ,
22
24
}
23
25
24
26
/// `cargo gpu show`
@@ -53,8 +55,27 @@ impl Show {
53
55
Info :: Commitsh => {
54
56
println ! ( "{}" , std:: env!( "GIT_HASH" ) ) ;
55
57
}
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
+ }
56
68
}
57
69
58
70
Ok ( ( ) )
59
71
}
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
+ }
60
81
}
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ pub struct BuildArgs {
54
54
pub debug : bool ,
55
55
56
56
/// Enables the provided SPIR-V capabilities.
57
- /// See: `impl core::str::FromStr for spirv_builder::Capability `
57
+ /// See: `cargo gpu show capabilities `
58
58
#[ arg( long, value_parser=Self :: spirv_capability) ]
59
59
pub capability : Vec < spirv:: Capability > ,
60
60
You can’t perform that action at this time.
0 commit comments