setUniformBlock method

void setUniformBlock(
  1. String name,
  2. ByteData? bytes, {
  3. ShaderStage stage = ShaderStage.fragment,
})

Assign the byte contents of a uniform block by name.

bytes must already match the block's std140 layout. Replacing an existing assignment overrides the previous value. Pass null to clear the binding. stage picks which shader the block binds against; a block declared in both stages must be set for both.

Implementation

void setUniformBlock(
  String name,
  ByteData? bytes, {
  ShaderStage stage = ShaderStage.fragment,
}) {
  final blocks = _blocksFor(stage);
  if (bytes == null) {
    blocks.remove(name);
  } else {
    blocks[name] = bytes;
  }
}