typegpu
Version:
A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.
27 lines (26 loc) • 968 B
TypeScript
import type { ResolvedSnippet } from '../../data/snippet.ts';
import { $internal } from '../../shared/symbols.ts';
import { ShelllessRepository } from '../../tgsl/shellless.ts';
import type { TgpuLazy, TgpuSlot } from '../slot/slotTypes.ts';
type SlotToValueMap = Map<TgpuSlot<unknown>, unknown>;
export interface NamespaceInternal {
readonly takenGlobalIdentifiers: Set<string>;
readonly shelllessRepo: ShelllessRepository;
readonly strategy: 'random' | 'strict';
memoizedResolves: WeakMap<object, {
slotToValueMap: SlotToValueMap;
result: ResolvedSnippet;
}[]>;
memoizedLazy: WeakMap<TgpuLazy<unknown>, {
slotToValueMap: SlotToValueMap;
result: unknown;
}[]>;
}
export interface Namespace {
readonly [$internal]: NamespaceInternal;
}
export interface NamespaceOptions {
names?: 'random' | 'strict' | undefined;
}
export declare function namespace(options?: NamespaceOptions): Namespace;
export {};