sgpu-compute 0.1.0

Simple GPU-Compute using WebGPU
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use sgpu_compute::prelude::*;

fn main() {
    let gpu = GpuCompute::new();
    let mut pipeline = gpu.gen_pipeline(
        None,
        [StageDesc {
            name: Some("norm"),
            shader: include_str!("normal_distribution.wgsl"),
            entrypoint: "main",
        }],
    );
    let input: [f32; 100] = std::array::from_fn(|i| i as f32 / 100.0);
    pipeline.write_uniform(&32768);
    let result: [f32; 100] = pipeline.run(&input, [(10, 1, 1)], |vals| *vals);
    println!("{:?}", result);
}