Skip to content

Commit 4e58833

Browse files
nickbabcockkpreid
authored andcommitted
Add wasm64 backend support for the web
This commit: - Bumps glow to 0.18 which gains support for wasm64 - Updates cfg gates from `target_arch = "wasm32"` to `target_family = "wasm"` This commit, unfortunately, does not touch upon example code as that brings in getrandom 0.3 (0.4 supports wasm64) through flume and futures-lite
1 parent bfdd45b commit 4e58833

20 files changed

Lines changed: 73 additions & 52 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,13 @@ jobs:
188188
tier: 2
189189
kind: web
190190

191+
- name: WebAssembly 64-bit
192+
os: ubuntu-24.04
193+
target: wasm64-unknown-unknown
194+
kind: wgpu-only
195+
tier: 3
196+
extra-flags: -Zbuild-std=std,panic_abort
197+
191198
- name: Emscripten
192199
os: ubuntu-24.04
193200
target: wasm32-unknown-emscripten

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ Bottom level categories:
4444

4545
### Added/New Features
4646

47+
#### General
48+
49+
- Support the `wasm64-unknown-unknown` target for the web backend. Building for wasm64 requires a nightly toolchain with `-Z build-std=std,panic_abort`. By @nickbabcock in [#9836](https://github.com/gfx-rs/wgpu/pull/9836).
50+
4751
#### Hal
4852

4953
- 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).
@@ -82,6 +86,16 @@ Bottom level categories:
8286

8387
- Fixed signed integer `%` (and `%=`) returning the wrong result for negative operands in the GLSL (OpenGL/GLES) backend, e.g. `-1 % 768` yielding `255` instead of `-1`. GLSL's `%` is undefined when either operand is negative, so signed remainder is now lowered as `a - b * (a / b)`, matching the SPIR-V, HLSL, and Metal backends. By @mstampfli in [#9687](https://github.com/gfx-rs/wgpu/pull/9687).
8488

89+
### Dependency Updates
90+
91+
#### General
92+
93+
- Raise the minimum version of the `wasm-bindgen` family to the earliest releases that support wasm64. By @nickbabcock in [#9836](https://github.com/gfx-rs/wgpu/pull/9836).
94+
95+
#### GLES
96+
97+
- Update `glow` to 0.18 for wasm64 support. By @nickbabcock in [#9836](https://github.com/gfx-rs/wgpu/pull/9836).
98+
8599
## v30.0.0 (2026-07-01)
86100

87101
### Major changes

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -294,21 +294,21 @@ gpu-allocator = { version = "0.28", default-features = false, features = [
294294

295295
# Gles dependencies
296296
khronos-egl = "6"
297-
glow = "0.17"
297+
glow = "0.18"
298298
glutin = { version = "0.32", default-features = false }
299299
glutin-winit = { version = "0.5", default-features = false }
300300
glutin_wgl_sys = "0.6"
301301

302302
# DX12 and GLES dependencies
303303
windows = { version = "0.62", default-features = false }
304304

305-
# wasm32 dependencies
305+
# wasm dependencies
306306
console_error_panic_hook = "0.1.5"
307307
console_log = "1"
308-
js-sys = { version = "0.3.85", default-features = false }
309-
wasm-bindgen = { version = "0.2.108", default-features = false }
310-
wasm-bindgen-futures = { version = "0.4.58", default-features = false }
311-
web-sys = { version = "0.3.85", default-features = false }
308+
js-sys = { version = "0.3.100", default-features = false }
309+
wasm-bindgen = { version = "0.2.123", default-features = false }
310+
wasm-bindgen-futures = { version = "0.4.73", default-features = false }
311+
web-sys = { version = "0.3.100", default-features = false }
312312
web-time = "1.1.0"
313313

314314
# deno dependencies

examples/standalone/03_hdr_surface/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ block2 = "0.6.2"
2424

2525
[target.'cfg(target_arch = "wasm32")'.dependencies]
2626
console_error_panic_hook = "0.1.5"
27-
wasm-bindgen = "0.2.108"
28-
wasm-bindgen-futures = "0.4.58"
29-
web-sys = { version = "0.3.85", features = [
27+
wasm-bindgen = "0.2.123"
28+
wasm-bindgen-futures = "0.4.73"
29+
web-sys = { version = "0.3.100", features = [
3030
"console",
3131
"Document",
3232
"Element",

wgpu-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ wgpu-core-deps-apple = { workspace = true, optional = true }
172172
[target.'cfg(target_os = "emscripten")'.dependencies]
173173
wgpu-core-deps-emscripten = { workspace = true, optional = true }
174174

175-
[target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies]
175+
[target.'cfg(all(target_family = "wasm", not(target_os = "emscripten")))'.dependencies]
176176
wgpu-core-deps-wasm = { workspace = true, optional = true }
177177

178178
[target.'cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd"))'.dependencies]

wgpu-core/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ fn main() {
44
send_sync: { all(
55
feature = "std",
66
any(
7-
not(target_arch = "wasm32"),
7+
not(target_family = "wasm"),
88
all(feature = "fragile-send-sync-non-atomic-wasm", not(target_feature = "atomics"))
99
)
1010
) },
1111
dx12: { all(target_os = "windows", feature = "dx12") },
12-
webgl: { all(target_arch = "wasm32", not(target_os = "emscripten"), feature = "webgl") },
12+
webgl: { all(target_family = "wasm", not(target_os = "emscripten"), feature = "webgl") },
1313
gles: { any(
1414
all(windows_linux_android, feature = "gles"), // Regular GLES
1515
all(webgl), // WebGL

wgpu-core/platform-deps/wasm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ rust-version = "1.76"
1919
webgl = ["wgpu-hal/gles"]
2020

2121
# Depend on wgpu-hal conditionally, so that the above features only apply to wgpu-hal on this set of platforms.
22-
[target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies]
22+
[target.'cfg(all(target_family = "wasm", not(target_os = "emscripten")))'.dependencies]
2323
wgpu-hal.workspace = true
2424

2525
[lints]

wgpu-core/src/device/resource.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5938,7 +5938,7 @@ impl Device {
59385938
Ok(wgt::PollStatus::Poll) => {
59395939
unreachable!("Cannot get a Poll result from a Wait action.")
59405940
}
5941-
Err(WaitIdleError::Timeout) if cfg!(target_arch = "wasm32") => {
5941+
Err(WaitIdleError::Timeout) if cfg!(target_family = "wasm") => {
59425942
// On wasm, you cannot actually successfully wait for the surface.
59435943
// However WebGL does not actually require you do this, so ignoring
59445944
// the failure is totally fine. See

wgpu-core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// When we have no backends, we end up with a lot of dead or otherwise unreachable code.
1313
#![cfg_attr(
1414
all(
15-
not(all(feature = "vulkan", not(target_arch = "wasm32"))),
15+
not(all(feature = "vulkan", not(target_family = "wasm"))),
1616
not(all(feature = "metal", any(target_vendor = "apple"))),
1717
not(all(feature = "dx12", windows)),
1818
not(feature = "gles"),

0 commit comments

Comments
 (0)