RuntimeShaders constructor

RuntimeShaders({
  1. required String? backend,
  2. required Future<LoadedShaderLibrary> loadShaders(
    1. ByteData bundle
    ),
  3. required Registration addMaterials(
    1. ShaderLibrary library
    ),
  4. Map<String, String>? engineSources,
  5. PackedStage? webGpuHost,
  6. int? webGpuFullscreenUvLocation,
  7. MaterialCompilerRegistry? compilers,
  8. Future<ByteData?> prebuilt(
    1. String material
    )?,
})

A registry building shaders for backend (normalised, see RuntimeBackends.normalize), loading each with loadShaders and adding the materials to the renderer with addMaterials.

engineSources, webGpuHost, webGpuFullscreenUvLocation and compilers are what runtimeMaterialBundle takes for WebGL2, WebGPU and a backend's own compiler; a build that needs one and lacks it switches the material off with the reason. prebuilt finds the bundle the build compiled for a material, or for a render step's stage, on Impeller by the stage's name, null where the build made none.

Implementation

RuntimeShaders({
  required String? backend,
  required Future<LoadedShaderLibrary> Function(ByteData bundle) loadShaders,
  required Registration Function(ShaderLibrary library) addMaterials,
  Map<String, String>? engineSources,
  PackedStage? webGpuHost,
  int? webGpuFullscreenUvLocation,
  MaterialCompilerRegistry? compilers,
  Future<ByteData?> Function(String material)? prebuilt,
}) : _store = _ShaderStore(
       RuntimeBackends.normalize(backend),
       loadShaders,
       addMaterials,
       engineSources,
       webGpuHost,
       webGpuFullscreenUvLocation,
       compilers,
       prebuilt,
     ),
     _scope = null;