/// <reference types="@webgpu/types" />
import type { StorageBufferAccess, StorageBufferType, UniformLayout } from './types.js';
/**
 * Regex contract for compute entrypoint.
 * Matches: @compute @workgroup_size(...) fn compute(
 * with @builtin(global_invocation_id) parameter.
 */
export declare const COMPUTE_ENTRY_CONTRACT: RegExp;
/**
 * Validates compute shader user code matches the compute contract.
 *
 * @param compute - User compute shader WGSL source.
 * @throws {Error} When shader does not match the compute contract.
 */
export declare function assertComputeContract(compute: string): void;
/**
 * Extracts @workgroup_size values from WGSL compute shader.
 *
 * @param compute - Validated compute shader source.
 * @returns Tuple [x, y, z] with defaults of 1 for omitted dimensions.
 */
export declare function extractWorkgroupSize(compute: string): [number, number, number];
/**
 * Builds storage buffer binding declarations for compute shader.
 *
 * @param storageBufferKeys - Sorted buffer keys.
 * @param definitions - Type/access definitions per key.
 * @param groupIndex - Bind group index for storage buffers.
 * @returns WGSL binding declaration string.
 */
export declare function buildComputeStorageBufferBindings(storageBufferKeys: string[], definitions: Record<string, {
    type: StorageBufferType;
    access: StorageBufferAccess;
}>, groupIndex: number): string;
/**
 * Builds storage texture binding declarations for compute shader.
 *
 * @param storageTextureKeys - Sorted storage texture keys.
 * @param definitions - Format definitions per key.
 * @param groupIndex - Bind group index for storage textures.
 * @returns WGSL binding declaration string.
 */
export declare function buildComputeStorageTextureBindings(storageTextureKeys: string[], definitions: Record<string, {
    format: GPUTextureFormat;
}>, groupIndex: number): string;
/**
 * Maps storage texture format to sampled texture scalar type for `texture_2d<T>`.
 */
export declare function storageTextureSampleScalarType(format: GPUTextureFormat): 'f32' | 'u32' | 'i32';
/**
 * Assembles compute shader WGSL for ping-pong workflows.
 *
 * Exposes two generated bindings under group(2):
 * - `${target}A`: sampled read texture (`texture_2d<T>`)
 * - `${target}B`: storage write texture (`texture_storage_2d<format, write>`)
 */
export declare function buildPingPongComputeShaderSource(options: {
    compute: string;
    uniformLayout: UniformLayout;
    storageBufferKeys: string[];
    storageBufferDefinitions: Record<string, {
        type: StorageBufferType;
        access: StorageBufferAccess;
    }>;
    target: string;
    targetFormat: GPUTextureFormat;
}): string;
/**
 * Source location for generated compute shader lines.
 */
export interface ComputeShaderSourceLocation {
    kind: 'compute';
    line: number;
}
/**
 * 1-based line map from generated compute WGSL to user compute source.
 */
export type ComputeShaderLineMap = Array<ComputeShaderSourceLocation | null>;
/**
 * Result of compute shader source generation with line mapping metadata.
 */
export interface BuiltComputeShaderSource {
    code: string;
    lineMap: ComputeShaderLineMap;
}
/**
 * Assembles full compute shader WGSL with preamble.
 *
 * @param options - Compute shader build options.
 * @returns Complete WGSL source for compute stage.
 */
export declare function buildComputeShaderSource(options: {
    compute: string;
    uniformLayout: UniformLayout;
    storageBufferKeys: string[];
    storageBufferDefinitions: Record<string, {
        type: StorageBufferType;
        access: StorageBufferAccess;
    }>;
    storageTextureKeys: string[];
    storageTextureDefinitions: Record<string, {
        format: GPUTextureFormat;
    }>;
}): string;
/**
 * Assembles full compute shader WGSL with source line mapping metadata.
 */
export declare function buildComputeShaderSourceWithMap(options: {
    compute: string;
    uniformLayout: UniformLayout;
    storageBufferKeys: string[];
    storageBufferDefinitions: Record<string, {
        type: StorageBufferType;
        access: StorageBufferAccess;
    }>;
    storageTextureKeys: string[];
    storageTextureDefinitions: Record<string, {
        format: GPUTextureFormat;
    }>;
}): BuiltComputeShaderSource;
/**
 * Assembles ping-pong compute shader WGSL with source line mapping metadata.
 */
export declare function buildPingPongComputeShaderSourceWithMap(options: {
    compute: string;
    uniformLayout: UniformLayout;
    storageBufferKeys: string[];
    storageBufferDefinitions: Record<string, {
        type: StorageBufferType;
        access: StorageBufferAccess;
    }>;
    target: string;
    targetFormat: GPUTextureFormat;
}): BuiltComputeShaderSource;
//# sourceMappingURL=compute-shader.d.ts.map