1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
[]
= "wgpu"
= true
= true
= true
= "Cross-platform, safe, pure-rust graphics API"
= true
= true
= true
= true
= "../README.md"
= ["Cargo.lock"]
[]
= true
= ["--cfg", "docsrs"]
= [
"x86_64-unknown-linux-gnu",
"x86_64-apple-darwin",
"x86_64-pc-windows-msvc",
"wasm32-unknown-unknown",
]
[]
# Cargo machete can't check build.rs dependencies. See https://github.com/bnjbvr/cargo-machete/issues/100
= ["cfg_aliases"]
[]
[]
= ["wgsl", "dx12", "metal", "webgpu"]
#! ### Backends
# --------------------------------------------------------------------
#! ⚠️ WIP: Not all backends can be manually configured today.
#! On Windows, Linux & Android the Vulkan & GLES backends are always enabled.
#! See [#3514](https://github.com/gfx-rs/wgpu/issues/3514) for more details.
## Enables the DX12 backend on Windows.
= ["wgc?/dx12"]
## Enables the Metal backend on macOS & iOS.
= ["wgc?/metal"]
## Enables the WebGPU backend on Wasm. Disabled when targeting `emscripten`.
= ["naga?/wgsl-out"]
## Enables the GLES backend via [ANGLE](https://github.com/google/angle) on macOS using.
= ["wgc?/gles"]
## Enables the Vulkan backend on macOS & iOS.
= ["wgc?/vulkan"]
## Enables the GLES backend on Wasm
##
## * ⚠️ WIP: Currently will also enable GLES dependencies on any other targets.
= ["dep:hal", "wgc/gles"]
#! **Note:** In the documentation, if you see that an item depends on a backend,
#! it means that the item is only available when that backend is enabled _and_ the backend
#! is supported on the current platform.
#! ### Shading language support
# --------------------------------------------------------------------
## Enable accepting SPIR-V shaders as input.
= ["naga/spv-in", "wgc/spirv"]
## Enable accepting GLSL shaders as input.
= ["naga/glsl-in", "wgc/glsl"]
## Enable accepting WGSL shaders as input.
= ["wgc?/wgsl"]
## Enable accepting naga IR shaders as input.
= ["dep:naga"]
#! ### Logging & Tracing
# --------------------------------------------------------------------
#! The following features do not have any effect on the WebGPU backend.
## Apply run-time checks, even in release builds. These are in addition
## to the validation carried out at public APIs in all builds.
= ["wgc?/strict_asserts", "wgt/strict_asserts"]
## Enables serialization via `serde` on common wgpu types.
= ["dep:serde", "wgc/serde"]
# Uncomment once we get to https://github.com/gfx-rs/wgpu/issues/5974
# ## Allow writing of trace capture files. See [`Adapter::request_device`].
# trace = ["serde", "wgc/trace"]
## Allow deserializing of trace capture files that were written with the `trace` feature.
## To replay a trace file use the [wgpu player](https://github.com/gfx-rs/wgpu/tree/trunk/player).
= ["serde", "wgc/replay"]
#! ### Other
# --------------------------------------------------------------------
## Internally count resources and events for debugging purposes. If the counters
## feature is disabled, the counting infrastructure is removed from the build and
## the exposed counters always return 0.
= ["wgc/counters"]
## Implement `Send` and `Sync` on Wasm, but only if atomics are not enabled.
##
## WebGL/WebGPU objects can not be shared between threads.
## However, it can be useful to artificially mark them as `Send` and `Sync`
## anyways to make it easier to write cross-platform code.
## This is technically *very* unsafe in a multithreaded environment,
## but on a wasm binary compiled without atomics we know we are definitely
## not in a multithreaded environment.
= [
"hal/fragile-send-sync-non-atomic-wasm",
"wgc/fragile-send-sync-non-atomic-wasm",
"wgt/fragile-send-sync-non-atomic-wasm",
]
#! ### External libraries
# --------------------------------------------------------------------
#! The following features facilitate integration with third-party supporting libraries.
## Enables statically linking DXC.
## Normally, to use the modern DXC shader compiler with WGPU, the final application
## must be shipped alongside `dxcompiler.dll` and `dxil.dll` (which can be downloaded from Microsoft's GitHub).
## This feature statically links a version of DXC so that no external binaries are required
## to compile DX12 shaders.
= ["hal/static-dxc"]
# wgpu-core is always available as an optional dependency, "wgc".
# Whenever wgpu-core is selected, we want raw window handle support.
[]
= true
= true
= ["raw-window-handle"]
# wgpu-core is required whenever not targeting web APIs directly.
# Whenever wgpu-core is selected, we want raw window handle support.
[]
= true
= ["raw-window-handle"]
# If we are not targeting WebGL, enable indirect-validation.
# WebGL doesn't support indirect execution so this is not needed.
[]
= true
= ["indirect-validation"]
# Enable `wgc` by default on macOS and iOS to allow the `metal` crate feature to
# enable the Metal backend while being no-op on other targets.
[]
= true
# We want the wgpu-core Direct3D backend and OpenGL (via WGL) on Windows.
[]
= true
= ["gles"]
# We want the wgpu-core Vulkan backend on Unix (but not emscripten, macOS, iOS) and Windows.
[]
= true
= ["vulkan"]
# We want the wgpu-core GLES backend on Unix (but not macOS, iOS).
[]
= true
= ["gles"]
[]
= true
# We need wgpu-hal unless we're targeting the web APIs.
[]
= { = true }
[]
= { = true, = ["renderdoc"] }
[]
= { = true, = ["renderdoc"] }
[]
= true
= true
[]
= true
= true
= true
= true
= true
= true
= { = true, = ["std"] }
= { = true, = ["default", "derive"], = true }
= true
= true
[]
= true
= true
[]
= true
# used to test all the example shaders
[]
= true
= ["wgsl-in"]
[]
= { = true, = [
"default",
"Document",
"Navigator",
"Node",
"NodeList",
"HtmlCanvasElement",
"OffscreenCanvas",
"ImageBitmap",
"ImageBitmapRenderingContext",
"Window",
"WorkerGlobalScope",
"WorkerNavigator",
# Needed by webgpu_sys
"Event",
"EventTarget",
] }
= true
= { = true, = ["default"] }
= true
= true