writeLayer method
Replaces layer layer with data, exactly one layer of texels.
Implementation
// TODO(data-texture-regions): sub-rectangle writes need region uploads in
// Flutter GPU; until then a partial update rewrites the whole layer.
void writeLayer(int layer, TypedData data) {
RangeError.checkValidIndex(layer, this, 'layer', layerCount);
_texture.overwrite(
dataTextureBytes(data, layerByteSize, 'Layer $layer'),
slice: layer,
);
}