bindUniformBlock method

  1. @override
bool bindUniformBlock(
  1. ShaderHandle shader,
  2. String blockName,
  3. Map<String, Float32List> members
)
override

Fills the uniform block blockName of shader from members and binds it. False when the shader has no such block.

Members the compiled shader does not read are skipped rather than treated as errors — the unlit model legitimately has no light_direction — and a block the compiler dropped entirely comes back false. That distinction is load-bearing: binding a block a compiled shader does not have takes the process down with no Dart stack.

Every uniform in this engine is a float vector, a matrix or an array of either, which is why Float32List is the only value type. Integer and boolean uniforms are encoded as floats in the shaders on purpose.

Implementation

@override
bool bindUniformBlock(
  ShaderHandle shader,
  String blockName,
  Map<String, Float32List> members,
) {
  commands.add(RecordedUniformBlock(shader, blockName, members));
  return true;
}