v156 · webgpu · wgsl compute

WebGPU: atomic-vec2u-min-max

Software visibility buffers, GPU point-cloud splatting, and key-value reduction kernels need to compare a 32-bit sort key (like Z-depth) and update an associated 32-bit payload (like a triangle ID or RGBA8 color) in a single atomic transaction. Chrome 156 ships the WebGPU adapter feature "atomic-vec2u-min-max" and WGSL extension enable atomic_vec2u_min_max;, unlocking hardware 64-bit atomicMin and atomicMax on atomic<vec2u> where .y holds the most-significant 32 bits and .x holds the least-significant 32 bits.

concepts

  1. 64-bit depth + ID visibility buffer

    Interactive 64-bit visibility buffer rasterizer packing 32-bit Z-depth into .y (high word) and 32-bit triangle ID into .x (low word) as vec2u(triangleId, depthBits), running atomicMin across overlapping triangles with a live WebGPU adapter.features.has('atomic-vec2u-min-max') probe and bit-exact 64-bit (hi, lo) comparison readout.

  2. WGSL vec2u 64-bit word-order & endian inspector

    Interactive 64-bit vec2u bit-layout inspector demonstrating why .y is the most-significant 32-bit word (the sort key) and .x is the least-significant 32-bit word (the tie-breaker payload) in atomic<vec2u>, with live (depth, payload) sliders, reversed-component hazard detection, and WGSL code generation.

  3. Point-cloud splatting & CAS contention analyzer

    Interactive point-cloud splatting and HDR reduction analyzer comparing 32-bit Compare-And-Swap (CAS) spin-loops against single-instruction 64-bit atomicMin/atomicMax on atomic<vec2u> across varying overdraw contention ratios.

why it shipped

Without 64-bit atomics, WebGPU compute shaders rendering tiny triangles or splatting dense LiDAR/Gaussian point clouds had to either allocate two separate 32-bit buffers (causing race conditions between the depth test and color/ID write) or pack a reduced 16-bit depth + 16-bit payload into a single atomic<u32> (causing severe Z-fighting). By exposing 64-bit unsigned integer min/max as atomic<vec2u> in WGSL — without requiring full 64-bit scalar u64 arithmetic everywhere in the shading language — WebGPU unlocks lock-free, full-precision 32-bit depth + 32-bit payload rasterization.

research record — use cases & exact surface

references