loadBaseShaderLibrary function
Asynchronously loads and caches the base shader bundle. Idempotent. Called by Scene.initializeStaticResources so the synchronous baseShaderLibrary getter has a cached library to return (required on web, where shader assets can't be read synchronously).
Implementation
Future<void> loadBaseShaderLibrary() async {
if (_baseShaderLibrary != null) {
return;
}
final lib = await gpu.loadShaderLibraryAsync(_kBaseShaderBundlePath);
if (lib == null) {
throw Exception(
"Failed to load base shader bundle! ($_kBaseShaderBundlePath)",
);
}
_baseShaderLibrary = lib;
}