typegpu
Version:
A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.
22 lines (21 loc) • 752 B
TypeScript
export interface TgpuRange extends Array<number> {
start: number;
end: number;
step: number;
}
/**
* Returns an array of values between `start` (inclusive) and `end` (exclusive) with the given `step`.
*
* If only one argument is provided, it is interpreted as `end`, with `start=0` and `step=1`.
*
* ```ts
* let result = d.f32(1);
* for (const i of std.range(5)) {
* result *= i + 1;
* }
* ```
*
* Can also be combined with `tgpu.unroll` to unroll a specific number of iterations.
*/
export declare const range: import("../indexNamedExports.ts").TgpuComptime<((end: number) => TgpuRange) & ((start: number, end?: number, step?: number) => TgpuRange)>;
export declare function isTgpuRange(value: unknown): value is TgpuRange;