ShaderBundle class final

A loadable shader bundle: a name, the SDK it was compiled on, the stages it claims, and a compiled section per backend that needs one.

A value. encode writes the bytes a device's loadShaders takes and decode reads them back; the two are checked against each other by test/shader_bundle_test.dart, which is what makes the format a fact rather than a description.

Constructors

ShaderBundle({required String name, required String sdk, required List<ShaderBundleStage> stages, Map<String, ByteData> sections = const <String, ByteData>{}})
const

Properties

hashCode int
The hash code for this object.
no setterinherited
name String
What the bundle is called, and what a refusal names.
final
names Iterable<String>
Every name in stages.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sdk String
The Dart SDK the compiled section was built with: the first token of dart --version, which is also the first token of Platform.version in the running application. 3.13.0, say. One release of Flutter ships one Dart, so the token identifies the impellerc that wrote the section.
final
sections Map<String, ByteData>
Backend-specific payloads by section id.
final
stages List<ShaderBundleStage>
The entry points this bundle claims, whichever section answers them.
final

Methods

compiledFor(String running) bool
Whether running is the SDK this bundle was compiled with.
encode() ByteData
The bytes, in the layout decode reads.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
section(String id) ByteData?
The payload for id, or null when the bundle carries none for it.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

decode(ByteData bytes) ShaderBundle
Reads what encode wrote.

Constants

formatVersion → const int
The layout version encode writes and decode accepts.
impellerSection → const String
The section the Impeller backend reads: impellerc output, as it is.
magic → const String
The four bytes every bundle starts with.
webglSection → const String
The section the WebGL backend reads: GLSL ES 3.00 sources by name, as JSON. flutter3d_webgl says what the document looks like.
webgpuSection → const String
The section the WebGPU backend reads: WGSL sources and the reflection that goes with them, as JSON. flutter3d_webgpu says what the document looks like.