UNPKG

@thi.ng/shader-ast-js

Version:

Customizable JS codegen, compiler & runtime for @thi.ng/shader-ast

37 lines 1.49 kB
import { type IReset, type Type, type TypedArray } from "@thi.ng/api"; import type { Vec } from "@thi.ng/vectors"; /** * Manager for re-using pre-allocated memory for various vector ops. If the * compiled shader program includes a `main()` function, the pools will be reset * automatically when that `main` function executes. Otherwise, users **MUST** * call the {@link CompileResult.__reset} manually each time before invoking a * compiled entry point function. * * @remarks * Currently, the default capacity for each vector type is fixed at 2048 items. * That means a shader program can create up to this number of temporary objects * (per fragment/invocation). Should this number be insufficient, please submit * an issue and explain your use case. Thanks! */ export declare class Pool implements IReset { protected size: number; protected cap: number; mem: TypedArray; items: Vec[]; index: number; next: () => Vec; from: (...args: number[]) => Vec; uniform: (n: number) => Vec; constructor(type: Type, size: number, cap: number); reset(): this; } export declare const POOL_VEC2: Pool; export declare const POOL_VEC3: Pool; export declare const POOL_VEC4: Pool; export declare const POOL_IVEC2: Pool; export declare const POOL_IVEC3: Pool; export declare const POOL_IVEC4: Pool; export declare const POOL_UVEC2: Pool; export declare const POOL_UVEC3: Pool; export declare const POOL_UVEC4: Pool; //# sourceMappingURL=pool.d.ts.map