Skip to content

Commit 11eae1d

Browse files
committed
No longer require the workaround for the collatz example
1 parent 902c51c commit 11eae1d

File tree

2 files changed

+2
-11
lines changed
  • examples

2 files changed

+2
-11
lines changed

examples/runners/wgpu/builder/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ fn main() -> Result<(), Box<dyn Error>> {
3131
// We need the int8 capability for using `Option`
3232
build_shader(
3333
"../../../shaders/compute-shader",
34-
false,
35-
&[Capability::Int8],
34+
false
3635
)?;
3736
build_shader("../../../shaders/mouse-shader", false, &[])?;
3837
Ok(())

examples/shaders/compute-shader/src/lib.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,5 @@ pub fn main_cs(
4444
#[spirv(storage_buffer, descriptor_set = 0, binding = 0)] prime_indices: &mut [u32],
4545
) {
4646
let index = id.x as usize;
47-
prime_indices[index] = unwrap_or_max(collatz(prime_indices[index]));
48-
}
49-
50-
// Work around https://github.com/EmbarkStudios/rust-gpu/issues/677
51-
fn unwrap_or_max(option: Option<u32>) -> u32 {
52-
match option {
53-
Some(inner) => inner,
54-
None => u32::MAX,
55-
}
47+
prime_indices[index] = collatz(prime_indices[index]).unwrap_or(u32::MAX);
5648
}

0 commit comments

Comments
 (0)