Use a reasonable workgroup size for ComputeBoids.

Bug: None
Change-Id: I7fb1d37173fe234e5bcdc33645d0cbc7b7ca3021
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/129000
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2023-04-25 10:05:18 +00:00 committed by Dawn LUCI CQ
parent 20e3e34ce7
commit 154bb3460c
1 changed files with 3 additions and 3 deletions

View File

@ -40,7 +40,7 @@ std::array<wgpu::BindGroup, 2> updateBGs;
size_t pingpong = 0;
static const uint32_t kNumParticles = 1000;
static const uint32_t kNumParticles = 1024;
struct Particle {
std::array<float, 2> pos;
@ -170,7 +170,7 @@ void initSim() {
@binding(2) @group(0) var<storage, read_write> particlesB : Particles;
// https://github.com/austinEng/Project6-Vulkan-Flocking/blob/master/data/shaders/computeparticles/particle.comp
@compute @workgroup_size(1)
@compute @workgroup_size(64)
fn main(@builtin(global_invocation_id) GlobalInvocationID : vec3u) {
var index : u32 = GlobalInvocationID.x;
if (index >= params.particleCount) {
@ -276,7 +276,7 @@ wgpu::CommandBuffer createCommandBuffer(const wgpu::TextureView backbufferView,
wgpu::ComputePassEncoder pass = encoder.BeginComputePass();
pass.SetPipeline(updatePipeline);
pass.SetBindGroup(0, updateBGs[i]);
pass.DispatchWorkgroups(kNumParticles);
pass.DispatchWorkgroups(kNumParticles / 64);
pass.End();
}