UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

96 lines (95 loc) 3.74 kB
/** * @import { GraphicsDevice } from '../../platform/graphics/graphics-device.js' * @import { Texture } from '../../platform/graphics/texture.js' */ /** * Render pass that reorders elements using binary search through mipmap hierarchy * (Pass 1 of radix sort). Uses MRT to output both keys (R32U) and indices (R32U). * * Has multiple variants: * - sourceLinear=true: First pass, reads keys from user's linear-layout texture * - sourceLinear=false: Subsequent passes, reads keys from internal Morton-layout texture * - outputLinear=true: Outputs indices in linear layout (simpler for consumers) * * @category Graphics * @ignore */ export class RenderPassRadixSortReorder extends RenderPassShaderQuad { /** * @param {GraphicsDevice} device - The graphics device. * @param {boolean} sourceLinear - Whether to read from linear-layout source texture. * @param {boolean} outputLinear - Whether to output indices in linear layout. * @param {number} bitsPerStep - Bits per radix step (usually 4). * @param {number} groupSize - Log2 of group size (usually 4 for 16 elements). * @param {number} currentBit - Current bit offset for this pass. */ constructor(device: GraphicsDevice, sourceLinear: boolean, outputLinear: boolean, bitsPerStep: number, groupSize: number, currentBit: number); /** * Whether this pass reads from linear-layout source texture (first pass). */ sourceLinear: boolean; /** * Whether to output indices in linear layout. */ outputLinear: boolean; /** * Bits per radix step (usually 4). */ bitsPerStep: number; /** * Log2 of group size (usually 4 for 16 elements). */ groupSize: number; /** * Current bit offset for this pass. */ currentBit: number; /** * Dynamic params updated per frame. * * @type {{elementCount: number, imageElementsLog2: number, imageSize: number}} * @private */ private _dynamicParams; keysTextureId: import("../../index.js").ScopeId; indicesTextureId: import("../../index.js").ScopeId; prefixSumsId: import("../../index.js").ScopeId; bitsPerStepId: import("../../index.js").ScopeId; groupSizeId: import("../../index.js").ScopeId; elementCountId: import("../../index.js").ScopeId; imageElementsLog2Id: import("../../index.js").ScopeId; currentBitId: import("../../index.js").ScopeId; imageSizeId: import("../../index.js").ScopeId; /** * Sets the keys texture to read from. * * @param {Texture} keysTexture - The keys texture (R32U). */ setKeysTexture(keysTexture: Texture): void; _keysTexture: Texture; /** * Sets the indices texture to read from. * * @param {Texture} indicesTexture - The indices texture (R32U). */ setIndicesTexture(indicesTexture: Texture): void; _indicesTexture: Texture; /** * Sets the prefix sums texture. * * @param {Texture} prefixSums - The prefix sums texture (R32F with mipmaps). */ setPrefixSumsTexture(prefixSums: Texture): void; _prefixSums: Texture; /** * Sets dynamic parameters (called each frame). * * @param {number} elementCount - Number of elements to sort. * @param {number} imageElementsLog2 - Log2 of total texture elements. * @param {number} imageSize - Size of the internal texture (power of 2). */ setDynamicParams(elementCount: number, imageElementsLog2: number, imageSize: number): void; } import { RenderPassShaderQuad } from './render-pass-shader-quad.js'; import type { Texture } from '../../platform/graphics/texture.js'; import type { GraphicsDevice } from '../../platform/graphics/graphics-device.js';