Add the stage-2 compute chain to the main frame:
- ComputePass wrapper + compile script for compute SPIR-V (hzb_build /
gpu_cull / gpu_emit); bindless set extended with cull UBO, visible flags,
compacted instances, indirect commands, HZB buffer and GBuffer depth.
- HZB: R32F max-downsampled mip chain per frame slot built from the
GBuffer depth after the GBuffer pass (buffer-based; offsets header at slot
start). Same-frame self-occlusion handled by testing the bounding sphere's
FRONT depth, and near-zero depth (uninitialized/corner garbage) never
occludes.
- Cull: per-instance Gribb-Hartmann frustum test + HZB occlusion test, flags
written per instance; emit compacts visible instances per CPU-provided
bucket layout and fills per-bucket indirect commands with atomic counters.
- Frame wiring: begin3DFrame defers opening the scene color pass when the
cull chain is live, so the compute section records before the opaque
draws; RenderSystem3D uploads sorted instances, runs cull+emit, opens the
pass and draws with GPU-written commands (per-bucket, empty buckets no-op).
Fallback to stage 1 when compute caps are missing. gpuDriven now forces
the GBuffer pass (HZB source).
- Known limitation: HZB is built from the same-frame GBuffer, so objects
already in the GBuffer cannot be occlusion-culled until the GBuffer itself
is culled (stage 3 vis buffer); the chain is verified with frustum culling
(2 of 5 instances culled) and pixel parity.
Tests: GpuDriven.opaqueForwardCullParity (5 spheres, 2 outside frustum ->
3 visible / 3 non-empty buckets, pixel parity < 0.03); all 6 GpuDriven
tests pass (integrated GPU; the AMD driver intermittently crashes at
vkCreateImage during init - environmental).