simvx.graphics.renderer.hiz_pass

Hi-Z depth pyramid build pass (occlusion-culling phase O2).

Builds a hierarchical depth pyramid from the HDR target’s D32 depth buffer: mip0 is a 1:1 copy of the scene depth, and each successive mip is a conservative MAX reduction (farthest occluder, standard 0..1 depth) over the previous mip’s 2x2 footprint. The pyramid is consumed later (O3) by a compute occlusion cull; this phase only builds and validates it.

The pass is fully gated by Renderer._occlusion_culling_enabled: it is lazily created on the first frame the toggle is on (mirroring VelocityPass), so with occlusion off nothing here is allocated or dispatched.

Resource/descriptor approach mirrors :class:SSAOPass: a compute pass that samples the samplable D32 depth target in DEPTH_STENCIL_READ_ONLY_OPTIMAL.

Module Contents

Classes

HiZPass

Builds a Hi-Z (hierarchical max-depth) pyramid via per-mip compute dispatches.

Functions

hiz_mip_count

Number of mip levels in the Hi-Z pyramid for the given base extent.

hiz_mip_sizes

Per-mip (w, h) dimensions, each (max(1, w>>i), max(1, h>>i)).

Data

API

simvx.graphics.renderer.hiz_pass.__all__

[‘HiZPass’, ‘hiz_mip_count’, ‘hiz_mip_sizes’]

simvx.graphics.renderer.hiz_pass.log

‘getLogger(…)’

simvx.graphics.renderer.hiz_pass.hiz_mip_count(width: int, height: int) int[source]

Number of mip levels in the Hi-Z pyramid for the given base extent.

floor(log2(max(w, h))) + 1 so the top mip is 1x1.

simvx.graphics.renderer.hiz_pass.hiz_mip_sizes(width: int, height: int) list[tuple[int, int]][source]

Per-mip (w, h) dimensions, each (max(1, w>>i), max(1, h>>i)).

class simvx.graphics.renderer.hiz_pass.HiZPass(engine: Any)[source]

Builds a Hi-Z (hierarchical max-depth) pyramid via per-mip compute dispatches.

Initialization

property mip_count: int[source]
property image: Any[source]

The Hi-Z R32F mip-chain image (for O3 readers / test readback).

property sampled_view: Any[source]

Full-mip-chain sampled view (for the O3 occlusion cull’s textureLod).

property sampler: Any[source]

The NEAREST/CLAMP sampler shared by the build and the O3 cull.

property base_extent: tuple[int, int][source]

Base (mip0) extent (width, height) of the pyramid.

setup(width: int, height: int, depth_view: Any, depth_image: Any) None[source]

Allocate the pyramid image, per-mip views, sampler, descriptors and pipeline.

render(cmd: Any) None[source]

Build the full pyramid: dispatch the reduction once per mip.

Call after the HDR pass has produced depth (depth in DEPTH_STENCIL_READ_ONLY_OPTIMAL). A pure depth reduction: no camera matrices.

resize(width: int, height: int, depth_view: Any, depth_image: Any) None[source]

Recreate the pyramid for a new extent and re-write descriptors.

cleanup() None[source]