typegpu
Version:
A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.
16 lines (15 loc) • 871 B
TypeScript
import type { AnyWgslData, BaseData, WgslStruct } from './wgslTypes.ts';
/**
* Creates a struct schema that can be used to construct GPU buffers.
* Ensures proper alignment and padding of properties (as opposed to a `d.unstruct` schema).
* The order of members matches the passed in properties object.
*
* @example
* const CircleStruct = d.struct({ radius: d.f32, pos: d.vec3f });
*
* @param props Record with `string` keys and `TgpuData` values,
* each entry describing one struct member.
*/
export declare function struct<TProps extends Record<string, AnyWgslData>>(props: TProps): WgslStruct<TProps>;
export declare function abstruct<TProps extends Record<string, AnyWgslData>>(props: TProps): WgslStruct<TProps>;
export declare function INTERNAL_createStruct<TProps extends Record<string, BaseData>>(props: TProps, isAbstruct: boolean): WgslStruct<TProps>;