Interface DepthPyramid
mipCount: number;
texture: Texture2D;
build(depthTexture: Texture2D, encoder?: GPUCommandEncoder): void;
dispose(): void;
resize(width: number, height: number): void;
}
Properties
Readonlymip Count
Number of mip levels in the current pyramid.
Readonlytexture
r32float, full mip chain, nearest sampler. Bind to a material; read textureLoad(tex, coord, mip).
A resize() replaces this wrapper (new identity) — re-read it and re-bind after a resize.
Methods
build
-
Re-derive the pyramid from
depthTexture(atexture_depth_2dof matching mip-0 size). Pass the frameencoderto record the COPY/REDUCE passes in-frame (e.g. after a depth prepass, before the consumer that samples the pyramid); omit it to run on a private encoder + submit immediately.Parameters
- depthTexture: Texture2D
Optionalencoder: GPUCommandEncoder
Returns void
dispose
-
Release the pyramid's base texture ref (frees the GPU texture once no consumer holds it).
Returns void
resize
-
Reallocate the pyramid texture at a new mip-0 size (call when the source depth target resizes). No-op if unchanged. Mint a new
texturewrapper on a real change; safe to call any time (does not destroy the old texture while a consumer still references it).Parameters
- width: number
- height: number
Returns void
A rebuildable hierarchical depth pyramid. Create with
createDepthPyramid; drive its per-frame build withcreateDepthPyramidTask(in-frame) or by callingbuild()yourself.