mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Properly enable getrandom in nanorand (#8098)
This commit is contained in:
parent
17a17f716a
commit
fe86710af7
@ -1,2 +1,6 @@
|
||||
[alias]
|
||||
xtask = "run -p wgpu-xtask --"
|
||||
|
||||
# Needed until https://github.com/rust-random/getrandom/issues/675 is resolved.
|
||||
[target.wasm32-unknown-unknown]
|
||||
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]
|
||||
|
||||
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@ -261,6 +261,8 @@ jobs:
|
||||
run: |
|
||||
set -e
|
||||
|
||||
export RUSTFLAGS="$RUSTFLAGS --cfg getrandom_backend=\"wasm_js\""
|
||||
|
||||
# build for WebGPU
|
||||
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --features glsl,spirv,fragile-send-sync-non-atomic-wasm
|
||||
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --features glsl,spirv
|
||||
@ -487,6 +489,9 @@ jobs:
|
||||
- name: Execute tests
|
||||
run: |
|
||||
cd wgpu
|
||||
|
||||
export RUSTFLAGS="$RUSTFLAGS --cfg getrandom_backend=\"wasm_js\""
|
||||
|
||||
wasm-pack test --headless --chrome --no-default-features --features wgsl,webgl,web --workspace
|
||||
|
||||
gpu-test:
|
||||
|
||||
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -1724,9 +1724,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"r-efi",
|
||||
"wasi 0.14.2+wasi-0.2.4",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2581,6 +2583,9 @@ name = "nanorand"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e3d189da485332e96ba8a5ef646a311871abd7915bf06ac848a9117f19cf6e4"
|
||||
dependencies = [
|
||||
"getrandom 0.3.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nanoserde"
|
||||
@ -5044,6 +5049,7 @@ dependencies = [
|
||||
"env_logger",
|
||||
"fern",
|
||||
"flume",
|
||||
"getrandom 0.3.3",
|
||||
"glam",
|
||||
"ktx2",
|
||||
"log",
|
||||
|
||||
@ -116,6 +116,7 @@ env_logger = { version = "0.11", default-features = false }
|
||||
fern = "0.7"
|
||||
flume = "0.11"
|
||||
futures-lite = "2"
|
||||
getrandom = "0.3"
|
||||
glam = "0.30"
|
||||
glob = "0.3"
|
||||
half = { version = "2.5", default-features = false } # We require 2.5 to have `Arbitrary` support.
|
||||
|
||||
@ -35,10 +35,11 @@ bytemuck.workspace = true
|
||||
cfg-if.workspace = true
|
||||
encase = { workspace = true, features = ["glam"] }
|
||||
flume.workspace = true
|
||||
getrandom = { workspace = true, features = ["wasm_js"] }
|
||||
glam = { workspace = true, features = ["bytemuck"] }
|
||||
ktx2.workspace = true
|
||||
log.workspace = true
|
||||
nanorand = { workspace = true, features = ["tls"] }
|
||||
nanorand = { workspace = true, features = ["getrandom"] }
|
||||
noise.workspace = true
|
||||
obj.workspace = true
|
||||
png.workspace = true
|
||||
|
||||
@ -13,9 +13,11 @@ async fn run() {
|
||||
let mut numbers = [0u32; 256];
|
||||
let context = WgpuContext::new(size_of_val(&numbers)).await;
|
||||
|
||||
let mut rand = nanorand::WyRand::new();
|
||||
|
||||
for _ in 0..10 {
|
||||
for p in numbers.iter_mut() {
|
||||
*p = nanorand::tls_rng().generate::<u16>() as u32;
|
||||
*p = rand.generate::<u16>() as u32;
|
||||
}
|
||||
|
||||
compute(&mut numbers, &context).await;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user