///
import { HasReactive } from "@reactively/decorate";
import { BinOpModule } from "../util/BinOpModules.js";
import { Cache, ComposableShader, ValueOrFn } from "../util/Util.js";
/** @internal */
export interface WorkgroupScanArgs {
device: GPUDevice;
source: ValueOrFn;
emitBlockSums?: ValueOrFn;
forceWorkgroupLength?: ValueOrFn;
forceMaxWorkgroups?: ValueOrFn;
label?: ValueOrFn;
binOps?: ValueOrFn;
exclusiveSmall?: boolean;
initialValue?: ValueOrFn;
sourceOffset?: ValueOrFn;
scanOffset?: ValueOrFn;
blockSumsOffset?: ValueOrFn;
pipelineCache?: () => Cache;
}
/**
* Prefix scan operation on workgroup sized blocks of data.
*
* Internally allocates an output buffer for the prefix scan results.
* The output buffer will be the same dimensions as the input buffer.
*
* Optionally allocates a block level summary buffer, containing
* one summariy entry per input block.
*
* @internal
*/
export declare class WorkgroupScan extends HasReactive implements ComposableShader {
/** source data to be scanned. Data element format should match the binOps module. */
source: GPUBuffer;
/** macros to customize wgsl shader for size of data and type of scan */
binOps: BinOpModule;
/** emit the final value of each block into a separate output buffer. (true) */
emitBlockSums: boolean;
/** Debug label attached to gpu objects for error reporting */
label: string;
/** an exclusive scan that fits entirely in one workgroup. (false) */
exclusiveSmall: boolean;
/** initial value for exclusive scans */
initialValue: number;
/** start scan at this element offset in the source. (0) */
sourceOffset: number;
/** emit results at this element offset in the destination buffer. (0) */
scanOffset: number;
/** emit block results at this element offset in the blocksums destination buffer (0) */
blockSumsOffset: number;
/** Override to set compute workgroup size e.g. for testing.
@defaultValue maxComputeInvocationsPerWorkgroup of the `GPUDevice`
*/
forceWorkgroupLength?: number;
/** Override to set max number of workgroups for dispatch e.g. for testing.
@defaultValue maxComputeWorkgroupsPerDimension from the `GPUDevice`
*/
forceMaxWorkgroups?: number;
private device;
private pipelineCache?;
private usageContext;
constructor(params: WorkgroupScanArgs);
commands(commandEncoder: GPUCommandEncoder): void;
destroy(): void;
/** Buffer combining the last element from each workgroups partial scan
* For use in combining scans that are larger than one workgroup. */
get blockSums(): GPUBuffer;
get debugBuffer(): GPUBuffer;
/** Return enough dispatches to cover the source
* (multiple dispatches are needed for large sources) */
private get dispatchSizes();
private get maxWorkgroups();
private get registry();
private get pipeline();
private get bindGroups();
private createBindGroup;
get sourceSize(): number;
get prefixScan(): GPUBuffer;
private get uniforms();
private uniformsBuffer;
private updateUniforms;
private writeUniforms;
private get workgroupLength();
}