UNPKG

@motion-core/motion-gpu

Version:

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

56 lines 2.1 kB
import type { MaterialLineMap, MaterialSourceLocation } from './material-preprocess.js'; import type { StorageBufferType, UniformLayout } from './types.js'; type ComputeShaderSourceLocation = { kind: 'compute'; line: number; }; /** * 1-based map from generated WGSL lines to original material source lines. */ export type ShaderLineMap = Array<(MaterialSourceLocation | ComputeShaderSourceLocation) | null>; /** * Result of shader source generation with line mapping metadata. */ export interface BuiltShaderSource { /** * Full WGSL source code. */ code: string; /** * 1-based generated-line map to material source locations. */ lineMap: ShaderLineMap; } /** * Assembles complete WGSL shader source used by the fullscreen renderer pipeline. * * @param fragmentWgsl - User fragment shader code containing `frag(uv: vec2f) -> vec4f`. * @param uniformLayout - Resolved uniform layout. * @param textureKeys - Sorted texture keys. * @param options - Shader build options. * @returns Complete WGSL source for vertex + fragment stages. */ export declare function buildShaderSource(fragmentWgsl: string, uniformLayout: UniformLayout, textureKeys?: string[], options?: { convertLinearToSrgb?: boolean; storageBufferKeys?: string[]; storageBufferDefinitions?: Record<string, { type: StorageBufferType; }>; }): string; /** * Assembles complete WGSL shader source with material-source line mapping metadata. */ export declare function buildShaderSourceWithMap(fragmentWgsl: string, uniformLayout: UniformLayout, textureKeys?: string[], options?: { convertLinearToSrgb?: boolean; fragmentLineMap?: MaterialLineMap; storageBufferKeys?: string[]; storageBufferDefinitions?: Record<string, { type: StorageBufferType; }>; }): BuiltShaderSource; /** * Converts source location metadata to user-facing diagnostics label. */ export declare function formatShaderSourceLocation(location: (MaterialSourceLocation | ComputeShaderSourceLocation) | null): string | null; export {}; //# sourceMappingURL=shader.d.ts.map