texelOn function

TextureHandle texelOn(
  1. CpuDevice device,
  2. List<int> rgba
)

A one-pixel texture of rgba, on device.

The shape every fallback in this engine has. Public because a test that wants a third one — a flat metallic-roughness, a black emissive — should not have to write the four lines out to get it.

Implementation

TextureHandle texelOn(CpuDevice device, List<int> rgba) =>
    device.createTextureFromPixels(
      width: 1,
      height: 1,
      format: TextureFormat.r8g8b8a8UNormInt,
      pixels: ByteData.sublistView(Uint8List.fromList(rgba)),
    )!;