v156 · webgpu atomic-vec2u-min-max · visibility buffer

64-bit depth + ID visibility buffer

In software rasterization (like Nanite-style micro-polygon compute passes), every fragment writes both a 32-bit depth key and a 32-bit triangle/instance ID. Packing vec2u(triangleId, depthBits) places depthBits in the high 32-bit word (.y) and triangleId in the low 32-bit word (.x). A single atomicMin(&visBuffer[pixel], packedVec2u) atomically retains the closest triangle and its ID.

Overlapping triangle visibility rasterizer

WGSL compute kernel

Center overlap pixel (4, 4) — 64-bit atomic<vec2u> contenders
candidate .y (hi 32-bit depthBits) .x (lo 32-bit triangleId) 64-bit unsigned value outcome

references