getTransparentPlaceholderTexture static method

Texture getTransparentPlaceholderTexture()

Returns a 1x1 fully transparent texture, lazily created on first use.

Composites as a no-op under premultiplied source-over, so a pass whose layer is absent this frame can bind it and blend nothing.

Implementation

static gpu.Texture getTransparentPlaceholderTexture() {
  if (_transparentPlaceholderTexture != null) {
    return _transparentPlaceholderTexture!;
  }
  final texture = gpu.gpuContext.createTexture(
    gpu.StorageMode.hostVisible,
    1,
    1,
  );
  texture.overwrite(Uint32List.fromList(<int>[0]).buffer.asByteData());
  _transparentPlaceholderTexture = texture;
  return texture;
}