UNPKG

typegpu

Version:

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

20 lines (19 loc) 1.03 kB
import { type ResolutionCtx } from '../types.ts'; import type { Snippet } from './snippet.ts'; import type { BaseData } from './wgslTypes.ts'; /** * A wrapper for `schema(item)` or `schema()` call on JS side. * If the schema is a pointer, returns the value pointed to without copying. * If the schema is a TgpuVertexFormatData, calls the corresponding constructible schema instead. * If the schema is not callable, throws an error. * Otherwise, returns `schema(item)` or `schema()`. */ export declare function schemaCallWrapper<T>(schema: BaseData, item?: T): T; /** * A wrapper for `schema(item)` or `schema()` call on the GPU side. * If the schema is a pointer, returns the value pointed to without copying. * If the schema is a TgpuVertexFormatData, calls the corresponding constructible schema instead. * If the schema is not callable, throws an error. * Otherwise, returns `schema(item)` or `schema()`. */ export declare function schemaCallWrapperGPU(ctx: ResolutionCtx, schema: BaseData, item?: Snippet): Snippet;