typegpu
Version:
A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.
21 lines (20 loc) • 906 B
TypeScript
import type { AnyData, Unstruct } from './dataTypes.ts';
/**
* Creates a loose struct schema that can be used to construct vertex buffers.
* Describes structs with members of both loose and non-loose types.
*
* The order of members matches the passed in properties object.
* Members are not aligned in respect to their `byteAlignment`,
* unless they are explicitly decorated with the custom align attribute
* via `d.align` function.
*
* @example
* const CircleStruct = d.unstruct({ radius: d.f32, pos: d.vec3f }); // packed struct with no padding
*
* @example
* const CircleStruct = d.unstruct({ radius: d.f32, pos: d.align(16, d.vec3f) });
*
* @param properties Record with `string` keys and `TgpuData` or `TgpuLooseData` values,
* each entry describing one struct member.
*/
export declare function unstruct<TProps extends Record<string, AnyData>>(properties: TProps): Unstruct<TProps>;