typegpu
Version:
A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.
69 lines (68 loc) • 2.35 kB
TypeScript
import type { TgpuBuffer } from './core/buffer/buffer.ts';
import type { TgpuSlot } from './core/slot/slotTypes.ts';
import type { TgpuVertexLayout } from './core/vertexLayout/vertexLayout.ts';
import type { BaseData } from './data/wgslTypes.ts';
import type { TgpuBindGroupLayout } from './tgpuBindGroupLayout.ts';
/**
* Inspired by: https://github.com/alexreardon/tiny-invariant/blob/master/src/tiny-invariant.ts
*/
export declare function invariant(condition: unknown, message?: string | (() => string)): asserts condition;
/**
* An error that happens during resolution of WGSL code.
* Contains a trace of all ancestor resolvables in
* which this error originated.
*
* @category Errors
*/
export declare class ResolutionError extends Error {
readonly cause: unknown;
readonly trace: unknown[];
constructor(cause: unknown, trace: unknown[]);
appendToTrace(ancestor: unknown): ResolutionError;
}
/**
* An error that happens during execution of TypeGPU functions.
* Contains a trace of all TypeGPU functions called along the way.
*
* @category Errors
*/
export declare class ExecutionError extends Error {
readonly cause: unknown;
readonly trace: unknown[];
constructor(cause: unknown, trace: unknown[]);
appendToTrace(ancestor: unknown): ExecutionError;
}
/**
* @category Errors
*/
export declare class MissingSlotValueError extends Error {
readonly slot: TgpuSlot<unknown>;
constructor(slot: TgpuSlot<unknown>);
}
/**
* @category Errors
*/
export declare class NotUniformError extends Error {
constructor(value: TgpuBuffer<BaseData>);
}
export declare class MissingBindGroupsError extends Error {
constructor(layouts: Iterable<TgpuBindGroupLayout>);
}
export declare class MissingVertexBuffersError extends Error {
constructor(layouts: Iterable<TgpuVertexLayout>);
}
export declare class IllegalVarAccessError extends Error {
constructor(msg: string);
}
export declare class IllegalBufferAccessError extends Error {
constructor(msg: string);
}
export declare class WgslTypeError extends Error {
constructor(msg: string);
}
export declare class SignatureNotSupportedError extends Error {
constructor(actual: BaseData[], candidates: BaseData[]);
}
export declare class FiniteMathAssumptionError extends Error {
constructor(value: number, type: BaseData);
}