Skip to content

Commit

Permalink
Remove getrandom from examples (#7194)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald authored Feb 22, 2025
1 parent a8af685 commit 77763b1
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 10 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ env_logger = "0.11"
fern = "0.7"
flume = "0.11"
futures-lite = "2"
getrandom = "0.2"
glam = "0.29"
hashbrown = { version = "0.14.5", default-features = false, features = [
"ahash",
Expand Down
1 change: 0 additions & 1 deletion examples/features/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ bytemuck.workspace = true
cfg-if.workspace = true
encase = { workspace = true, features = ["glam"] }
flume.workspace = true
getrandom.workspace = true
glam = { workspace = true, features = ["bytemuck"] }
ktx2.workspace = true
log.workspace = true
Expand Down
10 changes: 3 additions & 7 deletions examples/features/src/repeated_compute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
//! hello-compute example does not such as mapping buffers
//! and why use the async channels.
use nanorand::Rng;

const OVERFLOW: u32 = 0xffffffff;

async fn run() {
Expand All @@ -13,7 +15,7 @@ async fn run() {

for _ in 0..10 {
for p in numbers.iter_mut() {
*p = generate_rand() as u32;
*p = nanorand::tls_rng().generate::<u16>() as u32;
}

compute(&mut numbers, &context).await;
Expand All @@ -29,12 +31,6 @@ async fn run() {
}
}

fn generate_rand() -> u16 {
let mut bytes = [0u8; 2];
getrandom::getrandom(&mut bytes[..]).unwrap();
u16::from_le_bytes(bytes)
}

async fn compute(local_buffer: &mut [u32], context: &WgpuContext) {
log::info!("Beginning GPU compute on data {local_buffer:?}.");
// Local buffer contents -> GPU storage buffer
Expand Down

0 comments on commit 77763b1

Please sign in to comment.