@motion-core/motion-gpu
Version:
Framework-agnostic WebGPU runtime for fullscreen WGSL shaders with explicit Svelte, React, and Vue adapter entrypoints.
62 lines • 1.98 kB
TypeScript
import type { MaterialSourceLocation } from './material-preprocess.js';
/**
* Source metadata for material declaration callsite.
*/
export interface MaterialSourceMetadata {
component?: string;
file?: string;
line?: number;
column?: number;
functionName?: string;
}
export interface ComputeSourceLocation {
kind: 'compute';
line: number;
}
export type ShaderSourceLocation = MaterialSourceLocation | ComputeSourceLocation;
/**
* One WGSL compiler diagnostic enriched with source-location metadata.
*/
export interface ShaderCompilationDiagnostic {
generatedLine: number;
message: string;
linePos?: number;
lineLength?: number;
sourceLocation: ShaderSourceLocation | null;
}
/**
* Runtime context snapshot captured for shader compilation diagnostics.
*/
export interface ShaderCompilationRuntimeContext {
materialSignature?: string;
passGraph?: {
passCount: number;
enabledPassCount: number;
inputs: string[];
outputs: string[];
};
activeRenderTargets: string[];
}
/**
* Structured payload attached to WGSL compilation errors.
*/
export interface ShaderCompilationDiagnosticsPayload {
kind: 'shader-compilation';
shaderStage?: 'fragment' | 'compute';
diagnostics: ShaderCompilationDiagnostic[];
fragmentSource: string;
computeSource?: string;
includeSources: Record<string, string>;
defineBlockSource?: string;
materialSource: MaterialSourceMetadata | null;
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