---
title: "Builtin values, the TypeShade language reference for shaders"
description: "The 18 ids of `builtin<N>`, the values the pipeline hands a shader or takes back from it, each with the type WGSL fixes for it and the stage it belongs to."
url: https://typeshade.dev/reference/builtin-values/
language: en
---

# Builtin values

18 names

The ids `builtin<N>` names, with the stage each belongs to.

The signature, the sentence and any message are the compiler's own text at commit af54ddad5.

**[`@builtin("vertex_index")`](https://typeshade.dev/reference/builtin-values/vertex_index/)**

The index of the current vertex within its draw call.

**[`@builtin("instance_index")`](https://typeshade.dev/reference/builtin-values/instance_index/)**

The index of the current instance within its draw call.

**[`@builtin("position")`](https://typeshade.dev/reference/builtin-values/position/)**

The vertex's clip-space position (vertex output) or the fragment's window-space position (fragment input).

**[`@builtin("front_facing")`](https://typeshade.dev/reference/builtin-values/front_facing/)**

Whether the current fragment belongs to a front-facing primitive.

**[`@builtin("frag_depth")`](https://typeshade.dev/reference/builtin-values/frag_depth/)**

Overrides the fragment's depth value.

**[`@builtin("sample_index")`](https://typeshade.dev/reference/builtin-values/sample_index/)**

The index of the sample currently being processed, under multisampling.

**[`@builtin("sample_mask")`](https://typeshade.dev/reference/builtin-values/sample_mask/)**

The set of samples covered by the current fragment invocation.

**[`@builtin("primitive_index")`](https://typeshade.dev/reference/builtin-values/primitive_index/)**

The index of the primitive the current fragment belongs to.

**[`@builtin("local_invocation_id")`](https://typeshade.dev/reference/builtin-values/local_invocation_id/)**

The current invocation's id within its workgroup, as a 3-component vector.

**[`@builtin("local_invocation_index")`](https://typeshade.dev/reference/builtin-values/local_invocation_index/)**

The current invocation's flattened index within its workgroup.

**[`@builtin("global_invocation_id")`](https://typeshade.dev/reference/builtin-values/global_invocation_id/)**

The current invocation's id across the entire compute dispatch.

**[`@builtin("workgroup_id")`](https://typeshade.dev/reference/builtin-values/workgroup_id/)**

The id of the current invocation's workgroup within the dispatch.

**[`@builtin("num_workgroups")`](https://typeshade.dev/reference/builtin-values/num_workgroups/)**

The number of workgroups dispatched, as given to the dispatch call.

**[`@builtin("subgroup_invocation_id")`](https://typeshade.dev/reference/builtin-values/subgroup_invocation_id/)**

The current invocation's index within its subgroup.

**[`@builtin("subgroup_size")`](https://typeshade.dev/reference/builtin-values/subgroup_size/)**

The number of invocations in the current subgroup.

**[`@builtin("subgroup_id")`](https://typeshade.dev/reference/builtin-values/subgroup_id/)**

The current subgroup's index within its workgroup.

**[`@builtin("num_subgroups")`](https://typeshade.dev/reference/builtin-values/num_subgroups/)**

The number of subgroups in the current workgroup.

**[`@builtin("clip_distances")`](https://typeshade.dev/reference/builtin-values/clip_distances/)**

Per-vertex clip distances against the pipeline's enabled user clip planes: a vertex output of `array<f32, N>` with N from 1 to 8.

Names, declarations and descriptions come from the compiler language-service tables at the pinned commit. Builtin output spellings and stage rules are read from compiler code. The site supplies the groupings and explanations around these entries.
