mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Remove getrandom from examples (#7194)
This commit is contained in:
parent
a8af685fd5
commit
77763b15b3
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -4595,7 +4595,6 @@ dependencies = [
|
|||||||
"env_logger",
|
"env_logger",
|
||||||
"fern",
|
"fern",
|
||||||
"flume",
|
"flume",
|
||||||
"getrandom 0.2.15",
|
|
||||||
"glam",
|
"glam",
|
||||||
"ktx2",
|
"ktx2",
|
||||||
"log",
|
"log",
|
||||||
|
|||||||
@ -98,7 +98,6 @@ env_logger = "0.11"
|
|||||||
fern = "0.7"
|
fern = "0.7"
|
||||||
flume = "0.11"
|
flume = "0.11"
|
||||||
futures-lite = "2"
|
futures-lite = "2"
|
||||||
getrandom = "0.2"
|
|
||||||
glam = "0.29"
|
glam = "0.29"
|
||||||
hashbrown = { version = "0.14.5", default-features = false, features = [
|
hashbrown = { version = "0.14.5", default-features = false, features = [
|
||||||
"ahash",
|
"ahash",
|
||||||
|
|||||||
@ -35,7 +35,6 @@ 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
|
|
||||||
glam = { workspace = true, features = ["bytemuck"] }
|
glam = { workspace = true, features = ["bytemuck"] }
|
||||||
ktx2.workspace = true
|
ktx2.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
|
|||||||
@ -5,6 +5,8 @@
|
|||||||
//! hello-compute example does not such as mapping buffers
|
//! hello-compute example does not such as mapping buffers
|
||||||
//! and why use the async channels.
|
//! and why use the async channels.
|
||||||
|
|
||||||
|
use nanorand::Rng;
|
||||||
|
|
||||||
const OVERFLOW: u32 = 0xffffffff;
|
const OVERFLOW: u32 = 0xffffffff;
|
||||||
|
|
||||||
async fn run() {
|
async fn run() {
|
||||||
@ -13,7 +15,7 @@ async fn run() {
|
|||||||
|
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
for p in numbers.iter_mut() {
|
for p in numbers.iter_mut() {
|
||||||
*p = generate_rand() as u32;
|
*p = nanorand::tls_rng().generate::<u16>() as u32;
|
||||||
}
|
}
|
||||||
|
|
||||||
compute(&mut numbers, &context).await;
|
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) {
|
async fn compute(local_buffer: &mut [u32], context: &WgpuContext) {
|
||||||
log::info!("Beginning GPU compute on data {local_buffer:?}.");
|
log::info!("Beginning GPU compute on data {local_buffer:?}.");
|
||||||
// Local buffer contents -> GPU storage buffer
|
// Local buffer contents -> GPU storage buffer
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user