wgpu: use wgpu-sync for atomics

This commit is contained in:
Zac Harrold authored and Connor Fitzgerald committed 2026-08-28 20:37:31 -04:00
1 parent 1098476cd0
commit 52889ac2c4
5 files changed
+7 -15

No files matched your search

Generated
-1
View File
@@ -4722,7 +4722,6 @@ dependencies = [
"js-sys",
"log",
"naga",
"portable-atomic",
"profiling",
"raw-window-handle",
"smallvec",
+4 -7
View File
@@ -198,7 +198,7 @@ exhaust = ["wgpu-types/exhaust"]
[dependencies]
naga = { workspace = true, optional = true, features = ["termcolor"] }
wgpu-sync = { workspace = true, default-features = false }
wgpu-sync = { workspace = true, default-features = false, features = ["portable-atomic"] }
wgpu-types.workspace = true
# Needed for both wgpu-core and webgpu
@@ -227,7 +227,7 @@ wgpu-core = { workspace = true, default-features = true, features = [
"wgsl", # needed for indirect draw/dispatch validation
"portable-atomic",
] }
wgpu-hal = { workspace = true, default-features = true }
wgpu-hal = { workspace = true, default-features = true, features = ["portable-atomic"] }
smallvec.workspace = true
@@ -245,7 +245,7 @@ web-sys = { workspace = true, optional = true, features = [
# Needed for only wgpu-core backend. Optional as webgl is optional on WebAssembly.
wgpu-core = { workspace = true, optional = true, default-features = true }
wgpu-hal = { workspace = true, optional = true, default-features = true }
wgpu-hal = { workspace = true, optional = true, default-features = true, features = ["portable-atomic"] }
smallvec = { workspace = true, optional = true }
@@ -257,13 +257,10 @@ wasm-bindgen-futures = { workspace = true, optional = true }
##############
[target.'cfg(target_os = "emscripten")'.dependencies]
wgpu-core = { workspace = true, default-features = true }
wgpu-hal = { workspace = true, default-features = true }
wgpu-hal = { workspace = true, default-features = true, features = ["portable-atomic"] }
smallvec.workspace = true
[target.'cfg(not(target_has_atomic = "64"))'.dependencies]
portable-atomic.workspace = true
[dev-dependencies]
# Used in doc-tests
bytemuck.workspace = true
-1
View File
@@ -50,7 +50,6 @@ fn main() {
naga: { any(feature = "naga-ir", feature = "spirv", feature = "glsl") },
// ⚠️ Keep in sync with target.cfg() definition in wgpu-hal/Cargo.toml and cfg_alias in `wgpu-hal` crate ⚠️
static_dxc: { all(target_os = "windows", feature = "static-dxc", not(target_arch = "aarch64"), target_env = "msvc") },
supports_64bit_atomics: { target_has_atomic = "64" },
custom: {any(feature = "custom")},
std: { any(
feature = "std",
+1 -1
View File
@@ -20,9 +20,9 @@ use core::{
future::Future,
ops::Range,
pin::Pin,
sync::atomic::{AtomicU8, Ordering},
task::{self, Poll},
};
use wgpu_sync::atomic::{AtomicU8, Ordering};
use wgt::Backends;
use js_sys::Promise;
+2 -5
View File
@@ -4,12 +4,9 @@
//!
//! For types (like WebGPU) that don't have such a property, we generate an identifier and use that.
#[cfg(supports_64bit_atomics)]
pub use core::sync::atomic::AtomicU64;
#[cfg(not(supports_64bit_atomics))]
pub use portable_atomic::AtomicU64;
pub use wgpu_sync::atomic::{AtomicU64, Ordering};
use core::{num::NonZeroU64, sync::atomic::Ordering};
use core::num::NonZeroU64;
static NEXT_ID: AtomicU64 = AtomicU64::new(1);