API

Class FrameGraphMinMaxReducerTask

Task which computes the minimum and maximum values in the red channel of a frame graph texture, or in the depth aspect of a WebGPU depth/stencil attachment. Set sourceTexture to a handle from an earlier task (for example, a geometry renderer's geometryNormViewDepthTexture) to reuse its output without rendering another depth map. The reduction is performed on each graph execution.

Hierarchy (View Summary)

Index
dependencies?: Set<FrameGraphTextureHandle>

The (texture) dependencies of the task (optional).

depthRedux: boolean = false

Whether to ignore the clear value of a depth-as-color texture during reduction (default: false). For normalized view or forward screen depth, the clear value is 1; for view depth or reverse screen depth, it is 0. Always enabled for a depth/stencil attachment, which stores screen depth.

depthTextureType: any = DepthTextureType.NormalizedViewDepth

The type of depth values stored in the source texture when depthRedux is true (default: normalized view depth).

onAfterTaskExecute: Observable<FrameGraphTask> = ...

An observable that is triggered after the task is executed.

onBeforeTaskExecute: Observable<FrameGraphTask> = ...

An observable that is triggered before the task is executed.

onTexturesAllocatedObservable: Observable<FrameGraphRenderContext> = ...

An observable that is triggered after the textures have been allocated.

outputTexture: FrameGraphTextureHandle

The 1x1 RG texture containing the minimum in red and maximum in green.

sourceTexture: FrameGraphTextureHandle

The 2D texture to reduce. If generated by a graph task, that task must execute before this one. WebGPU can reduce the depth aspect of a single-sampled depth/stencil attachment; backbuffer depth, stencil-only attachments and integer color formats are not supported.

textureType: any = Constants.TEXTURETYPE_HALF_FLOAT

The type of the intermediate and output textures (default: half float). Supported types are FLOAT, HALF_FLOAT, and UNSIGNED_BYTE.

  • This function is called once after the task has been added to the frame graph and before the frame graph is built for the first time. This allows you to initialize asynchronous resources, which is not possible in the constructor.

    Returns Promise<unknown>

    A promise that resolves when the initialization is complete.