shadow$provide.module$node_modules$pixi_DOT_js$lib$compressed_textures$ktx2$utils$convertFormatIfRequired = function(global, require, module, exports) {
  function convertRGBtoRGBA(levelBuffer) {
    const pixelCount = levelBuffer.byteLength / 3, levelBufferWithAlpha = new Uint32Array(pixelCount);
    for (let i = 0; i < pixelCount; ++i) {
      levelBufferWithAlpha[i] = levelBuffer[3 * i] + (levelBuffer[3 * i + 1] << 8) + (levelBuffer[3 * i + 2] << 16) + 4278190080;
    }
    return new Uint8Array(levelBufferWithAlpha.buffer);
  }
  const converters = {rgb8unorm:{convertedFormat:"rgba8unorm", convertFunction:convertRGBtoRGBA}, "rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb", convertFunction:convertRGBtoRGBA}};
  exports.convertFormatIfRequired = function(textureOptions) {
    const format = textureOptions.format;
    if (converters[format]) {
      const convertFunction = converters[format].convertFunction, levelBuffers = textureOptions.resource;
      for (let i = 0; i < levelBuffers.length; i++) {
        levelBuffers[i] = convertFunction(levelBuffers[i]);
      }
      textureOptions.format = converters[format].convertedFormat;
    }
  };
};

//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$compressed_textures$ktx2$utils$convertFormatIfRequired.js.map
