UNPKG

@motion-core/motion-gpu

Version:

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

109 lines 4.38 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' | 'RESOURCE_REGISTRY_DUPLICATE' | 'RESOURCE_REGISTRY_TEXTURE_MISSING' | 'RESOURCE_REGISTRY_STORAGE_BUFFER_MISSING' | 'UNIFORM_VALUE_INVALID' | 'STORAGE_BUFFER_OUT_OF_BOUNDS' | 'STORAGE_BUFFER_READ_FAILED' | 'RENDER_GRAPH_INVALID' | 'PINGPONG_CONFIGURATION_INVALID' | 'TEXTURE_USAGE_INVALID' | 'FORMAT_CAPABILITY_MISSING' | 'TEXTURE_REQUEST_FAILED' | 'TEXTURE_DECODE_UNAVAILABLE' | 'TEXTURE_REQUEST_ABORTED' | 'COMPUTE_COMPILATION_FAILED' | 'COMPUTE_CONTRACT_INVALID' | 'COMPUTE_RESOURCE_DESCRIPTOR_INVALID' | 'COMPUTE_RESOURCE_UNKNOWN' | 'COMPUTE_RESOURCE_INCOMPATIBLE' | 'COMPUTE_RESOURCE_ALIAS_COLLISION' | 'COMPUTE_RESOURCE_HAZARD' | 'COMPUTE_GRAPH_MULTIPLE_WRITERS' | 'COMPUTE_GRAPH_CYCLE' | 'COMPUTE_RESOURCE_LIMIT_EXCEEDED' | 'COMPUTE_EXTERNAL_RESOURCE_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 { readonly number: number; readonly code: string; readonly highlight: boolean; } /** * Structured source context displayed for shader compilation errors. */ export interface MotionGPUErrorSource { readonly component: string; readonly location: string; readonly line: number; readonly column?: number; readonly snippet: readonly MotionGPUErrorSourceLine[]; } /** * Optional runtime context captured with diagnostics payload. */ export interface MotionGPUErrorContext { readonly materialSignature?: string; readonly passGraph?: { readonly passCount: number; readonly enabledPassCount: number; readonly inputs: readonly string[]; readonly outputs: readonly string[]; }; readonly activeRenderTargets: readonly string[]; } /** * Structured error payload used by UI diagnostics. */ export interface MotionGPUErrorReport { /** * Stable machine-readable category code. */ readonly code: MotionGPUErrorCode; /** * Severity level used by diagnostics UIs and telemetry. */ readonly severity: MotionGPUErrorSeverity; /** * Whether runtime may recover without full renderer re-creation. */ readonly recoverable: boolean; /** * Short category title. */ readonly title: string; /** * Primary human-readable message. */ readonly message: string; /** * Suggested remediation hint. */ readonly hint: string; /** * Additional parsed details (for example WGSL line errors). */ readonly details: readonly string[]; /** * Stack trace lines when available. */ readonly stack: readonly string[]; /** * Original unmodified message. */ readonly rawMessage: string; /** * Runtime phase where the error occurred. */ readonly phase: MotionGPUErrorPhase; /** * Optional source context for shader-related diagnostics. */ readonly source: MotionGPUErrorSource | null; /** * Optional runtime context snapshot (material/pass graph/render targets). */ readonly context: MotionGPUErrorContext | null; } /** Creates an error carrying a stable MotionGPU diagnostic code. */ export declare function createMotionGPUError(code: MotionGPUErrorCode, message: string, options?: ErrorOptions): Error; /** Attaches renderer context without replacing a more specific error or stack. */ export declare function attachMotionGPUErrorContext(error: unknown, context: MotionGPUErrorContext): Error; /** * 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