/**
 * Estimated GPU-side geometry size
 * @param {THREE.BufferGeometry} g
 * @returns {number}
 */
export function compute_buffer_geometry_byte_size(g) {
    let result = 54;

    const index = g.getIndex();

    if (index !== null) {
        result += index.array.buffer.byteLength;
    }

    for (const attribute_name in g.attributes) {
        result += g.attributes[attribute_name].array.buffer.byteLength;

        // reserve some space for the attribute reference itself
        result += 8;
    }

    return result;
}
