webgpu: Enable gles support (#32452)

This commit is contained in:
Hieu Do 2024-06-09 11:35:27 +07:00 committed by GitHub
parent b178a2b6e2
commit 4f5184b6e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 1 deletions

13
Cargo.lock generated
View file

@ -2245,6 +2245,15 @@ dependencies = [
"cc",
]
[[package]]
name = "glutin_wgl_sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8098adac955faa2d31079b65dc48841251f69efd3ac25477903fc424362ead"
dependencies = [
"gl_generator",
]
[[package]]
name = "gobject-sys"
version = "0.19.5"
@ -3187,6 +3196,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76"
dependencies = [
"libc",
"libloading 0.8.3",
"pkg-config",
]
@ -7267,6 +7277,8 @@ dependencies = [
"cfg_aliases",
"core-graphics-types",
"d3d12",
"glow",
"glutin_wgl_sys",
"gpu-alloc",
"gpu-descriptor",
"js-sys",
@ -7276,6 +7288,7 @@ dependencies = [
"log",
"metal 0.28.0",
"naga",
"ndk-sys",
"objc",
"once_cell",
"parking_lot",

View file

@ -62,6 +62,8 @@ pub struct Identities {
dx12_hub: IdentityHub,
#[cfg(any(target_os = "ios", target_os = "macos"))]
metal_hub: IdentityHub,
#[cfg(any(target_os = "linux", target_os = "windows"))]
gl_hub: IdentityHub,
dummy_hub: IdentityHub,
}
@ -74,6 +76,8 @@ impl Identities {
dx12_hub: IdentityHub::new(),
#[cfg(any(target_os = "ios", target_os = "macos"))]
metal_hub: IdentityHub::new(),
#[cfg(any(target_os = "linux", target_os = "windows"))]
gl_hub: IdentityHub::new(),
dummy_hub: IdentityHub::new(),
}
}
@ -86,6 +90,8 @@ impl Identities {
Backend::Dx12 => &mut self.dx12_hub,
#[cfg(any(target_os = "ios", target_os = "macos"))]
Backend::Metal => &mut self.metal_hub,
#[cfg(any(target_os = "linux", target_os = "windows"))]
Backend::Gl => &mut self.gl_hub,
_ => &mut self.dummy_hub,
}
}
@ -98,6 +104,8 @@ impl Identities {
(&mut self.dx12_hub, Backend::Dx12),
#[cfg(any(target_os = "ios", target_os = "macos"))]
(&mut self.metal_hub, Backend::Metal),
#[cfg(any(target_os = "linux", target_os = "windows"))]
(&mut self.gl_hub, Backend::Gl),
(&mut self.dummy_hub, Backend::Empty),
]
}

View file

@ -34,7 +34,7 @@ features = ["metal"]
# We want the wgpu-core Vulkan backend on Linux and Windows.
[target.'cfg(any(windows, all(unix, not(any(target_os = "macos", target_os = "ios")))))'.dependencies.wgpu-core]
workspace = true
features = ["vulkan"]
features = ["gles", "vulkan"]
# We want the wgpu-core Direct3D backends on Windows.
[target.'cfg(windows)'.dependencies.wgpu-core]