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
-
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) asvec2u(triangleId, depthBits), runningatomicMinacross overlapping triangles with a live WebGPUadapter.features.has('atomic-vec2u-min-max')probe and bit-exact 64-bit(hi, lo)comparison readout. -
WGSL vec2u 64-bit word-order & endian inspector
Interactive 64-bit
vec2ubit-layout inspector demonstrating why.yis the most-significant 32-bit word (the sort key) and.xis the least-significant 32-bit word (the tie-breaker payload) inatomic<vec2u>, with live(depth, payload)sliders, reversed-component hazard detection, and WGSL code generation. -
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/atomicMaxonatomic<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
- Exact WebGPU IDL surface:
GPUFeatureNameenum value"atomic-vec2u-min-max"checked viaadapter.features.has("atomic-vec2u-min-max")and requested inadapter.requestDevice({ requiredFeatures: ["atomic-vec2u-min-max"] }). - Exact WGSL surface:
enable atomic_vec2u_min_max;enablingatomicMin(&target, vec2u(lo, hi))andatomicMax(&target, vec2u(lo, hi))on storage buffer variables of typeatomic<vec2u>. - Word significance contract: The 64-bit unsigned integer value represented by
v: vec2uis(u64(v.y) << 32) | u64(v.x)— meaningv.yis the high 32 bits (primary comparison key) andv.xis the low 32 bits (payload / tie-breaker). - Runtime flags: Enable in Chrome 156+ / Canary via
--enable-unsafe-webgpuor--enable-dawn-features=atomic_vec2u_min_maxwhen testing on supported Vulkan/D3D12/Metal GPUs.