Skip to content

Commit

Permalink
📎
Browse files Browse the repository at this point in the history
  • Loading branch information
DJMcNab committed May 9, 2024
1 parent 3daf8eb commit 130cb0a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/tests/pipeline_cache.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::num::NonZeroU64;
use std::{fmt::Write, num::NonZeroU64};

use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters, TestingContext};

Expand Down Expand Up @@ -34,10 +34,11 @@ fn shader() -> String {
{}
}}
"#,
(0..ARRAY_SIZE)
(0..ARRAY_SIZE).fold(String::new(), |mut s, v| {
// "Safety": There will only be a single workgroup, and a single thread in that workgroup
.map(|v| format!(" output[{v}] = {v}u;\n"))
.collect::<String>()
writeln!(s, " output[{v}] = {v}u;").expect("String");
s
})
)
}

Expand Down Expand Up @@ -177,13 +178,13 @@ async fn validate_pipeline(
timestamp_writes: None,
});
cpass.set_pipeline(&pipeline);
cpass.set_bind_group(0, &bind_group, &[]);
cpass.set_bind_group(0, bind_group, &[]);

// -- Dispatch 0 --
cpass.dispatch_workgroups(1, 1, 1);
}

encoder.copy_buffer_to_buffer(&gpu_buffer, 0, &cpu_buffer, 0, ARRAY_SIZE * 4);
encoder.copy_buffer_to_buffer(gpu_buffer, 0, cpu_buffer, 0, ARRAY_SIZE * 4);
ctx.queue.submit([encoder.finish()]);
cpu_buffer.slice(..).map_async(wgpu::MapMode::Read, |_| ());
ctx.async_poll(wgpu::Maintain::wait())
Expand Down

0 comments on commit 130cb0a

Please sign in to comment.