You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
help Print this message or the help of the given subcommand(s)
67
-
67
+
68
68
Options:
69
69
-h, --help
70
70
Print help
71
-
71
+
72
72
-V, --version
73
73
Print version
74
74
75
75
76
76
* Install
77
77
Install rust-gpu compiler artifacts
78
-
78
+
79
79
Usage: cargo-gpu install [OPTIONS]
80
-
80
+
81
81
Options:
82
82
--shader-crate <SHADER_CRATE>
83
83
Directory containing the shader crate to compile
84
-
84
+
85
85
[default: ./]
86
-
86
+
87
87
--spirv-builder-source <SPIRV_BUILDER_SOURCE>
88
88
Source of `spirv-builder` dependency Eg: "https://github.com/Rust-GPU/rust-gpu"
89
-
89
+
90
90
--spirv-builder-version <SPIRV_BUILDER_VERSION>
91
91
Version of `spirv-builder` dependency.
92
92
* If `--spirv-builder-source` is not set, then this is assumed to be a crates.io semantic
93
93
version such as "0.9.0".
94
94
* If `--spirv-builder-source` is set, then this is assumed to be a Git "commitsh", such
95
95
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
+
102
97
--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
+
105
100
--auto-install-rust-toolchain
106
101
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
+
108
126
-h, --help
109
127
Print help (see a summary with '-h')
110
128
111
129
112
130
* Build
113
131
Compile a shader crate to SPIR-V
114
-
132
+
115
133
Usage: cargo-gpu build [OPTIONS]
116
-
134
+
117
135
Options:
118
136
--shader-crate <SHADER_CRATE>
119
137
Directory containing the shader crate to compile
120
-
138
+
121
139
[default: ./]
122
-
140
+
123
141
--spirv-builder-source <SPIRV_BUILDER_SOURCE>
124
142
Source of `spirv-builder` dependency Eg: "https://github.com/Rust-GPU/rust-gpu"
125
-
143
+
126
144
--spirv-builder-version <SPIRV_BUILDER_VERSION>
127
145
Version of `spirv-builder` dependency.
128
146
* If `--spirv-builder-source` is not set, then this is assumed to be a crates.io semantic
129
147
version such as "0.9.0".
130
148
* If `--spirv-builder-source` is set, then this is assumed to be a Git "commitsh", such
131
149
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
+
138
151
--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
+
141
154
--auto-install-rust-toolchain
142
155
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
+
144
180
-o, --output-dir <OUTPUT_DIR>
145
181
Path to the output directory for the compiled shaders
146
-
182
+
147
183
[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
+
155
191
--target <TARGET>
156
-
`rust-gpu` compile target
157
-
192
+
The target triple, eg. `spirv-unknown-vulkan1.2`
193
+
158
194
[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
+
165
202
--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
+
177
205
--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
+
180
208
--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
+
183
211
[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
+
185
224
--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
+
188
231
--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
+
194
244
--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
+
197
247
--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
+
200
254
--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
+
203
257
--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
+
206
265
-h, --help
207
266
Print help (see a summary with '-h')
208
267
209
268
210
269
* Show
211
270
Show some useful values
212
-
271
+
213
272
Usage: cargo-gpu show <COMMAND>
214
-
273
+
215
274
Commands:
216
275
cache-directory Displays the location of the cache directory
217
276
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`
218
279
help Print this message or the help of the given subcommand(s)
219
-
280
+
220
281
Options:
221
282
-h, --help
222
283
Print help
223
284
224
285
225
286
* Cache-directory
226
287
Displays the location of the cache directory
227
-
288
+
228
289
Usage: cargo-gpu show cache-directory
229
-
290
+
230
291
Options:
231
292
-h, --help
232
293
Print help
233
294
234
295
235
296
* Spirv-source
236
297
The source location of spirv-std
237
-
298
+
238
299
Usage: cargo-gpu show spirv-source [OPTIONS]
239
-
300
+
240
301
Options:
241
302
--shader-crate <SHADER_CRATE>
242
303
The location of the shader-crate to inspect to determine its spirv-std dependency
243
-
304
+
244
305
[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
245
319
320
+
321
+
* Capabilities
322
+
All the available SPIR-V capabilities that can be set with `--capabilities`
0 commit comments