mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-23 16:01:04 +01:00
Add angle as gl backend on Windows (#9422)
This commit is contained in:
1 parent
c4e9f3c218
commit
25b4cda524
26 files changed
+336
-76
No files matched your search
@@ -48,6 +48,10 @@ Bottom level categories:
|
||||
|
||||
- Add `BufferBinding::buffer`, a public read accessor for the bound buffer, which was previously inaccessible to out-of-tree `wgpu_hal::Api` implementations. By @danlehmann in [#9820](https://github.com/gfx-rs/wgpu/pull/9820).
|
||||
|
||||
#### GLES
|
||||
|
||||
- Add ANGLE as an opt-in OpenGL backend on Windows via `cfg(windows_angle)`, while keeping the `angle` feature for ANGLE on macOS/iOS. By @csmoe in [#9422](https://github.com/gfx-rs/wgpu/pull/9422).
|
||||
|
||||
### Changes
|
||||
|
||||
#### naga
|
||||
|
||||
Generated
+10
-2
@@ -4720,8 +4720,9 @@ dependencies = [
|
||||
"thiserror 2.0.18",
|
||||
"wgpu-core-deps-apple",
|
||||
"wgpu-core-deps-emscripten",
|
||||
"wgpu-core-deps-linux-android-bsd",
|
||||
"wgpu-core-deps-wasm",
|
||||
"wgpu-core-deps-windows-linux-android",
|
||||
"wgpu-core-deps-windows",
|
||||
"wgpu-hal",
|
||||
"wgpu-naga-bridge",
|
||||
"wgpu-types",
|
||||
@@ -4741,6 +4742,13 @@ dependencies = [
|
||||
"wgpu-hal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-core-deps-linux-android-bsd"
|
||||
version = "30.0.0"
|
||||
dependencies = [
|
||||
"wgpu-hal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-core-deps-wasm"
|
||||
version = "30.0.0"
|
||||
@@ -4749,7 +4757,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wgpu-core-deps-windows-linux-android"
|
||||
name = "wgpu-core-deps-windows"
|
||||
version = "30.0.0"
|
||||
dependencies = [
|
||||
"wgpu-hal",
|
||||
|
||||
+2
-1
@@ -104,7 +104,8 @@ wgpu-types = { version = "30.0.0", path = "./wgpu-types", default-features = fal
|
||||
# are allowed through though.
|
||||
hlsl-snapshots = { path = "naga/hlsl-snapshots" }
|
||||
|
||||
wgpu-core-deps-windows-linux-android = { version = "30.0.0", path = "./wgpu-core/platform-deps/windows-linux-android" }
|
||||
wgpu-core-deps-linux-android-bsd = { version = "30.0.0", path = "./wgpu-core/platform-deps/linux-android-bsd" }
|
||||
wgpu-core-deps-windows = { version = "30.0.0", path = "./wgpu-core/platform-deps/windows" }
|
||||
wgpu-core-deps-apple = { version = "30.0.0", path = "./wgpu-core/platform-deps/apple" }
|
||||
wgpu-core-deps-wasm = { version = "30.0.0", path = "./wgpu-core/platform-deps/wasm" }
|
||||
wgpu-core-deps-emscripten = { version = "30.0.0", path = "./wgpu-core/platform-deps/emscripten" }
|
||||
|
||||
@@ -75,7 +75,7 @@ Contributors are welcome! See [CONTRIBUTING.md][contrib] for more information.
|
||||
|
||||
✅ = First Class Support
|
||||
🆗 = Downlevel/Best Effort Support
|
||||
📐 = Requires the [ANGLE](https://github.com/gfx-rs/wgpu/wiki/Running-on-ANGLE) translation layer (GL ES 3.0 only)
|
||||
📐 = Requires the [ANGLE](https://github.com/gfx-rs/wgpu/wiki/Running-on-ANGLE) translation layer (GL ES 3.0 only). Use the `angle` feature on macOS/iOS. On Windows, `gles` uses WGL by default; build with `cfg(windows_angle)` to use ANGLE instead.
|
||||
🌋 = Requires the [MoltenVK](https://vulkan.lunarg.com/sdk/home#mac) translation layer
|
||||
🛠️ = Unsupported, though open to contributions
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@ let crates = [
|
||||
"wgpu-core/platform-deps/apple",
|
||||
"wgpu-core/platform-deps/emscripten",
|
||||
"wgpu-core/platform-deps/wasm",
|
||||
"wgpu-core/platform-deps/windows-linux-android",
|
||||
"wgpu-core/platform-deps/linux-android-bsd",
|
||||
"wgpu-core/platform-deps/windows",
|
||||
"wgpu-hal",
|
||||
"wgpu-info",
|
||||
"wgpu-naga-bridge",
|
||||
|
||||
+18
-8
@@ -130,28 +130,35 @@ portable-atomic = ["dep:portable-atomic", "wgpu-hal/portable-atomic"]
|
||||
# platform crates collude to provide platform-specific behavior.
|
||||
|
||||
## DX12 backend
|
||||
dx12 = ["wgpu-core-deps-windows-linux-android/dx12"]
|
||||
dx12 = ["wgpu-core-deps-windows/dx12"]
|
||||
## Metal backend
|
||||
metal = ["wgpu-core-deps-apple/metal"]
|
||||
## Vulkan backend, only available on Windows, Linux, Android
|
||||
vulkan = ["wgpu-core-deps-windows-linux-android/vulkan"]
|
||||
vulkan = [
|
||||
"wgpu-core-deps-linux-android-bsd/vulkan",
|
||||
"wgpu-core-deps-windows/vulkan",
|
||||
]
|
||||
## OpenGL backend, only available on Windows, Linux, Android, and Emscripten
|
||||
gles = [
|
||||
"wgpu-core-deps-windows-linux-android/gles",
|
||||
"wgpu-core-deps-linux-android-bsd/gles",
|
||||
"wgpu-core-deps-windows/gles",
|
||||
"wgpu-core-deps-emscripten/gles",
|
||||
]
|
||||
|
||||
## WebGL backend, only available on Emscripten
|
||||
webgl = ["wgpu-core-deps-wasm/webgl", "wgpu-types/web"]
|
||||
## OpenGL backend, on macOS only
|
||||
## OpenGL backend via ANGLE, only available on macOS
|
||||
angle = ["wgpu-core-deps-apple/angle"]
|
||||
## Vulkan portability backend, only available on macOS
|
||||
vulkan-portability = ["wgpu-core-deps-apple/vulkan-portability"]
|
||||
## Renderdoc integration, only available on Windows, Linux, and Android
|
||||
renderdoc = ["wgpu-core-deps-windows-linux-android/renderdoc"]
|
||||
renderdoc = [
|
||||
"wgpu-core-deps-linux-android-bsd/renderdoc",
|
||||
"wgpu-core-deps-windows/renderdoc",
|
||||
]
|
||||
|
||||
## Support creating textures from DRM display/window handles.
|
||||
drm = ["wgpu-core-deps-windows-linux-android/drm"]
|
||||
drm = ["wgpu-core-deps-windows/drm", "wgpu-core-deps-linux-android-bsd/drm"]
|
||||
|
||||
## Enable the `noop` backend.
|
||||
# TODO(https://github.com/gfx-rs/wgpu/issues/7120): there should be a hal feature
|
||||
@@ -169,8 +176,11 @@ wgpu-core-deps-emscripten = { workspace = true, optional = true }
|
||||
[target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies]
|
||||
wgpu-core-deps-wasm = { workspace = true, optional = true }
|
||||
|
||||
[target.'cfg(any(windows, target_os = "linux", target_os = "android", target_os = "freebsd"))'.dependencies]
|
||||
wgpu-core-deps-windows-linux-android = { workspace = true, optional = true }
|
||||
[target.'cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd"))'.dependencies]
|
||||
wgpu-core-deps-linux-android-bsd = { workspace = true, optional = true }
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
wgpu-core-deps-windows = { workspace = true, optional = true }
|
||||
|
||||
[dependencies]
|
||||
naga.workspace = true
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
//! This crate exists to allow platform and feature specific features work correctly. The features
|
||||
//! enabled on this crate are only enabled on `target_vendor = "apple"` platforms. See wgpu-hal's `Cargo.toml`
|
||||
//! for more information.
|
||||
#![doc = include_str!("../README.md")]
|
||||
@@ -1,3 +1 @@
|
||||
//! This crate exists to allow platform and feature specific features work correctly. The features
|
||||
//! enabled on this crate are only enabled on `target_os = "emscripten"` platforms.
|
||||
//! See wgpu-hal's `Cargo.toml` for more information.
|
||||
#![doc = include_str!("../README.md")]
|
||||
@@ -0,0 +1,29 @@
|
||||
[package]
|
||||
name = "wgpu-core-deps-linux-android-bsd"
|
||||
version.workspace = true
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
description = "Feature unification helper crate for the Linux/Android/BSD platforms"
|
||||
homepage.workspace = true
|
||||
repository.workspace = true
|
||||
keywords.workspace = true
|
||||
license.workspace = true
|
||||
readme = "README.md"
|
||||
|
||||
# Override the workspace's `rust-version` key. Firefox uses `cargo vendor` to
|
||||
# copy the crates it actually uses out of the workspace, so it's meaningful for
|
||||
# them to have less restrictive MSRVs individually than the workspace as a
|
||||
# whole, if their code permits. See `../README.md` for details.
|
||||
rust-version = "1.76"
|
||||
|
||||
[features]
|
||||
gles = ["wgpu-hal/gles"]
|
||||
vulkan = ["wgpu-hal/vulkan"]
|
||||
renderdoc = ["wgpu-hal/renderdoc"]
|
||||
|
||||
## Support creating textures from DRM display/window handles.
|
||||
drm = ["wgpu-hal/drm"]
|
||||
|
||||
# Depend on wgpu-hal conditionally, so that the above features only apply to wgpu-hal on this set of platforms.
|
||||
[target.'cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd", target_os = "netbsd"))'.dependencies]
|
||||
wgpu-hal.workspace = true
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,3 @@
|
||||
This crate exists to allow platform and feature specific features work correctly. The features
|
||||
enabled on this crate are only enabled on `target_os = "linux"`, `target_os = "android"` and
|
||||
`target_os = "freebsd"` platforms. See wgpu-hal's `Cargo.toml` for more information.
|
||||
@@ -0,0 +1 @@
|
||||
#![doc = include_str!("../README.md")]
|
||||
@@ -1,3 +1 @@
|
||||
//! This crate exists to allow platform and feature specific features work correctly. The features
|
||||
//! enabled on this crate are only enabled on `target_arch = "wasm32"` platforms. See wgpu-hal's `Cargo.toml`
|
||||
//! for more information.
|
||||
#![doc = include_str!("../README.md")]
|
||||
@@ -1,3 +0,0 @@
|
||||
This crate exists to allow platform and feature specific features work correctly. The features
|
||||
enabled on this crate are only enabled on `windows`, `target_os = "linux"`, and `target_os = "android"`
|
||||
platforms. See wgpu-hal's `Cargo.toml` for more information.
|
||||
@@ -1,3 +0,0 @@
|
||||
//! This crate exists to allow platform and feature specific features work correctly. The features
|
||||
//! enabled on this crate are only enabled on `windows`, `target_os = "linux"`, and `target_os = "android"`
|
||||
//! platforms. See wgpu-hal's `Cargo.toml` for more information.
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "wgpu-core-deps-windows-linux-android"
|
||||
name = "wgpu-core-deps-windows"
|
||||
version.workspace = true
|
||||
authors.workspace = true
|
||||
edition.workspace = true
|
||||
@@ -26,7 +26,7 @@ renderdoc = ["wgpu-hal/renderdoc"]
|
||||
drm = ["wgpu-hal/drm"]
|
||||
|
||||
# Depend on wgpu-hal conditionally, so that the above features only apply to wgpu-hal on this set of platforms.
|
||||
[target.'cfg(any(windows, target_os = "linux", target_os = "android", target_os = "freebsd", target_os = "netbsd"))'.dependencies]
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
wgpu-hal.workspace = true
|
||||
|
||||
[lints]
|
||||
@@ -0,0 +1,176 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 The gfx-rs developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,2 @@
|
||||
This crate exists to allow platform and feature specific features work correctly. The features
|
||||
enabled on this crate are only enabled on `windows` platform. See wgpu-hal's `Cargo.toml` for more information.
|
||||
@@ -0,0 +1 @@
|
||||
#![doc = include_str!("../README.md")]
|
||||
+2
-1
@@ -38,6 +38,7 @@ missing_debug_implementations = "warn"
|
||||
unexpected_cfgs = { level = "warn", check-cfg = [
|
||||
'cfg(feature, values("cargo-clippy"))', # objc's `msg_send` macro injects this in our code https://github.com/SSheldon/rust-objc/issues/125
|
||||
'cfg(web_sys_unstable_apis)', # web-sys uses this
|
||||
'cfg(windows_angle)',
|
||||
] }
|
||||
|
||||
[lib]
|
||||
@@ -58,7 +59,7 @@ unexpected_cfgs = { level = "warn", check-cfg = [
|
||||
# wgpu-core's features are defined to enable the backends on their "default" platforms. For example we
|
||||
# exclude the Vulkan backend on MacOS unless a separate feature `vulkan-portability` is enabled. In response
|
||||
# to these features, it enables features of platform specific crates. For example, the `vulkan` feature in wgpu-core
|
||||
# enables the `vulkan` feature in `wgpu-core-deps-windows-linux-android` which in turn enables the
|
||||
# enables the `vulkan` feature in `wgpu-core-deps-linux-android-bsd` which in turn enables the
|
||||
# `vulkan` feature in `wgpu-hal` _only_ on those platforms. If you enable the `vulkan-portability` feature, it
|
||||
# will enable the `vulkan` feature in `wgpu-core-deps-apple`. The only way to do this is unfortunately to have
|
||||
# a separate crate for each platform category that participates in the feature unification.
|
||||
|
||||
+34
-16
@@ -706,13 +706,6 @@ impl Instance {
|
||||
.expect("Could not lock instance. This is most-likely a deadlock.")
|
||||
.version
|
||||
}
|
||||
|
||||
pub fn egl_config(&self) -> khronos_egl::Config {
|
||||
self.inner
|
||||
.try_lock()
|
||||
.expect("Could not lock instance. This is most-likely a deadlock.")
|
||||
.config
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(send_sync)]
|
||||
@@ -767,6 +760,31 @@ impl crate::Instance for Instance {
|
||||
let egl1_5: Option<&Arc<EglInstance>> = Some(&egl);
|
||||
|
||||
let (display, wsi_kind) = match (desc.display.map(|d| d.as_raw()), egl1_5) {
|
||||
(Some(Rdh::Windows(_)) | None, Some(egl))
|
||||
if cfg!(windows)
|
||||
&& client_ext_str.contains("EGL_ANGLE_platform_angle")
|
||||
&& client_ext_str.contains("EGL_ANGLE_platform_angle_d3d") =>
|
||||
{
|
||||
log::debug!("Using Angle platform with D3D11");
|
||||
const EGL_PLATFORM_ANGLE_TYPE_ANGLE: u32 = 0x3203;
|
||||
const EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE: u32 = 0x3208;
|
||||
let display_attributes = [
|
||||
EGL_PLATFORM_ANGLE_TYPE_ANGLE as khronos_egl::Attrib,
|
||||
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE as khronos_egl::Attrib,
|
||||
EGL_PLATFORM_ANGLE_DEBUG_LAYERS_ENABLED as khronos_egl::Attrib,
|
||||
usize::from(desc.flags.contains(wgt::InstanceFlags::VALIDATION)),
|
||||
khronos_egl::ATTRIB_NONE,
|
||||
];
|
||||
let display = unsafe {
|
||||
egl.get_platform_display(
|
||||
EGL_PLATFORM_ANGLE_ANGLE,
|
||||
khronos_egl::DEFAULT_DISPLAY,
|
||||
&display_attributes,
|
||||
)
|
||||
}
|
||||
.map_err(instance_err("failed to get Angle D3D11 display"))?;
|
||||
(display, WindowKind::Unknown)
|
||||
}
|
||||
(Some(Rdh::Wayland(wayland_display_handle)), Some(egl))
|
||||
if client_ext_str.contains("EGL_EXT_platform_wayland") =>
|
||||
{
|
||||
@@ -1083,7 +1101,7 @@ impl super::Device {
|
||||
#[derive(Debug)]
|
||||
pub struct Swapchain {
|
||||
surface: khronos_egl::Surface,
|
||||
wl_window: Option<*mut wayland_sys::egl::wl_egl_window>,
|
||||
wl_window: Option<*mut ffi::c_void>,
|
||||
framebuffer: glow::Framebuffer,
|
||||
renderbuffer: glow::Renderbuffer,
|
||||
/// Extent because the window lies
|
||||
@@ -1191,10 +1209,7 @@ impl Surface {
|
||||
unsafe fn unconfigure_impl(
|
||||
&self,
|
||||
device: &super::Device,
|
||||
) -> Option<(
|
||||
khronos_egl::Surface,
|
||||
Option<*mut wayland_sys::egl::wl_egl_window>,
|
||||
)> {
|
||||
) -> Option<(khronos_egl::Surface, Option<*mut ffi::c_void>)> {
|
||||
let gl = &device.shared.context.lock();
|
||||
match self.swapchain.write().take() {
|
||||
Some(sc) => {
|
||||
@@ -1226,11 +1241,12 @@ impl crate::Surface for Surface {
|
||||
|
||||
let (surface, wl_window) = match unsafe { self.unconfigure_impl(device) } {
|
||||
Some((sc, wl_window)) => {
|
||||
#[cfg(unix)]
|
||||
if let Some(window) = wl_window {
|
||||
wayland_sys::ffi_dispatch!(
|
||||
wayland_sys::egl::wayland_egl_handle(),
|
||||
wl_egl_window_resize,
|
||||
window,
|
||||
window.cast(),
|
||||
config.extent.width as i32,
|
||||
config.extent.height as i32,
|
||||
0,
|
||||
@@ -1241,6 +1257,7 @@ impl crate::Surface for Surface {
|
||||
(sc, wl_window)
|
||||
}
|
||||
None => {
|
||||
#[cfg_attr(not(unix), expect(unused_mut))]
|
||||
let mut wl_window = None;
|
||||
let (mut temp_xlib_handle, mut temp_xcb_handle);
|
||||
let native_window_ptr = match (self.wsi.kind, self.raw_window_handle) {
|
||||
@@ -1269,7 +1286,7 @@ impl crate::Surface for Surface {
|
||||
config.extent.width as i32,
|
||||
config.extent.height as i32,
|
||||
);
|
||||
wl_window = Some(window);
|
||||
wl_window = Some(window.cast());
|
||||
window.cast()
|
||||
}
|
||||
#[cfg(Emscripten)]
|
||||
@@ -1427,11 +1444,12 @@ impl crate::Surface for Surface {
|
||||
.instance
|
||||
.destroy_surface(self.egl.display, surface)
|
||||
.unwrap();
|
||||
if let Some(window) = wl_window {
|
||||
if let Some(_window) = wl_window {
|
||||
#[cfg(unix)]
|
||||
wayland_sys::ffi_dispatch!(
|
||||
wayland_sys::egl::wayland_egl_handle(),
|
||||
wl_egl_window_destroy,
|
||||
window,
|
||||
_window.cast(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+22
-26
@@ -1,7 +1,9 @@
|
||||
/*!
|
||||
# OpenGL ES3 API (aka GLES3).
|
||||
|
||||
Designed to work on Linux and Android, with context provided by EGL.
|
||||
Designed to work on platforms with context provided by EGL or WGL, including
|
||||
Linux and Android via EGL, and Windows via WGL by default or ANGLE/EGL with
|
||||
`cfg(windows_angle)`.
|
||||
|
||||
## Texture views
|
||||
|
||||
@@ -79,40 +81,34 @@ we don't bother with that combination.
|
||||
|
||||
*/
|
||||
|
||||
///cbindgen:ignore
|
||||
#[cfg(not(any(windows, webgl)))]
|
||||
mod egl;
|
||||
#[cfg(Emscripten)]
|
||||
mod emscripten;
|
||||
#[cfg(webgl)]
|
||||
mod web;
|
||||
#[cfg(windows)]
|
||||
mod wgl;
|
||||
|
||||
mod adapter;
|
||||
mod command;
|
||||
mod conv;
|
||||
mod device;
|
||||
///cbindgen:ignore
|
||||
#[cfg(all(not(webgl), any(not(windows), windows_angle)))]
|
||||
mod egl;
|
||||
#[cfg(all(not(webgl), any(not(windows), windows_angle)))]
|
||||
pub use self::egl::{AdapterContext, AdapterContextLock, Instance, Surface};
|
||||
|
||||
#[cfg(Emscripten)]
|
||||
mod emscripten;
|
||||
|
||||
mod fence;
|
||||
mod queue;
|
||||
|
||||
#[cfg(webgl)]
|
||||
mod web;
|
||||
#[cfg(webgl)]
|
||||
pub use self::web::{AdapterContext, Instance, Surface};
|
||||
|
||||
#[cfg(all(windows, not(webgl), not(windows_angle)))]
|
||||
mod wgl;
|
||||
#[cfg(all(windows, not(webgl), not(windows_angle)))]
|
||||
pub use self::wgl::{AdapterContext, AdapterContextLock, Instance, Surface};
|
||||
|
||||
pub use fence::Fence;
|
||||
|
||||
#[cfg(not(any(windows, webgl)))]
|
||||
pub use self::egl::{AdapterContext, AdapterContextLock};
|
||||
#[cfg(not(any(windows, webgl)))]
|
||||
pub use self::egl::{Instance, Surface};
|
||||
|
||||
#[cfg(webgl)]
|
||||
pub use self::web::AdapterContext;
|
||||
#[cfg(webgl)]
|
||||
pub use self::web::{Instance, Surface};
|
||||
|
||||
#[cfg(windows)]
|
||||
use self::wgl::AdapterContext;
|
||||
#[cfg(windows)]
|
||||
pub use self::wgl::{Instance, Surface};
|
||||
|
||||
use alloc::{boxed::Box, string::String, string::ToString as _, sync::Arc, vec::Vec};
|
||||
use core::{
|
||||
fmt,
|
||||
|
||||
@@ -97,8 +97,8 @@ bitflags::bitflags! {
|
||||
const VULKAN = 1 << Backend::Vulkan as u32;
|
||||
|
||||
/// [`Backend::Gl`].
|
||||
/// Supported on Linux/Android, the web through webassembly via WebGL, and Windows and
|
||||
/// macOS/iOS via ANGLE
|
||||
/// Supported on Linux/Android, the web through webassembly via WebGL, and
|
||||
/// Windows through native OpenGL by default or ANGLE with `cfg(windows_angle)`.
|
||||
const GL = 1 << Backend::Gl as u32;
|
||||
|
||||
/// [`Backend::Metal`].
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ fn main() {
|
||||
// (Note that WebGL is also not included here!)
|
||||
all(any(windows, target_os = "linux", target_os = "android", target_os = "freebsd", Emscripten), feature = "gles"),
|
||||
// On Apple platforms, however, we require the `angle` feature to explicitly opt-in to OpenGL
|
||||
// since its meant to be used with ANGLE.
|
||||
// since it's meant to be used with ANGLE.
|
||||
all(target_vendor = "apple", feature = "angle")
|
||||
) },
|
||||
noop: { feature = "noop" },
|
||||
|
||||
Reference in new issue
Block a user