API

Function createTexture2DArrayFromKtx2

  • Decode a single KTX2 file that stores several array layers (layerCount > 1) and upload it as one Texture2DArray. The single-file counterpart to createTexture2DArrayFromUrls: the whole array travels in one container. This compatibility path exposes sampler and regenerated-mipmap options. Use uploadKtx2Texture2DArray when preserving the device-selected compressed format and the container's complete authored mip chain is preferred.

    The data is transcoded to uncompressed RGBA8 (forceRGBA), so the GPU cost matches a plain RGBA array texture. Only the base mip level from the file is uploaded; when generateMipMaps is on, the remaining levels are regenerated on upload.

    The decoder orders mipmaps level-by-level and, within a level, layer-by-layer, so the base level occupies the first layerCount entries in ascending layer order — matched by slicing mipmaps[0 .. layerCount) and concatenating each layer back-to-back into the single flat buffer createTexture2DArrayFromPixels expects.

    Parameters

    Returns Promise<Texture2DArray>