UNPKG

@motion-core/motion-gpu

Version:

Framework-agnostic WebGPU runtime for fullscreen WGSL shaders with explicit Svelte, React, and Vue adapter entrypoints.

105 lines 3.26 kB
/** * Runtime phase in which an error occurred. */ export type MotionGPUErrorPhase = 'initialization' | 'render'; /** * Stable machine-readable error category code. */ export type MotionGPUErrorCode = 'WEBGPU_UNAVAILABLE' | 'WEBGPU_ADAPTER_UNAVAILABLE' | 'WEBGPU_CONTEXT_UNAVAILABLE' | 'WGSL_COMPILATION_FAILED' | 'MATERIAL_PREPROCESS_FAILED' | 'WEBGPU_DEVICE_LOST' | 'WEBGPU_UNCAPTURED_ERROR' | 'BIND_GROUP_MISMATCH' | 'RUNTIME_RESOURCE_MISSING' | 'UNIFORM_VALUE_INVALID' | 'STORAGE_BUFFER_OUT_OF_BOUNDS' | 'STORAGE_BUFFER_READ_FAILED' | 'RENDER_GRAPH_INVALID' | 'PINGPONG_CONFIGURATION_INVALID' | 'TEXTURE_USAGE_INVALID' | 'TEXTURE_REQUEST_FAILED' | 'TEXTURE_DECODE_UNAVAILABLE' | 'TEXTURE_REQUEST_ABORTED' | 'COMPUTE_COMPILATION_FAILED' | 'COMPUTE_CONTRACT_INVALID' | 'MOTIONGPU_RUNTIME_ERROR'; /** * Severity level for user-facing diagnostics. */ export type MotionGPUErrorSeverity = 'error' | 'fatal'; /** * One source-code line displayed in diagnostics snippet. */ export interface MotionGPUErrorSourceLine { number: number; code: string; highlight: boolean; } /** * Structured source context displayed for shader compilation errors. */ export interface MotionGPUErrorSource { component: string; location: string; line: number; column?: number; snippet: MotionGPUErrorSourceLine[]; } /** * Optional runtime context captured with diagnostics payload. */ export interface MotionGPUErrorContext { materialSignature?: string; passGraph?: { passCount: number; enabledPassCount: number; inputs: string[]; outputs: string[]; }; activeRenderTargets: string[]; } /** * Structured error payload used by UI diagnostics. */ export interface MotionGPUErrorReport { /** * Stable machine-readable category code. */ code: MotionGPUErrorCode; /** * Severity level used by diagnostics UIs and telemetry. */ severity: MotionGPUErrorSeverity; /** * Whether runtime may recover without full renderer re-creation. */ recoverable: boolean; /** * Short category title. */ title: string; /** * Primary human-readable message. */ message: string; /** * Suggested remediation hint. */ hint: string; /** * Additional parsed details (for example WGSL line errors). */ details: string[]; /** * Stack trace lines when available. */ stack: string[]; /** * Original unmodified message. */ rawMessage: string; /** * Runtime phase where the error occurred. */ phase: MotionGPUErrorPhase; /** * Optional source context for shader-related diagnostics. */ source: MotionGPUErrorSource | null; /** * Optional runtime context snapshot (material/pass graph/render targets). */ context: MotionGPUErrorContext | null; } /** * Converts unknown errors to a consistent, display-ready error report. * * @param error - Unknown thrown value. * @param phase - Phase during which error occurred. * @returns Normalized error report. */ export declare function toMotionGPUErrorReport(error: unknown, phase: MotionGPUErrorPhase): MotionGPUErrorReport; //# sourceMappingURL=error-report.d.ts.map