compute method

dynamic compute(
  1. dynamic computeParams
)

Implementation

compute(computeParams) {
  var device = this._device!;
  var cmdEncoder = device.createCommandEncoder();
  var passEncoder = cmdEncoder.beginComputePass();

  for (var param in computeParams.keys) {
    // pipeline

    var pipeline = this._computePipelines.get(param);
    passEncoder.setPipeline(pipeline);

    // bind group

    var bindGroup = this._bindings.getForCompute(param).group;
    this._bindings.update(param);
    passEncoder.setBindGroup(0, bindGroup);

    passEncoder.dispatch(param.num);
  }

  passEncoder.end();
  device.queue.submit(cmdEncoder.finish());
}