@motion-core/motion-gpu
Version:
Framework-agnostic WebGPU runtime for fullscreen WGSL shaders with explicit Svelte, React, and Vue adapter entrypoints.
53 lines • 2.11 kB
TypeScript
import type { MaterialSourceLocation, MaterialSourceMetadata } from './material-contracts.js';
export type { MaterialSourceMetadata } from './material-contracts.js';
export interface ComputeSourceLocation {
readonly kind: 'compute';
readonly line: number;
}
export type ShaderSourceLocation = MaterialSourceLocation | ComputeSourceLocation;
/**
* One WGSL compiler diagnostic enriched with source-location metadata.
*/
export interface ShaderCompilationDiagnostic {
readonly generatedLine: number;
readonly message: string;
readonly linePos?: number;
readonly lineLength?: number;
readonly sourceLocation: ShaderSourceLocation | null;
}
/**
* Runtime context snapshot captured for shader compilation diagnostics.
*/
export interface ShaderCompilationRuntimeContext {
readonly materialSignature?: string;
readonly passGraph?: {
readonly passCount: number;
readonly enabledPassCount: number;
readonly inputs: readonly string[];
readonly outputs: readonly string[];
};
readonly activeRenderTargets: readonly string[];
}
/**
* Structured payload attached to WGSL compilation errors.
*/
export interface ShaderCompilationDiagnosticsPayload {
readonly kind: 'shader-compilation';
readonly shaderStage?: 'fragment' | 'compute';
readonly diagnostics: readonly ShaderCompilationDiagnostic[];
readonly fragmentSource: string;
readonly computeSource?: string;
readonly includeSources: Readonly<Record<string, string>>;
readonly defineBlockSource?: string;
readonly materialSource: MaterialSourceMetadata | null;
readonly runtimeContext?: ShaderCompilationRuntimeContext;
}
/**
* Attaches structured diagnostics payload to an Error.
*/
export declare function attachShaderCompilationDiagnostics(error: Error, payload: ShaderCompilationDiagnosticsPayload): Error;
/**
* Extracts structured diagnostics payload from unknown error value.
*/
export declare function getShaderCompilationDiagnostics(error: unknown): ShaderCompilationDiagnosticsPayload | null;
//# sourceMappingURL=error-diagnostics.d.ts.map