load static method
Loads bundle on device and creates a pipeline for each of specs.
Throws a StateError naming any shader the bundle lacks.
Implementation
static Future<PipelineSet> load(
GpuDevice device,
String bundle,
Iterable<PipelineSpec> specs,
) async {
final library = await device.loadShaderLibrary(bundle);
final pipelines = <PipelineSpec, GpuPipeline>{};
for (final spec in specs) {
final vertex = library[spec.vertex];
final fragment = library[spec.fragment];
if (vertex == null || fragment == null) {
throw StateError(
'$bundle has no ${vertex == null ? spec.vertex : spec.fragment}.',
);
}
pipelines[spec] = device.pipeline(vertex, fragment, layout: spec.layout);
}
return PipelineSet._(pipelines);
}