wgpu/examples/src/hello_compute
Erich Gubler 765c20235e
refactor: use include_wgsl!(…) more (#6326)
This change uses `include_wgsl!(…)` in usages where an
`include_str!("….wgsl")` was used to construct
a `ShaderModuleDescriptor`'s `source, but the `label` was set to `None`.
This should (1) showcase a nice idiomatic convenience we offer in our
examples better, (2) make code more concise, and (3) get some
automatically generated labels in diagnostics where it seems it won't
hurt.
2024-09-26 08:47:57 +02:00
..
mod.rs refactor: use include_wgsl!(…) more (#6326) 2024-09-26 08:47:57 +02:00
README.md Update examples readme files (#4774) 2023-11-25 22:59:40 +00:00
shader.wgsl Move to A Single Example Executable (#4756) 2023-11-23 05:26:42 -05:00
tests.rs Join threads in MULTITHREADED_COMPUTE example. (#5129) 2024-01-23 22:18:21 -05:00

hello-compute

Runs a compute shader to determine the number of iterations of the rules from Collatz Conjecture

  • If n is even, n = n/2
  • If n is odd, n = 3n+1

that it will take to finish and reach the number 1.

To Run

# Pass in any 4 numbers as arguments
RUST_LOG=hello_compute cargo run --bin wgpu-examples hello_compute 1 4 3 295

Example Output

[2020-04-25T11:15:33Z INFO  hello_compute] Steps: [0, 2, 7, 55]