shader_bundle library
The shader bundle container on its own, for a tool that runs on plain Dart.
flutter3d_hardware.dart reaches package:flutter through
GraphicsDevice, and a program that packs a bundle — flutter3d_webgl's
tool/pack_shaders.dart — is a dart run script that has no dart:ui
to give it. The container names no graphics API and no Flutter, so it is
exported alone here, the way testing.dart is a second entry point for a
second kind of consumer. An application loading a bundle wants the whole
library and the device with it; this is for the thing that writes one.
Classes
- ShaderBundle
- 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.
- ShaderBundleStage
- One entry point a bundle claims to hold.
- ShaderStageKind
- What a stage runs as: a vertex, a fragment or a compute program.
Constants
- kernelSectionVersion → const int
- The version of ShaderBundle.kernelSection's payload that encodeKernelSection writes and the newest decodeKernelSection reads.
- materialSectionVersion → const int
- The version of ShaderBundle.materialSection's payload that encodeMaterialSection writes and the newest decodeMaterialSection reads.
Functions
-
decodeKernelSection(
ShaderBundle bundle) → Map< String, String> -
The kernel sources encodeKernelSection wrote, or empty when
bundlehas no kernel section; refuses as decodeMaterialSection does. -
decodeMaterialSection(
ShaderBundle bundle) → Map< String, String> -
The sources encodeMaterialSection wrote, or empty when
bundlehas no material section. Throws a ShaderBundleException naming the bundle for one that is not that payload, and a stale one for a payload newer than materialSectionVersion. -
encodeKernelSection(
Map< String, String> sources) → ByteData - The payload of ShaderBundle.kernelSection: each compute kernel's kernel-language source, by stage name — 1.0. The same document as encodeMaterialSection's, under a version of its own.
-
encodeMaterialSection(
Map< String, String> sources) → ByteData -
The payload of ShaderBundle.materialSection: each stage's
material-language source, by stage name —
P8.
Exceptions / Errors
- ShaderBundleException
- Raised when a device will not load a bundle, and says which and why.