Make GLES optional on Windows & macOS (#4185)

This commit is contained in:
Teodor Tanasoaia 2023-10-03 22:16:24 +02:00 committed by GitHub
parent 422c636877
commit fd02a12726
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 17 deletions

View File

@ -85,6 +85,12 @@ depth_ops: Some(wgpu::Operations {
By @wumpf in [#4147](https://github.com/gfx-rs/wgpu/pull/4147) By @wumpf in [#4147](https://github.com/gfx-rs/wgpu/pull/4147)
#### The GLES backend is now optional on Windows & macOS
The `angle` feature flag has to be set for the GLES backend to be enabled on Windows & macOS.
By @teoxoy in [#4185](https://github.com/gfx-rs/wgpu/pull/4185)
### Added/New Features ### Added/New Features

View File

@ -95,8 +95,7 @@ We have a [wiki](https://github.com/gfx-rs/wgpu/wiki) that serves as a knowledge
| Metal | | | :white_check_mark: | | Metal | | | :white_check_mark: |
| DX12 | :white_check_mark: (W10+ only) | | | | DX12 | :white_check_mark: (W10+ only) | | |
| DX11 | :hammer_and_wrench: | | | | DX11 | :hammer_and_wrench: | | |
| GLES3 | | :ok: | | | GLES3 | :ok: (angle) | :ok: | :ok: (angle; macOS only) |
| Angle | :ok: | :ok: | :ok: (macOS only) |
:white_check_mark: = First Class Support — :ok: = Best Effort Support — :hammer_and_wrench: = Unsupported, but support in progress :white_check_mark: = First Class Support — :ok: = Best Effort Support — :hammer_and_wrench: = Unsupported, but support in progress

View File

@ -10,10 +10,6 @@ keywords.workspace = true
license.workspace = true license.workspace = true
publish = false publish = false
[features]
angle = ["wgc/angle"]
vulkan-portability = ["wgc/vulkan"]
[dependencies] [dependencies]
env_logger.workspace = true env_logger.workspace = true
log.workspace = true log.workspace = true

View File

@ -41,7 +41,6 @@ renderdoc = ["hal/renderdoc"]
# Apply run-time checks, even in release builds. These are in addition # Apply run-time checks, even in release builds. These are in addition
# to the validation carried out at public APIs in all builds. # to the validation carried out at public APIs in all builds.
strict_asserts = ["wgt/strict_asserts"] strict_asserts = ["wgt/strict_asserts"]
angle = ["hal/gles"]
# Enable API tracing # Enable API tracing
trace = ["ron", "serde", "wgt/trace", "arrayvec/serde", "naga/serialize"] trace = ["ron", "serde", "wgt/trace", "arrayvec/serde", "naga/serialize"]
# Enable API replaying # Enable API replaying

View File

@ -34,30 +34,29 @@ glsl = ["naga/glsl-in"]
wgsl = ["wgc?/wgsl"] wgsl = ["wgc?/wgsl"]
trace = ["serde", "wgc/trace"] trace = ["serde", "wgc/trace"]
replay = ["serde", "wgc/replay"] replay = ["serde", "wgc/replay"]
angle = ["wgc/angle"] # Enables the GLES backend on Windows & macOS
webgl = ["hal", "wgc"] angle = ["wgc/gles"]
webgl = ["hal", "wgc/gles"]
# Enables the Vulkan backend on macOS & iOS
vulkan-portability = ["wgc/vulkan"] vulkan-portability = ["wgc/vulkan"]
expose-ids = [] expose-ids = []
# Implement `Send` and `Sync` on Wasm. # Implement `Send` and `Sync` on Wasm.
fragile-send-sync-non-atomic-wasm = ["hal/fragile-send-sync-non-atomic-wasm", "wgc/fragile-send-sync-non-atomic-wasm", "wgt/fragile-send-sync-non-atomic-wasm"] fragile-send-sync-non-atomic-wasm = ["hal/fragile-send-sync-non-atomic-wasm", "wgc/fragile-send-sync-non-atomic-wasm", "wgt/fragile-send-sync-non-atomic-wasm"]
# wgpu-core is always available as an optional dependency, "wgc". # wgpu-core is always available as an optional dependency, "wgc".
# Whenever wgpu-core is selected, we want the GLES backend and raw # Whenever wgpu-core is selected, we want raw window handle support.
# window handle support.
[dependencies.wgc] [dependencies.wgc]
optional = true optional = true
workspace = true workspace = true
features = ["raw-window-handle", "gles"] features = ["raw-window-handle"]
# wgpu-core is required whenever not targeting web APIs directly. # wgpu-core is required whenever not targeting web APIs directly.
# Whenever wgpu-core is selected, we want the GLES backend and raw # Whenever wgpu-core is selected, we want raw window handle support.
# window handle support.
[target.'cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))'.dependencies.wgc] [target.'cfg(any(not(target_arch = "wasm32"), target_os = "emscripten"))'.dependencies.wgc]
workspace = true workspace = true
features = ["raw-window-handle", "gles"] features = ["raw-window-handle"]
# We want the wgpu-core Metal backend on macOS and iOS. # We want the wgpu-core Metal backend on macOS and iOS.
# (We should consider also enabling "vulkan" for Vulkan Portability.)
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgc] [target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies.wgc]
workspace = true workspace = true
features = ["metal"] features = ["metal"]
@ -67,11 +66,16 @@ features = ["metal"]
workspace = true workspace = true
features = ["dx11", "dx12"] features = ["dx11", "dx12"]
# We want the wgpu-core Vulkan backend on Unix (but not Emscripten) and Windows. # 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] [target.'cfg(any(windows, all(unix, not(target_os = "emscripten"), not(target_os = "ios"), not(target_os = "macos"))))'.dependencies.wgc]
workspace = true workspace = true
features = ["vulkan"] 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"]
[dependencies.wgt] [dependencies.wgt]
workspace = true workspace = true