linear_indexing
WGSL language feature
Specification: WGSL § linear_indexing
Check navigator.gpu?.wgslLanguageFeatures?.has('linear_indexing')
before choosing a shader that uses this language feature. It is available automatically
when supported; requires linear_indexing; documents the dependency
and rejects the shader on unsupported implementations. This language token is not a
requiredFeatures entry for requestDevice(); any additional
device requirements are described below.
Compute entry points can declare @builtin(workgroup_index) and @builtin(global_invocation_index) as u32 inputs. They provide linear numbering of workgroups and invocations, complementing the three-component workgroup_id and global_invocation_id built-ins.
Flat buffers and image-processing kernels often need one index per invocation. The global index flattens global_invocation_id across the whole dispatch, with x varying fastest. The workgroup index similarly flattens workgroup_id. For multidimensional workgroups, grouping all invocations of one workgroup together would give a different ordering from this global index.
A fallback can compute global_invocation_id.x + global_invocation_id.y * dispatchWidth + global_invocation_id.z * dispatchWidth * dispatchHeight, where the dispatch width and height are the corresponding workgroup dimensions multiplied by the dispatched workgroup counts. These indices do not specify execution order. Bounds-check accesses when the dispatched invocation count exceeds the number of elements to process.
Availability by month
| Month | With feature | Eligible reports | Availability |
|---|---|---|---|
| 2026-08 | 67 | 106 | 63.2% |
| 2026-09 | 23 | 36 | 63.9% |
By browser (last 30 days)
| Browser | Availability | n |
|---|---|---|
| chrome | 91.1% | 90 |
| edge | 100.0% | 8 |
| firefox | 0.0% | 44 |
Availability = share of first-party, non-quarantined reports with WebGPU on a hardware
(non-fallback) adapter
whose browser reports this token in navigator.gpu.wgslLanguageFeatures.
This measures language support in the browser, not a GPU hardware capability.
Developer-leaning sample.
Full methodology.