loadShaders method

  1. @override
Future<LoadedShaderLibrary> loadShaders(
  1. ByteData bytes
)

The bundle's own WGSL, compiled by this device, as a library that can be reloaded.

Four lines, because the two halves meet at compileModule. The section codec is webgpu_bundle_section.dart, the refusals and the reload are webgpu_loaded_shaders.dart, and what this device contributes is the one thing neither can do without a browser: turning text into a module. The library is built synchronously and the future is the signature's, not a promise of work — nothing here waits on the GPU, and a browser's opinion of the WGSL arrives at debugDrainErrors the way compileModule describes.

Refuses by name — ShaderBundleRefused — for a bundle with no section for this backend, a section that is not the document the codec reads, and one written to a version of that document this build does not know.

Implementation

@override
Future<LoadedShaderLibrary> loadShaders(ByteData bytes) async =>
    WebGpuLoadedShaderLibrary.load(this, bytes);