typegpu
Version:
A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.
16 lines (15 loc) • 1.03 kB
TypeScript
import { type TgpuResourceSoul, type TransferableResourceType } from './restore.ts';
import type { RestoreContext } from './types.ts';
export type { TgpuResourceSoul, TransferableResourceType };
/** What travels between runtimes: a plain copy of a TypeGPU resource's soul */
export type TgpuResourceSnapshot = TgpuResourceSoul;
/** Whether the value is something {@link snapshotResource} can carry across a device boundary */
export declare function isTransferableResource(value: unknown): boolean;
/** Whether the value is a class-like TypeGPU object that {@link snapshotResource} cannot carry */
export declare function isNonTransferableResource(value: unknown): boolean;
/**
* Extracts what survives a device boundary: the resource's soul, completed by
* materialization for resources whose definition is a compiled object
*/
export declare function snapshotResource(value: unknown): TgpuResourceSnapshot | undefined;
export declare function restoreResource(snapshot: TgpuResourceSnapshot, ctx: RestoreContext): unknown;