import '../../../../../globals.js';
// Copyright 2023-2024, University of Colorado Boulder
/**
 * Converts an index from a striped order to a normal (blocked) order.
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import { alpenglow, u32S, wgsl, wgslOneLine } from '../../../imports.js';
const fromStripedIndexWGSL = (options) => {
    const i = options.i;
    const workgroupSize = options.workgroupSize;
    const grainSize = options.grainSize;
    return wgslOneLine(wgsl `
    // TODO: optimizations if workgroupSize or grainSize is 1
    (
      ( ( ${i} ) / ${u32S(workgroupSize * grainSize)} ) * ${u32S(workgroupSize * grainSize)} +
      ( ( ${i} ) % ${u32S(workgroupSize)} ) * ${u32S(grainSize)} +
      ( ( ( ${i} ) % ${u32S(workgroupSize * grainSize)} ) / ${u32S(workgroupSize)} )
    )
  `);
};
export default fromStripedIndexWGSL;
alpenglow.register('fromStripedIndexWGSL', fromStripedIndexWGSL);
//# sourceMappingURL=fromStripedIndexWGSL.js.map