typegpu
Version:
A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.
37 lines (36 loc) • 1.36 kB
TypeScript
import { $internal, $repr, $resolve } from '../shared/symbols.ts';
import type { ResolutionCtx, SelfResolvable } from '../types.ts';
import type { ResolvedSnippet } from './snippet.ts';
import type { BaseData, WgslStruct } from './wgslTypes.ts';
/**
* A requirement for the generated struct is that non-builtin properties need to
* have the same name in WGSL as they do in JS. This allows locations to be properly
* matched between the Vertex output and Fragment input.
*/
export declare class AutoStruct implements BaseData, SelfResolvable {
#private;
[$internal]: Record<string, never>;
type: 'auto-struct';
readonly [$repr]: Record<string, unknown>;
constructor(validProps: Record<string, BaseData>, typeForExtraProps: BaseData | undefined, locations?: Record<string, number>);
/**
* Used for accessing builtins, varying and attributes in code.
*/
accessProp(key: string): {
prop: string;
type: BaseData;
} | undefined;
/**
* Used for providing new varyings.
*
* @privateRemarks
* Internally used by `accessProp`.
*/
provideProp(key: string, dataType: BaseData): {
prop: string;
type: BaseData;
};
get completeStruct(): WgslStruct<Record<string, BaseData>>;
[$resolve](ctx: ResolutionCtx): ResolvedSnippet;
toString(): string;
}