demo · v131

WebGPU clip-distances

A new optional feature lets vertex shaders write user-defined clip distances. This page renders a quad clipped by a movable half-plane using clip_distances. Drag the slider to slide the clip plane and watch geometry disappear cleanly.

0.00
probing WebGPU…

the api

const device = await adapter.requestDevice({ requiredFeatures: ["clip-distances"] });

// WGSL
struct VOut {
  @builtin(position)        pos: vec4<f32>,
  @builtin(clip_distances)  cd:  array<f32, 1>,
};

see also