gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.13k stars 881 forks source link

Cannot build wgpu-core for PowerPC 32-bit (`AtomicU64` does not exist in 32-bit PPC) #5997

Open wyatt8740 opened 1 month ago

wyatt8740 commented 1 month ago

Description Currently wgpu-core/src/device/resource.rs uses AtomicU64. This prevents successful compilation and use of Ruffle on it. I wanted to make sure this is known and see if there was some simple workaround for it so I can use it on PowerPC 32-bit and MIPS.

Repro steps I tried to build ruffle with cargo build --target=powerpc-unknown-linux-gnu

Expected vs observed behavior

error[E0432]: unresolved import `std::sync::atomic::AtomicU64`
  --> /path/to/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-core
56 |         atomic::{AtomicBool, AtomicU64, Ordering},
   |                              ^^^^^^^^^
   |                              |
   |                              no `AtomicU64` in `sync::atomic`

This is not the sole blocker for building ruffle, but it is the first I come across (the second is ring).

Platform Build host is amd64 debian Linux, i5-3470 with 16GB RAM, not that I think it matters for this. I am not using debian's rust packages; I am using the generic ones from https://sh.rustup.rs .

Wumpf commented 1 month ago

I don't think anyone looked into getting wgpu to run on any target that doesn't have 64bit atomic support. But if someone were able to pull it off without drastic changes to the codebase + set up a ci job that ensures this doesn't rot, I don't see why we shouldn't have this support :)

Quick grep on AtomicU64 only shows up the submission index and that could be encapsulated to fall back to 32bit if necessary. Big question though if that's the only thing that would blocking running on powerpc.

cwfitzgerald commented 1 month ago

Note atomic submission index is going away soon-ish as it doesn't help us, it's just going to be a u64 behind a mutex

jimblandy commented 1 month ago

Note atomic submission index is going away soon-ish as it doesn't help us, it's just going to be a u64 behind a mutex

This is #5978.