Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Connections
Description
Adds
no_std
support towgpu-core
through 3 changes:num-traits
withintimestamp_normalization
to account for the floating point methods only available withstd
.parking_lot
optional by falling back to eitherstd::sync::{Mutex, RwLock}
,spin::{Mutex, RwLock}
, orcore::cell::RefCell
based on selecting eitherparking_lot
,std
,spin
, or no locking implementation.a. Note that
spin
was already in the lockfile viacrossbeam-deque
so this feature is "free"b. Note that
RefCell
is!Sync
, so users should selectspin
inno_std
environments. The use ofRefCell
as a fallback just allows compilation to succeed without any features enabled.once_cell
optional by falling back tocore::cell:OnceCell
.a. Note that
once_cell
isno_std
compatible, but it requires activating thecritical-section
feature to access its implementation ofOnceCell
. Adding such a feature would therefore addcritical-section
to the lockfile, requiring thorough review due to its use ofunsafe
andextern "Rust"
. I believe it is a safe inclusion, but it can be avoided here so I'd rather save that quality of life feature for a follow-up. Users are still able to useonce_cell
withwgpu-core
onno_std
, they just have to enableonce_cell/critical-section
themselves.b. Note that
core::cell::OnceCell
is!Sync
, so users should prefer to enablecritical-section
themselves.To preserve existing behavior, the newly added
parking_lot
andonce_cell
features are enabled by default.Testing
Added
wgpu-core
to thewasm32v1-none
CI test.Squash or Rebase?
Squash
Checklist
cargo fmt
.taplo format
.cargo clippy --tests
. If applicable, add:--target wasm32-unknown-unknown
cargo xtask test
to run tests.CHANGELOG.md
entry.