loadBaseShaderLibrary function Assets and loading
Asynchronously loads and caches the base shader bundle. Idempotent. Called by Scene.initializeStaticResources so the synchronous baseShaderLibrary getter has a cached library to return (shader assets can't be read synchronously on any backend).
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;
}