typegpu
Version:
A thin layer between JS and WebGPU/WGSL that improves development experience and allows for faster iteration.
35 lines (34 loc) • 1.34 kB
TypeScript
declare const warningTypes: readonly ["deprecated", "suspicious", "fallback", "precision-loss", "implicit-conversion", "webgpu-feature-missing", "webgpu-limits-exceeded", "locations-mismatched", "log-limit-exceeded", "external-omitted", "uniform-schema-misaligned"];
type WarningType = (typeof warningTypes)[number];
interface Logger {
warn(type: WarningType, ...args: unknown[]): void;
warnOnce(type: WarningType, key: object, tag: string, ...args: unknown[]): void;
}
/**
* Use this object to globally disable TypeGPU warnings.
* All warnings are better addressed than silenced, only use this when absolutely necessary.
*
* By default, lesser warnings are already silenced in production environment.
*/
interface Warn {
/**
* Globally disables one kind of warnings.
* Do not use unless absolutely necessary.
*/
disable(type: WarningType): void;
/**
* Restores the initial state.
*/
reset(): void;
}
export declare class TgpuLogger implements Logger, Warn {
#private;
constructor(prod: boolean);
disable(type: WarningType): void;
reset(): void;
warn(type: WarningType, ...args: unknown[]): void;
warnOnce(type: WarningType, key: object, tag: string, ...args: unknown[]): void;
}
export declare const logger: Logger;
export declare const warn: Warn;
export {};