13 void Init(wgpu::Device &device);
15 void Solve(wgpu::Buffer buffer_src, wgpu::Buffer buffer_dst,
20 wgpu::BindGroupLayout bg_layout;
21 wgpu::ComputePipeline cmp_pl_prefix_sum_sub;
22 wgpu::ComputePipeline cmp_pl_add_block_sums;
26 void InitBindGroupLayout();
27 wgpu::BindGroup GetBindGroup(wgpu::Buffer buffer_data_src,
28 wgpu::Buffer buffer_presum_src,
29 wgpu::Buffer buffer_dst,
size_t offset_data_src,
30 size_t offset_presum_src,
size_t offset_dst,
31 size_t array_size_src,
size_t array_size_dst);
34 void PrefixSumSub(wgpu::Buffer buffer_data_src,
35 wgpu::Buffer buffer_presum_src, wgpu::Buffer buffer_dst,
36 size_t offset_data_src,
size_t offset_presum_src,
37 size_t offset_dst,
size_t array_size_src,
38 size_t array_size_dst, wgpu::ComputePassEncoder cmp_pass);
40 void AddBlockSums(wgpu::Buffer buffer_data_src,
41 wgpu::Buffer buffer_presum_src, wgpu::Buffer buffer_dst,
42 size_t offset_data_src,
size_t offset_presum_src,
43 size_t offset_dst,
size_t array_size_src,
44 size_t array_size_dst, wgpu::ComputePassEncoder cmp_pass);
46 const size_t workgroup_size = 256;
47 const size_t ele_size =
sizeof(u_int32_t);
48 const size_t align_size = 256 / ele_size;