import type { RenderPipelineShaders } from "./types.js"; /** * Unfold either shader form into per-stage sources: a combined `shader` becomes * the same string on both stages, so the two spellings share cache entries. An * undefined fragment means a pipeline with no fragment stage. */ export declare const resolveShaders: (shaders: RenderPipelineShaders) => { vertex: string; fragment: string | undefined; }; interface RenderPipelineSourceState extends GPUObjectDescriptorBase, Partial> { /** * Entry points default to the first `@vertex`/`@fragment` function in the * source. */ vertexEntryPoint?: string; fragmentEntryPoint?: string; buffers?: GPUVertexBufferLayout[]; targets?: GPUColorTargetState[]; /** WGSL pipeline-overridable constants, applied to both stages. */ constants?: GPUProgrammableStage["constants"]; /** A stable cache key, required alongside a non-"auto" layout. */ layoutKey?: string; } /** * Render pipeline description with WGSL sources instead of shader modules, so * descriptors stay serializable and cacheable. `layout` defaults to "auto". */ export type RenderPipelineSource = RenderPipelineSourceState & RenderPipelineShaders; /** Compute counterpart of {@link RenderPipelineSource}. */ export interface ComputePipelineSource extends GPUObjectDescriptorBase, Pick, Partial> { compute: string; /** A stable cache key, required alongside a non-"auto" layout. */ layoutKey?: string; } /** * Caches shader modules by source and pipelines by their full descriptor, so * lazily-created pipelines are compiled once per unique state/format * combination. One cache per context; no global registry. * * Pipelines are keyed by nested maps on the source strings themselves rather * than content hashes: lookups never walk the (potentially large) WGSL source * and keys cannot collide. */ export declare class PipelineCache { #private; constructor(device: GPUDevice); get size(): number; /** * Get (or create and cache) a shader module. Compilation diagnostics are * reported asynchronously and identically across browsers: the validation * error is captured in an error scope (Chrome logs uncaptured ones with its * own formatting, Safari not at all) and getCompilationInfo() messages are * formatted with the offending source line and a caret. Reporting never * blocks module creation, and runs once per unique source. */ getShaderModule(code: string, label?: string): GPUShaderModule; /** * Whether a pipeline from this cache failed validation. Known asynchronously: * false until its error scope resolves, so the first submits using it are * already encoded. */ hasFailed(pipeline: GPURenderPipeline | GPUComputePipeline): boolean; getRenderPipeline(source: RenderPipelineSource): GPURenderPipeline; getComputePipeline(source: ComputePipelineSource): GPUComputePipeline; clear(): void; } export {}; //# sourceMappingURL=pipeline-cache.d.ts.map