(function (global, factory) {
  if (typeof define === "function" && define.amd) {
    define(["exports", "./constants.js"], factory);
  } else if (typeof exports !== "undefined") {
    factory(exports, require("./constants.js"));
  } else {
    var mod = {
      exports: {}
    };
    factory(mod.exports, global.constants);
    global.WebGPUBufferUtils = mod.exports;
  }
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _constants) {
  "use strict";

  Object.defineProperty(_exports, "__esModule", {
    value: true
  });
  _exports.getFloatLength = getFloatLength;
  _exports.getStrideLength = getStrideLength;
  _exports.getVectorLength = getVectorLength;

  function getFloatLength(floatLength) {
    // ensure chunk size alignment (STD140 layout)
    return floatLength + (_constants.GPUChunkSize - floatLength % _constants.GPUChunkSize) % _constants.GPUChunkSize;
  }

  function getVectorLength(count) {
    var vectorLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 4;
    var strideLength = getStrideLength(vectorLength);
    var floatLength = strideLength * count;
    return getFloatLength(floatLength);
  }

  function getStrideLength(vectorLength) {
    var strideLength = 4;
    return vectorLength + (strideLength - vectorLength % strideLength) % strideLength;
  }
});