Skip to content

Commit 363b6ec

Browse files
committed
update readme's dump-usage
1 parent b06ee19 commit 363b6ec

File tree

1 file changed

+166
-85
lines changed

1 file changed

+166
-85
lines changed

README.md

Lines changed: 166 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -64,185 +64,266 @@ for an example.
6464
build Compile a shader crate to SPIR-V
6565
show Show some useful values
6666
help Print this message or the help of the given subcommand(s)
67-
67+
6868
Options:
6969
-h, --help
7070
Print help
71-
71+
7272
-V, --version
7373
Print version
7474
7575
7676
* Install
7777
Install rust-gpu compiler artifacts
78-
78+
7979
Usage: cargo-gpu install [OPTIONS]
80-
80+
8181
Options:
8282
--shader-crate <SHADER_CRATE>
8383
Directory containing the shader crate to compile
84-
84+
8585
[default: ./]
86-
86+
8787
--spirv-builder-source <SPIRV_BUILDER_SOURCE>
8888
Source of `spirv-builder` dependency Eg: "https://github.com/Rust-GPU/rust-gpu"
89-
89+
9090
--spirv-builder-version <SPIRV_BUILDER_VERSION>
9191
Version of `spirv-builder` dependency.
9292
* If `--spirv-builder-source` is not set, then this is assumed to be a crates.io semantic
9393
version such as "0.9.0".
9494
* If `--spirv-builder-source` is set, then this is assumed to be a Git "commitsh", such
9595
as a Git commit hash or a Git tag, therefore anything that `git checkout` can resolve.
96-
97-
--rust-toolchain <RUST_TOOLCHAIN>
98-
Rust toolchain channel to use to build `spirv-builder`.
99-
100-
This must be compatible with the `spirv_builder` argument as defined in the `rust-gpu` repo.
101-
96+
10297
--force-spirv-cli-rebuild
103-
Force `spirv-builder-cli` and `rustc_codegen_spirv` to be rebuilt
104-
98+
Force `rustc_codegen_spirv` to be rebuilt
99+
105100
--auto-install-rust-toolchain
106101
Assume "yes" to "Install Rust toolchain: [y/n]" prompt
107-
102+
103+
--force-overwrite-lockfiles-v4-to-v3
104+
There is a tricky situation where a shader crate that depends on workspace config can have
105+
a different `Cargo.lock` lockfile version from the the workspace's `Cargo.lock`. This can
106+
prevent builds when an old Rust toolchain doesn't recognise the newer lockfile version.
107+
108+
The ideal way to resolve this would be to match the shader crate's toolchain with the
109+
workspace's toolchain. However, that is not always possible. Another solution is to
110+
`exclude = [...]` the problematic shader crate from the workspace. This also may not be a
111+
suitable solution if there are a number of shader crates all sharing similar config and
112+
you don't want to have to copy/paste and maintain that config across all the shaders.
113+
114+
So a somewhat hacky workaround is to have `cargo gpu` overwrite lockfile versions. Enabling
115+
this flag will only come into effect if there are a mix of v3/v4 lockfiles. It will also
116+
only overwrite versions for the duration of a build. It will attempt to return the versions
117+
to their original values once the build is finished. However, of course, unexpected errors
118+
can occur and the overwritten values can remain. Hence why this behaviour is not enabled by
119+
default.
120+
121+
This hack is possible because the change from v3 to v4 only involves a minor change to the
122+
way source URLs are encoded. See these PRs for more details:
123+
* <https://github.com/rust-lang/cargo/pull/12280>
124+
* <https://github.com/rust-lang/cargo/pull/14595>
125+
108126
-h, --help
109127
Print help (see a summary with '-h')
110128
111129
112130
* Build
113131
Compile a shader crate to SPIR-V
114-
132+
115133
Usage: cargo-gpu build [OPTIONS]
116-
134+
117135
Options:
118136
--shader-crate <SHADER_CRATE>
119137
Directory containing the shader crate to compile
120-
138+
121139
[default: ./]
122-
140+
123141
--spirv-builder-source <SPIRV_BUILDER_SOURCE>
124142
Source of `spirv-builder` dependency Eg: "https://github.com/Rust-GPU/rust-gpu"
125-
143+
126144
--spirv-builder-version <SPIRV_BUILDER_VERSION>
127145
Version of `spirv-builder` dependency.
128146
* If `--spirv-builder-source` is not set, then this is assumed to be a crates.io semantic
129147
version such as "0.9.0".
130148
* If `--spirv-builder-source` is set, then this is assumed to be a Git "commitsh", such
131149
as a Git commit hash or a Git tag, therefore anything that `git checkout` can resolve.
132-
133-
--rust-toolchain <RUST_TOOLCHAIN>
134-
Rust toolchain channel to use to build `spirv-builder`.
135-
136-
This must be compatible with the `spirv_builder` argument as defined in the `rust-gpu` repo.
137-
150+
138151
--force-spirv-cli-rebuild
139-
Force `spirv-builder-cli` and `rustc_codegen_spirv` to be rebuilt
140-
152+
Force `rustc_codegen_spirv` to be rebuilt
153+
141154
--auto-install-rust-toolchain
142155
Assume "yes" to "Install Rust toolchain: [y/n]" prompt
143-
156+
157+
--force-overwrite-lockfiles-v4-to-v3
158+
There is a tricky situation where a shader crate that depends on workspace config can have
159+
a different `Cargo.lock` lockfile version from the the workspace's `Cargo.lock`. This can
160+
prevent builds when an old Rust toolchain doesn't recognise the newer lockfile version.
161+
162+
The ideal way to resolve this would be to match the shader crate's toolchain with the
163+
workspace's toolchain. However, that is not always possible. Another solution is to
164+
`exclude = [...]` the problematic shader crate from the workspace. This also may not be a
165+
suitable solution if there are a number of shader crates all sharing similar config and
166+
you don't want to have to copy/paste and maintain that config across all the shaders.
167+
168+
So a somewhat hacky workaround is to have `cargo gpu` overwrite lockfile versions. Enabling
169+
this flag will only come into effect if there are a mix of v3/v4 lockfiles. It will also
170+
only overwrite versions for the duration of a build. It will attempt to return the versions
171+
to their original values once the build is finished. However, of course, unexpected errors
172+
can occur and the overwritten values can remain. Hence why this behaviour is not enabled by
173+
default.
174+
175+
This hack is possible because the change from v3 to v4 only involves a minor change to the
176+
way source URLs are encoded. See these PRs for more details:
177+
* <https://github.com/rust-lang/cargo/pull/12280>
178+
* <https://github.com/rust-lang/cargo/pull/14595>
179+
144180
-o, --output-dir <OUTPUT_DIR>
145181
Path to the output directory for the compiled shaders
146-
182+
147183
[default: ./]
148-
149-
--no-default-features
150-
Set cargo default-features
151-
152-
--features <FEATURES>
153-
Set cargo features
154-
184+
185+
-w, --watch
186+
Watch the shader crate directory and automatically recompile on changes
187+
188+
--debug
189+
Build in release. Defaults to true
190+
155191
--target <TARGET>
156-
`rust-gpu` compile target
157-
192+
The target triple, eg. `spirv-unknown-vulkan1.2`
193+
158194
[default: spirv-unknown-vulkan1.2]
159-
160-
--shader-target <SHADER_TARGET>
161-
Shader target
162-
163-
[default: spirv-unknown-vulkan1.2]
164-
195+
196+
--no-default-features
197+
Set --default-features for the target shader crate
198+
199+
--features <FEATURES>
200+
Set --features for the target shader crate
201+
165202
--deny-warnings
166-
Treat warnings as errors during compilation
167-
168-
--debug
169-
Compile shaders in debug mode
170-
171-
--capability <CAPABILITY>
172-
Enables the provided SPIR-V capabilities. See: `impl core::str::FromStr for spirv_builder::Capability`
173-
174-
--extension <EXTENSION>
175-
Enables the provided SPIR-V extensions. See <https://github.com/KhronosGroup/SPIRV-Registry> for all extensions
176-
203+
Deny any warnings, as they may never be printed when building within a build script. Defaults to false
204+
177205
--multimodule
178-
Compile one .spv file per entry point
179-
206+
Splits the resulting SPIR-V file into one module per entry point. This is useful in cases where ecosystem tooling has bugs around multiple entry points per module - having all entry points bundled into a single file is the preferred system
207+
180208
--spirv-metadata <SPIRV_METADATA>
181-
Set the level of metadata included in the SPIR-V binary
182-
209+
Sets the level of metadata (primarily `OpName` and `OpLine`) included in the SPIR-V binary. Including metadata significantly increases binary size
210+
183211
[default: none]
184-
212+
213+
Possible values:
214+
- none: Strip all names and other debug information from SPIR-V output
215+
- name-variables: Only include `OpName`s for public interface variables (uniforms and the like), to allow shader reflection
216+
- full: Include all `OpName`s for everything, and `OpLine`s. Significantly increases binary size
217+
218+
--capabilities <CAPABILITIES>
219+
Adds a capability to the SPIR-V module. Checking if a capability is enabled in code can be done via `#[cfg(target_feature = "TheCapability")]`
220+
221+
--extensions <EXTENSIONS>
222+
Adds an extension to the SPIR-V module. Checking if an extension is enabled in code can be done via `#[cfg(target_feature = "ext:the_extension")]`
223+
185224
--relax-struct-store
186-
Allow store from one struct type to a different type with compatible layout and members
187-
225+
Record whether or not the validator should relax the rules on types for stores to structs. When relaxed, it will allow a type mismatch as long as the types are structs with the same layout. Two structs have the same layout if
226+
227+
1) the members of the structs are either the same type or are structs with same layout, and
228+
229+
2) the decorations that affect the memory layout are identical for both types. Other decorations are not relevant.
230+
188231
--relax-logical-pointer
189-
Allow allocating an object of a pointer type and returning a pointer value from a function in logical addressing mode
190-
191-
--relax-block-layout
192-
Enable `VK_KHR_relaxed_block_layout` when checking standard uniform, storage buffer, and push constant layouts. This is the default when targeting Vulkan 1.1 or later
193-
232+
Records whether or not the validator should relax the rules on pointer usage in logical addressing mode.
233+
234+
When relaxed, it will allow the following usage cases of pointers: 1) `OpVariable` allocating an object whose type is a pointer type 2) `OpReturnValue` returning a pointer value
235+
236+
--relax-block-layout <RELAX_BLOCK_LAYOUT>
237+
Records whether the validator should use "relaxed" block layout rules. Relaxed layout rules are described by Vulkan extension `VK_KHR_relaxed_block_layout`, and they affect uniform blocks, storage blocks, and push constants.
238+
239+
This is enabled by default when targeting Vulkan 1.1 or later. Relaxed layout is more permissive than the default rules in Vulkan 1.0.
240+
241+
[default: false]
242+
[possible values: true, false]
243+
194244
--uniform-buffer-standard-layout
195-
Enable `VK_KHR_uniform_buffer_standard_layout` when checking standard uniform buffer layouts
196-
245+
Records whether the validator should use standard block layout rules for uniform blocks
246+
197247
--scalar-block-layout
198-
Enable `VK_EXT_scalar_block_layout` when checking standard uniform, storage buffer, and push constant layouts. Scalar layout rules are more permissive than relaxed block layout so in effect this will override the --relax-block-layout option
199-
248+
Records whether the validator should use "scalar" block layout rules. Scalar layout rules are more permissive than relaxed block layout.
249+
250+
See Vulkan extnesion `VK_EXT_scalar_block_layout`. The scalar alignment is defined as follows: - scalar alignment of a scalar is the scalar size - scalar alignment of a vector is the scalar alignment of its component - scalar alignment of a matrix is the scalar alignment of its component - scalar alignment of an array is the scalar alignment of its element - scalar alignment of a struct is the max scalar alignment among its members
251+
252+
For a struct in Uniform, `StorageClass`, or `PushConstant`: - a member Offset must be a multiple of the member's scalar alignment - `ArrayStride` or `MatrixStride` must be a multiple of the array or matrix scalar alignment
253+
200254
--skip-block-layout
201-
Skip checking standard uniform / storage buffer layout. Overrides any --relax-block-layout or --scalar-block-layout option
202-
255+
Records whether or not the validator should skip validating standard uniform/storage block layout
256+
203257
--preserve-bindings
204-
Preserve unused descriptor bindings. Useful for reflection
205-
258+
Records whether all bindings within the module should be preserved
259+
260+
-m, --manifest-file <MANIFEST_FILE>
261+
Renames the manifest.json file to the given name
262+
263+
[default: manifest.json]
264+
206265
-h, --help
207266
Print help (see a summary with '-h')
208267
209268
210269
* Show
211270
Show some useful values
212-
271+
213272
Usage: cargo-gpu show <COMMAND>
214-
273+
215274
Commands:
216275
cache-directory Displays the location of the cache directory
217276
spirv-source The source location of spirv-std
277+
commitsh The git commitsh of this cli tool
278+
capabilities All the available SPIR-V capabilities that can be set with `--capabilities`
218279
help Print this message or the help of the given subcommand(s)
219-
280+
220281
Options:
221282
-h, --help
222283
Print help
223284
224285
225286
* Cache-directory
226287
Displays the location of the cache directory
227-
288+
228289
Usage: cargo-gpu show cache-directory
229-
290+
230291
Options:
231292
-h, --help
232293
Print help
233294
234295
235296
* Spirv-source
236297
The source location of spirv-std
237-
298+
238299
Usage: cargo-gpu show spirv-source [OPTIONS]
239-
300+
240301
Options:
241302
--shader-crate <SHADER_CRATE>
242303
The location of the shader-crate to inspect to determine its spirv-std dependency
243-
304+
244305
[default: ./]
306+
307+
-h, --help
308+
Print help
309+
310+
311+
* Commitsh
312+
The git commitsh of this cli tool
313+
314+
Usage: cargo-gpu show commitsh
315+
316+
Options:
317+
-h, --help
318+
Print help
245319
320+
321+
* Capabilities
322+
All the available SPIR-V capabilities that can be set with `--capabilities`
323+
324+
Usage: cargo-gpu show capabilities
325+
326+
Options:
246327
-h, --help
247328
Print help
248329
````

0 commit comments

Comments
 (0)