Texture2DArray.empty constructor
Texture2DArray.empty({
- required int width,
- required int height,
- required int layerCount,
- DataTextureFormat format = DataTextureFormat.rgba8,
- TextureSampling? sampling,
Allocates a 2D-array texture without uploading anything, for data that arrives a layer at a time through writeLayer. Unwritten layers hold undefined contents.
Implementation
factory Texture2DArray.empty({
required int width,
required int height,
required int layerCount,
DataTextureFormat format = DataTextureFormat.rgba8,
TextureSampling? sampling,
}) {
if (!isSupported) {
throw UnsupportedError(
'This backend has no 2D-array textures; check '
'Texture2DArray.isSupported.',
);
}
final texture = gpu.createTexture2DArray(
gpu.StorageMode.hostVisible,
width,
height,
layerCount,
format: format._pixelFormat,
);
return Texture2DArray._(
texture,
format,
(sampling ?? format.defaultSampling).toSamplerOptions(),
);
}