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]
|
[alias]
|
||||||
xtask = "run -p wgpu-xtask --"
|
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: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
export RUSTFLAGS="$RUSTFLAGS --cfg getrandom_backend=\"wasm_js\""
|
||||||
|
|
||||||
# build for WebGPU
|
# 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,fragile-send-sync-non-atomic-wasm
|
||||||
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --features glsl,spirv
|
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} --tests --features glsl,spirv
|
||||||
@ -487,6 +489,9 @@ jobs:
|
|||||||
- name: Execute tests
|
- name: Execute tests
|
||||||
run: |
|
run: |
|
||||||
cd wgpu
|
cd wgpu
|
||||||
|
|
||||||
|
export RUSTFLAGS="$RUSTFLAGS --cfg getrandom_backend=\"wasm_js\""
|
||||||
|
|
||||||
wasm-pack test --headless --chrome --no-default-features --features wgsl,webgl,web --workspace
|
wasm-pack test --headless --chrome --no-default-features --features wgsl,webgl,web --workspace
|
||||||
|
|
||||||
gpu-test:
|
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"
|
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
"js-sys",
|
||||||
"libc",
|
"libc",
|
||||||
"r-efi",
|
"r-efi",
|
||||||
"wasi 0.14.2+wasi-0.2.4",
|
"wasi 0.14.2+wasi-0.2.4",
|
||||||
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2581,6 +2583,9 @@ name = "nanorand"
|
|||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6e3d189da485332e96ba8a5ef646a311871abd7915bf06ac848a9117f19cf6e4"
|
checksum = "6e3d189da485332e96ba8a5ef646a311871abd7915bf06ac848a9117f19cf6e4"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom 0.3.3",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nanoserde"
|
name = "nanoserde"
|
||||||
@ -5044,6 +5049,7 @@ dependencies = [
|
|||||||
"env_logger",
|
"env_logger",
|
||||||
"fern",
|
"fern",
|
||||||
"flume",
|
"flume",
|
||||||
|
"getrandom 0.3.3",
|
||||||
"glam",
|
"glam",
|
||||||
"ktx2",
|
"ktx2",
|
||||||
"log",
|
"log",
|
||||||
|
|||||||
@ -116,6 +116,7 @@ env_logger = { version = "0.11", default-features = false }
|
|||||||
fern = "0.7"
|
fern = "0.7"
|
||||||
flume = "0.11"
|
flume = "0.11"
|
||||||
futures-lite = "2"
|
futures-lite = "2"
|
||||||
|
getrandom = "0.3"
|
||||||
glam = "0.30"
|
glam = "0.30"
|
||||||
glob = "0.3"
|
glob = "0.3"
|
||||||
half = { version = "2.5", default-features = false } # We require 2.5 to have `Arbitrary` support.
|
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
|
cfg-if.workspace = true
|
||||||
encase = { workspace = true, features = ["glam"] }
|
encase = { workspace = true, features = ["glam"] }
|
||||||
flume.workspace = true
|
flume.workspace = true
|
||||||
|
getrandom = { workspace = true, features = ["wasm_js"] }
|
||||||
glam = { workspace = true, features = ["bytemuck"] }
|
glam = { workspace = true, features = ["bytemuck"] }
|
||||||
ktx2.workspace = true
|
ktx2.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
nanorand = { workspace = true, features = ["tls"] }
|
nanorand = { workspace = true, features = ["getrandom"] }
|
||||||
noise.workspace = true
|
noise.workspace = true
|
||||||
obj.workspace = true
|
obj.workspace = true
|
||||||
png.workspace = true
|
png.workspace = true
|
||||||
|
|||||||
@ -13,9 +13,11 @@ async fn run() {
|
|||||||
let mut numbers = [0u32; 256];
|
let mut numbers = [0u32; 256];
|
||||||
let context = WgpuContext::new(size_of_val(&numbers)).await;
|
let context = WgpuContext::new(size_of_val(&numbers)).await;
|
||||||
|
|
||||||
|
let mut rand = nanorand::WyRand::new();
|
||||||
|
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
for p in numbers.iter_mut() {
|
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;
|
compute(&mut numbers, &context).await;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user