primitive-index

Availability now
81%
last 30 days, n = 180
Year over year
—
unlocks once the dataset spans a year
Explore

Request primitive-index on the device, add enable primitive_index; to WGSL, and declare a fragment input with @builtin(primitive_index). The resulting u32 identifies the input primitive within the draw. It is a primitive number, not a vertex-buffer index or an index-buffer value.

A visibility-buffer renderer can store this value and use it later to retrieve triangle data, while other engines can use it for per-face material or debug information. The built-in avoids duplicating a triangle identifier across vertices solely to pass it through the vertex shader.

Primitive indices repeat across instances and restart for each draw, so combine them with your own draw or instance identity when you need a scene-wide key. Without this feature, pass a flat per-primitive identifier from the vertex shader using suitably prepared geometry, or structure draw calls so a separate binding identifies the relevant data.

Availability by month

MonthWith featureEligible reportsAvailability
2026-08 156 238 65.5%
2026-09 141 175 80.6%
2026-10 79 102 77.5%

By browser (last 30 days)

BrowserAvailabilityn
chrome 95.8% 120
edge 95.2% 21
firefox 0.0% 18
safari 53.3% 15
opera 100.0% 1

Availability = share of first-party, non-quarantined reports with WebGPU on a hardware (non-fallback) adapter that expose this feature. Developer-leaning sample. Full methodology.