createComputePipelineAsync method
createComputePipeline through createComputePipelineAsync: a compute
pipeline has no draw state, so the whole of it is realised here, off
the calling turn, and a pipeline the browser refuses completes the
future with the error rather than surfacing later at
debugDrainErrors.
Implementation
@override
Future<ComputePipelineHandle> createComputePipelineAsync(
ShaderHandle shader,
) async {
final stage = shader.backend;
if (stage is! WebGpuComputeShader) {
throw ArgumentError.value(
shader.name,
'shader',
'is not a compute stage on this device',
);
}
final pipeline = await webgpuCreateComputePipelineAsync(_gpuDevice, stage);
return wrapComputePipeline(owner: this, backend: pipeline, shader: shader);
}