@@ -3,7 +3,7 @@ Command line tool for building Rust shaders using rust-gpu.
33
44## Getting Started
55
6- ### installation
6+ ### Installation
77To install the tool ensure you have ` rustup ` . Then run:
88
99```
@@ -32,3 +32,133 @@ git clone https://github.com/rust-GPU/shader-crate-template
3232cd shader-crate-template
3333cargo gpu build
3434```
35+
36+ ## Usage
37+
38+ ```
39+ Commands:
40+ install Install rust-gpu compiler artifacts
41+ build Compile a shader crate to SPIR-V
42+ toml Compile a shader crate according to the `cargo gpu build` parameters found in the given toml file
43+ help Print this message or the help of the given subcommand(s)
44+
45+ Options:
46+ -h, --help
47+ Print help
48+
49+ -V, --version
50+ Print version
51+
52+
53+ * Install
54+
55+ Install rust-gpu compiler artifacts
56+
57+ Usage: cargo-gpu install [OPTIONS]
58+
59+ Options:
60+ --spirv-builder <SPIRV_BUILDER>
61+ spirv-builder dependency, written just like in a Cargo.toml file
62+
63+ [default: "{ git = \"https://github.com/Rust-GPU/rust-gpu.git\" }"]
64+
65+ --rust-toolchain <RUST_TOOLCHAIN>
66+ Rust toolchain channel to use to build `spirv-builder`.
67+
68+ This must match the `spirv_builder` argument.
69+
70+ [default: nightly-2024-04-24]
71+
72+ --force-spirv-cli-rebuild
73+ Force `spirv-builder-cli` and `rustc_codegen_spirv` to be rebuilt
74+
75+ -h, --help
76+ Print help (see a summary with '-h')
77+
78+
79+ * Build
80+
81+ Compile a shader crate to SPIR-V
82+
83+ Usage: cargo-gpu build [OPTIONS]
84+
85+ Options:
86+ --spirv-builder <SPIRV_BUILDER>
87+ spirv-builder dependency, written just like in a Cargo.toml file
88+
89+ [default: "{ git = \"https://github.com/Rust-GPU/rust-gpu.git\" }"]
90+
91+ --rust-toolchain <RUST_TOOLCHAIN>
92+ Rust toolchain channel to use to build `spirv-builder`.
93+
94+ This must match the `spirv_builder` argument.
95+
96+ [default: nightly-2024-04-24]
97+
98+ --force-spirv-cli-rebuild
99+ Force `spirv-builder-cli` and `rustc_codegen_spirv` to be rebuilt
100+
101+ --shader-crate <SHADER_CRATE>
102+ Directory containing the shader crate to compile
103+
104+ [default: ./]
105+
106+ --shader-target <SHADER_TARGET>
107+ Shader target
108+
109+ [default: spirv-unknown-vulkan1.2]
110+
111+ --no-default-features
112+ Set cargo default-features
113+
114+ --features <FEATURES>
115+ Set cargo features
116+
117+ -o, --output-dir <OUTPUT_DIR>
118+ Path to the output directory for the compiled shaders
119+
120+ [default: ./]
121+
122+ -h, --help
123+ Print help (see a summary with '-h')
124+
125+
126+ * Toml
127+
128+ Compile a shader crate according to the `cargo gpu build` parameters found in the given toml file
129+
130+ Usage: cargo-gpu toml [PATH]
131+
132+ Arguments:
133+ [PATH]
134+ Path to a workspace or package Cargo.toml file.
135+
136+ Must include a [[workspace | package].metadata.rust-gpu.build] section where
137+ arguments to `cargo gpu build` are listed.
138+
139+ Path arguments like `output-dir` and `shader-manifest` must be relative to
140+ the location of the Cargo.toml file.
141+
142+ Example:
143+
144+ ```toml
145+ [package.metadata.rust-gpu.build.spirv-builder]
146+ git = "https://github.com/Rust-GPU/rust-gpu.git"
147+ rev = "0da80f8"
148+
149+ [package.metadata.rust-gpu.build]
150+ output-dir = "shaders"
151+ shader-manifest = "shaders/manifest.json"
152+ ```
153+
154+ Calling `cargo gpu toml {path/to/Cargo.toml}` with a Cargo.toml that
155+ contains the example above would compile the crate and place the compiled
156+ `.spv` files and manifest in a directory "shaders".
157+
158+ [default: ./Cargo.toml]
159+
160+ Options:
161+ -h, --help
162+ Print help (see a summary with '-h')
163+
164+ ```
0 commit comments