-
Notifications
You must be signed in to change notification settings - Fork 970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a default feature for wgpu that enables Vulkan & GLES on Windows & Linux #3514
Comments
I was recently looking into this but the first roadblock I hit is that we can't differentiate between a new A solution could be to introduce target-specific features in I'd be happy to make a PR! |
I think we're moving in the direction of every backend being feature flagged. We have all the infrastructure in place, we just haven't lifted this to the wgpu level. Distinguishing between angle and native would be useful! |
So after playing around with it a bit I was so unsatisfied it doesn't make sense to me to proceed like that. Introducing So the only good solution I can come up with to this problem is to create a separate crate that adds these defaults. [package]
name = "wgpu-default-features"
# We want the wgpu-core Metal backend on macOS and iOS.
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgc]
workspace = true
features = ["metal"]
# We want the wgpu-core Direct3D backends and OpenGL (via WGL) on Windows.
[target.'cfg(windows)'.dependencies.wgc]
workspace = true
features = ["dx11", "dx12", "gles"]
# We want the wgpu-core Vulkan backend on Unix (but not emscripten, macOS, iOS) and Windows.
[target.'cfg(any(windows, all(unix, not(target_os = "emscripten"), not(target_os = "ios"), not(target_os = "macos"))))'.dependencies.wgc]
workspace = true
features = ["vulkan"]
# We want the wgpu-core GLES backend on Unix (but not macOS, iOS).
[target.'cfg(all(unix, not(target_os = "ios"), not(target_os = "macos")))'.dependencies.wgc]
workspace = true
features = ["gles"] And then we can use Just for completeness, not actually proposing this: we could abandon default features. |
Cc rust-lang/cargo#1197. |
cont' conversation thread from #4815 (comment) It's pretty awful, but it might be better than the alternative to just hand this problem on to wgc in turn? I.e. |
We would have to go further into hal though, because in wgc we are having the exact same problem:
Both |
Why is it an issue that the dependencies will be present on the dev machine? They won't be compiled for the targets that don't support them.
What does "active" mean in this context? |
Dead code elimination is not perfect, especially with things that rely on FFI and linked libraries, I don't have any data on that though. But it also does increase compile time, which is not insignificant when looking at the size and amount of dependencies we are talking about here.
I should probably stick with the word "enable". |
We currently only enable backends based on the target platform with the only exception being GLES which is always available.
We should expose a new feature flag (enabled by default) that covers the GLES and DX11 backends so that users not interested in those backends can avoid compiling them in their binaries.
Feature name ideas:
legacy
compat
(mapping to a future WebGPU Compat; might not be the best choice since we support even lower limits/features than what WebGPU Compat is aiming for; i.e. GLES 3.1+ and DX11 FL10+)See background for this: #1221 (comment)
The text was updated successfully, but these errors were encountered: