import { NumericType } from "../../../core/math/NumericType.js";
import { channelCountToThreeTextureFormat } from "./channelCountToThreeTextureFormat.js";
import { channelCountToThreIntegerTextureType } from "./channelCountToThreIntegerTextureType.js";

/**
 *
 * @param {NumericType} type
 * @param {number} channel_count
 */
export function computeThreeTextureFormat(type, channel_count) {
    if (type === NumericType.Uint || type === NumericType.Int) {
        return channelCountToThreIntegerTextureType(channel_count);
    } else if (type === NumericType.Float) {
        return channelCountToThreeTextureFormat(channel_count);
    } else {
        throw new Error(`Unsupported numeric type '${type}'`);
    }
}

