@@ -29,7 +29,7 @@ ignored = ["cfg_aliases"]
2929[lib ]
3030
3131[features ]
32- default = [" wgsl" , " dx12" , " metal" , " webgpu" ]
32+ default = [" wgsl" , " dx12" , " metal" , " webgpu" , " core " ]
3333
3434# ! ### Backends
3535# --------------------------------------------------------------------
@@ -46,6 +46,12 @@ metal = ["wgc?/metal"]
4646# # Enables the WebGPU backend on Wasm. Disabled when targeting `emscripten`.
4747webgpu = [" naga?/wgsl-out" ]
4848
49+ # # Enables wgpu-core if platform supports it
50+ # #
51+ # # This exist so we can allow users to bring their own contexts
52+ # # and not need to get wgpu-core
53+ core = [" dep:wgc" , " dep:hal" ]
54+
4955# # Enables the GLES backend via [ANGLE](https://github.com/google/angle) on macOS using.
5056angle = [" wgc?/gles" ]
5157
@@ -117,59 +123,53 @@ fragile-send-sync-non-atomic-wasm = [
117123 " wgt/fragile-send-sync-non-atomic-wasm" ,
118124]
119125
120- # wgpu-core is always available as an optional dependency, "wgc".
121- # Whenever wgpu-core is selected, we want raw window handle support.
122- [dependencies .wgc ]
123- optional = true
124- workspace = true
125- features = [" raw-window-handle" ]
126-
127126# wgpu-core is required whenever not targeting web APIs directly.
128127# Whenever wgpu-core is selected, we want raw window handle support.
129128[target .'cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))' .dependencies .wgc ]
130129workspace = true
130+ optional = true
131131features = [" raw-window-handle" ]
132132
133133# Enable `wgc` by default on macOS and iOS to allow the `metal` crate feature to
134134# enable the Metal backend while being no-op on other targets.
135135[target .'cfg(any(target_os = "macos", target_os = "ios"))' .dependencies .wgc ]
136136workspace = true
137+ optional = true
137138
138139# We want the wgpu-core Direct3D backend and OpenGL (via WGL) on Windows.
139140[target .'cfg(windows)' .dependencies .wgc ]
140141workspace = true
142+ optional = true
141143features = [" gles" ]
142144
143145# We want the wgpu-core Vulkan backend on Unix (but not emscripten, macOS, iOS) and Windows.
144146[target .'cfg(any(windows, all(unix, not(target_os = "emscripten"), not(target_os = "ios"), not(target_os = "macos"))))' .dependencies .wgc ]
145147workspace = true
148+ optional = true
146149features = [" vulkan" ]
147150
148151# We want the wgpu-core GLES backend on Unix (but not macOS, iOS).
149152[target .'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))' .dependencies .wgc ]
150153workspace = true
154+ optional = true
151155features = [" gles" ]
152156
153157[dependencies .wgt ]
154158workspace = true
155159
156160# We need wgpu-hal unless we're targeting the web APIs.
157161[target .'cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))' .dependencies ]
158- hal = { workspace = true }
162+ hal = { workspace = true , optional = true }
159163
160164[target .'cfg(all(not(target_arch = "wasm32"), unix, not(target_os = "ios"), not(target_os = "macos")))' .dependencies ]
161- hal = { workspace = true , features = [" renderdoc" ] }
165+ hal = { workspace = true , features = [" renderdoc" ], optional = true }
162166
163167[target .'cfg(windows)' .dependencies ]
164168hal = { workspace = true , features = [
165169 " dxc_shader_compiler" ,
166170 " renderdoc" ,
167171 " windows_rs" ,
168- ] }
169-
170- [target .'cfg(target_arch = "wasm32")' .dependencies .hal ]
171- workspace = true
172- optional = true
172+ ], optional = true }
173173
174174[dependencies ]
175175arrayvec.workspace = true
0 commit comments