typegpu
Version:
A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.
26 lines (25 loc) • 1.32 kB
TypeScript
import type { Disarray } from '../../data/dataTypes.ts';
import type { WgslArray } from '../../data/wgslTypes.ts';
import type { TgpuNamable } from '../../shared/meta.ts';
import type { TgpuSoul } from '../../shared/soul.ts';
import { $internal, $soul } from '../../shared/symbols.ts';
import type { ArrayToContainedAttribs } from './vertexAttribute.ts';
export interface TgpuVertexLayoutSoul extends TgpuSoul<'vertex-layout'> {
readonly schema: WgslArray | Disarray;
readonly stepMode: 'vertex' | 'instance';
}
export interface TgpuVertexLayout<TData extends WgslArray | Disarray = WgslArray | Disarray> extends TgpuNamable {
readonly [$internal]: true;
readonly [$soul]: TgpuVertexLayoutSoul;
readonly resourceType: 'vertex-layout';
readonly stride: number;
readonly stepMode: 'vertex' | 'instance';
readonly attrib: ArrayToContainedAttribs<TData>;
readonly vertexLayout: GPUVertexBufferLayout;
schemaForCount(n: number): TData;
}
export interface INTERNAL_TgpuVertexAttrib {
readonly _layout: TgpuVertexLayout;
}
export declare function vertexLayout<TData extends WgslArray | Disarray>(schemaForCount: (count: number) => TData, stepMode?: 'vertex' | 'instance'): TgpuVertexLayout<TData>;
export declare function isVertexLayout(value: unknown): value is TgpuVertexLayout;