bindStorageBuffer method

  1. @override
bool bindStorageBuffer(
  1. ShaderHandle shader,
  2. String name,
  3. StorageBuffer buffer, {
  4. int offsetInBytes = 0,
  5. int? sizeInBytes,
})
override

Binds buffer to the storage binding name of shader. False when the stage declares no such binding.

offsetInBytes and sizeInBytes bind a range of it — a multiple of DeviceLimits.minStorageBufferOffsetAlignment from the start, to the end by default. Since 0.9; every backend that binds storage at all honours the range, and refuses one that does not lie inside the buffer with a RangeError.

Implementation

@override
bool bindStorageBuffer(
  ShaderHandle shader,
  String name,
  StorageBuffer buffer, {
  int offsetInBytes = 0,
  int? sizeInBytes,
}) {
  final size = checkStorageBinding(
    buffer,
    limits,
    offsetInBytes: offsetInBytes,
    sizeInBytes: sizeInBytes,
  );
  commands.add(
    RecordedCall(
      'bindStorageBuffer',
      arguments: (
        name: name,
        buffer: buffer,
        offsetInBytes: offsetInBytes,
        sizeInBytes: size,
      ),
    ),
  );
  return true;
}