Remove getrandom from examples (#7194)

This commit is contained in:
Connor Fitzgerald 2025-02-21 22:46:18 -05:00 committed by GitHub
parent a8af685fd5
commit 77763b15b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 3 additions and 10 deletions

1
Cargo.lock generated
View File

@ -4595,7 +4595,6 @@ dependencies = [
"env_logger",
"fern",
"flume",
"getrandom 0.2.15",
"glam",
"ktx2",
"log",

View File

@ -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",

View File

@ -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

View File

@ -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() {
@ -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;
@ -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