UNPKG

typegpu

Version:

A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.

70 lines (69 loc) 3.77 kB
import { type OmitBuiltins } from '../../builtin.ts'; import { AutoStruct } from '../../data/autoStruct.ts'; import type { ResolvedSnippet } from '../../data/snippet.ts'; import type { FormatToWGSLType } from '../../data/vertexFormatData.ts'; import type { BaseData, v4f } from '../../data/wgslTypes.ts'; import type { InferGPU, InferGPURecord, InferRecord } from '../../shared/repr.ts'; import { $internal, $resolve } from '../../shared/symbols.ts'; import type { Assume, RemoveIndexSignature } from '../../shared/utilityTypes.ts'; import type { TgpuVertexAttrib } from '../../shared/vertexFormat.ts'; import type { ResolutionCtx, SelfResolvable } from '../../types.ts'; import type { BaseIOData } from './fnTypes.ts'; export type AnyAutoCustoms = Record<string, InferGPU<BaseIOData>>; declare const builtinVertexIn: { readonly $vertexIndex: import("../../builtin.ts").BuiltinVertexIndex; readonly $instanceIndex: import("../../builtin.ts").BuiltinInstanceIndex; }; export type AutoVertexIn<T extends AnyAutoCustoms> = RemoveIndexSignature<T> & InferRecord<typeof builtinVertexIn>; export type _AutoVertexIn<T> = AutoVertexIn<{ [Key in keyof T]: T[Key] extends TgpuVertexAttrib ? InferGPU<FormatToWGSLType<T[Key]['format']>> : Assume<T[Key], InferGPU<BaseIOData>>; }>; declare const builtinVertexOut: { readonly $clipDistances: import("../../builtin.ts").BuiltinClipDistances; readonly $position: import("../../builtin.ts").BuiltinPosition; }; export type AutoVertexOut<T extends AnyAutoCustoms> = OmitBuiltins<T> & Partial<InferGPURecord<typeof builtinVertexOut>>; declare const builtinFragmentIn: { readonly $position: import("../../builtin.ts").BuiltinPosition; readonly $frontFacing: import("../../builtin.ts").BuiltinFrontFacing; readonly $primitiveIndex: import("../../builtin.ts").BuiltinPrimitiveIndex; readonly $sampleIndex: import("../../builtin.ts").BuiltinSampleIndex; readonly $sampleMask: import("../../builtin.ts").BuiltinSampleMask; readonly $subgroupInvocationId: import("../../builtin.ts").BuiltinSubgroupInvocationId; readonly $subgroupSize: import("../../builtin.ts").BuiltinSubgroupSize; }; export type AutoFragmentIn<T extends AnyAutoCustoms> = RemoveIndexSignature<T> & InferRecord<typeof builtinFragmentIn>; declare const builtinFragmentOut: { readonly $fragDepth: import("../../builtin.ts").BuiltinFragDepth; readonly $sampleMask: import("../../builtin.ts").BuiltinSampleMask; }; export type AutoFragmentOut<T extends undefined | v4f | AnyAutoCustoms> = T extends undefined | v4f ? T : T & Partial<InferGPURecord<typeof builtinFragmentOut>>; type AutoFragmentFnImpl = (input: AutoFragmentIn<Record<string, never>>) => AutoFragmentOut<undefined | v4f | AnyAutoCustoms>; /** * Only used internally. Meant to be recreated on every resolution. */ export declare class AutoFragmentFn implements SelfResolvable { #private; [$internal]: true; resourceType: 'auto-fragment-fn'; autoIn: AutoStruct; autoOut: AutoStruct; constructor(impl: AutoFragmentFnImpl, varyings: Record<string, BaseData>, locations?: Record<string, number>); toString(): string; [$resolve](ctx: ResolutionCtx): ResolvedSnippet; } type AutoVertexFnImpl = (input: AutoVertexIn<Record<string, never>>) => AutoVertexOut<AnyAutoCustoms>; /** * Only used internally. Meant to be recreated on every resolution. */ export declare class AutoVertexFn implements SelfResolvable { #private; [$internal]: true; resourceType: 'auto-vertex-fn'; autoIn: AutoStruct; autoOut: AutoStruct; constructor(impl: AutoVertexFnImpl, attribs: Record<string, BaseData>, locations?: Record<string, number>); toString(): string; [$resolve](ctx: ResolutionCtx): ResolvedSnippet; } export {};