///
import { HasReactive } from "@reactively/decorate";
import { Cache, ComposableShader, ValueOrFn, Vec2 } from "thimbleberry";
import { BinOpModule } from "../util/BinOpModules.js";
import { ComponentName, LoadComponent } from "../util/GenerateLoadTexel.js";
export interface TextureToBufferParams {
device: GPUDevice;
/**
* Source data to be reduced.
*
* A function returning the source buffer will be executed lazily,
* and reexecuted if the function's `@reactively` source values change.
*/
source: ValueOrFn;
/** {@inheritDoc ReduceTextureToBuffer#binOps} */
binOps: BinOpModule;
/** {@inheritDoc ReduceTextureToBuffer#blockSize} */
blockSize?: Vec2;
/** {@inheritDoc ReduceTextureToBuffer#forceWorkgroupSize} */
forceWorkgroupSize?: Vec2;
/** {@inheritDoc ReduceTextureToBuffer#loadComponent} */
loadComponent?: LoadComponent;
/** {@inheritDoc ReduceTextureToBuffer#componentName} */
componentName?: ComponentName;
/** cache for GPUComputePipeline */
pipelineCache?: () => Cache;
/** {@inheritDoc ReduceTextureToBuffer#label} */
label?: string;
}
/** reduce a gpu texture to a buffer by running binary operations over elements.
* Each workgroup thread reduces a blockSize group of elements to one element,
* and each dispatch reduces the workgroup elements to one element.
*/
export declare class ReduceTextureToBuffer extends HasReactive implements ComposableShader {
/** Source texture to be reduced */
source: GPUTexture;
/** macros to customize wgsl shader for size of data and type of reduce*/
binOps: BinOpModule;
/** macros to select component from vec4 */
loadComponent: LoadComponent;
/** select r, g, b, a*/
componentName: ComponentName;
/** Debug label attached to gpu objects for error reporting */
label?: string;
/** number of elements to reduce in each invocation (4) */
blockSize: Vec2;
/** Override to set compute workgroup size e.g. for testing. */
forceWorkgroupSize: Vec2;
private device;
private pipelineCache?;
private usageContext;
constructor(params: TextureToBufferParams);
commands(commandEncoder: GPUCommandEncoder): void;
destroy(): void;
/** results of the reduction from frame to service */
get reducedResult(): GPUBuffer;
/** number of elements in the result buffer */
get resultElems(): number;
get debugBuffer(): GPUBuffer;
private get sampleType();
private get registry();
private pipeline;
private get uniformBuffer();
private get dispatchSize();
private get workgroupSize();
private bindGroup;
}