kernelsOf function
The kernels bundle's kernel section carries, read and checked, by
stage name; empty when it has none. What a device's loadShaders calls.
Throws ShaderBundleException naming the bundle for a section that is
not the payload, and for a kernel whose source does not read, with the
reason.
Implementation
Map<String, ComputeKernel> kernelsOf(ShaderBundle bundle) {
final sources = decodeKernelSection(bundle);
final kernels = <String, ComputeKernel>{};
for (final MapEntry(key: name, value: source) in sources.entries) {
try {
kernels[name] = ComputeKernel.parse(source, name: name);
} on ComputeKernelException catch (error) {
throw ShaderBundleException(
name: bundle.name,
reason: 'its kernel "$name" does not read: ${error.message}',
);
}
}
return kernels;
}