---
title: "vertex: attribute in the TypeShade language reference"
description: "vertex, an attribute in the TypeShade language reference. Marks the pipeline's vertex-stage entry point, on the function declaration…"
url: https://typeshade.dev/reference/attributes/vertex/
language: en
---

# `@vertex`

Attribute

Marks the pipeline's vertex-stage entry point, on the function declaration: `@vertex export function vs(…) { … }`.

`@vertex` makes the function it marks the entry point of the vertex stage. The GPU calls it once per vertex of a draw.

## Compare examples

Compare the three vertices of one triangle. Each call reads its own vertex index and returns its own position.

**Example program**`@vertex export function vs(i: builtin<"vertex_index">): vec4 { return vec4(f32(i) - 1., 0., 0., 1.); }`

**Example 1`i = 0`**

**Result**

`vec4(-1, 0, 0, 1)`

**Example 2`i = 1`**

**Result**

`vec4(0, 0, 0, 1)`

**Example 3`i = 2`**

**Result**

`vec4(1, 0, 0, 1)`

The examples are calculation models and do not run GPU work. The reference below gives the syntax of the attribute. Decimal results are rounded for display. The stated assumptions determine each example; actual shader results follow the target precision and execution rules.

## When to use it

Use it for the function that places each vertex in clip space and passes values on to the fragment stage.

## Inputs and limits

Write it before a top-level function declaration; the entry takes the name of the declaration. A vertex entry must produce a position: a `vec4` return, or a struct field typed builtin<"position">.

For shader input rules and precision, consult [WGSL](https://www.w3.org/TR/WGSL/) and [GLSL ES 3.00](https://registry.khronos.org/OpenGL/specs/es/3.0/GLSL_ES_Specification_3.00.pdf).

## Related attributes

- [`@fragment`](https://typeshade.dev/reference/attributes/fragment/)
- [`@compute`](https://typeshade.dev/reference/attributes/compute/)

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

## Syntax

```ts
declare function vertex(target: Function, context?: unknown): void
```

## Parameters

This decorator is written on its own and takes no arguments.

The declaration also names what the TypeScript decorator runtime hands a decorator, `target` and `context`. A call passes neither.

## Description

The entry takes the function's name.

## Examples

- [`gallery/capsule-corp-namek-class/capsule-corp-namek-class.shade.ts`](https://typeshade.dev/guide/examples/capsule-corp-namek-class/)
- [`gallery/domain-warp-twin/domain-warp-twin.shade.ts`](https://typeshade.dev/guide/examples/domain-warp-twin/)
- [`gallery/hillshade-twin/hillshade-twin.shade.ts`](https://typeshade.dev/guide/examples/hillshade-twin/)
- [`gallery/julia-twin/julia-twin.shade.ts`](https://typeshade.dev/guide/examples/julia-twin/)
- [`gallery/kaleidoscope-twin/kaleidoscope-twin.shade.ts`](https://typeshade.dev/guide/examples/kaleidoscope-twin/)
- [`gallery/mandelbrot-twin/mandelbrot-twin.shade.ts`](https://typeshade.dev/guide/examples/mandelbrot-twin/)
- [`gallery/ocean-twin/ocean-twin.shade.ts`](https://typeshade.dev/guide/examples/ocean-twin/)
- [`gallery/path-tracer/path-tracer.shade.ts`](https://typeshade.dev/guide/examples/path-tracer/)
- [`gallery/plasma-twin/plasma-twin.shade.ts`](https://typeshade.dev/guide/examples/plasma-twin/)
- [`gallery/rt-renderer-class/rt-renderer-class.shade.ts`](https://typeshade.dev/guide/examples/rt-renderer-class/)
- [`gallery/starfield-twin/starfield-twin.shade.ts`](https://typeshade.dev/guide/examples/starfield-twin/)
- [`gallery/tunnel-twin/tunnel-twin.shade.ts`](https://typeshade.dev/guide/examples/tunnel-twin/)
- [`gallery/voronoi-twin/voronoi-twin.shade.ts`](https://typeshade.dev/guide/examples/voronoi-twin/)
- [`gallery/fp64-burning-ship-twin/fp64-burning-ship-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-burning-ship-twin/)
- [`gallery/fp64-cancellation-twin/fp64-cancellation-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-cancellation-twin/)
- [`gallery/fp64-checker-plane-twin/fp64-checker-plane-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-checker-plane-twin/)
- [`gallery/fp64-clock-twin/fp64-clock-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-clock-twin/)
- [`gallery/fp64-deep-zoom-twin/fp64-deep-zoom-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-deep-zoom-twin/)
- [`gallery/fp64-julia-twin/fp64-julia-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-julia-twin/)
- [`gallery/fp64-lane-stripes/fp64-lane-stripes.shade.ts`](https://typeshade.dev/guide/examples/fp64-lane-stripes/)
- [`gallery/fp64-loran-twin/fp64-loran-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-loran-twin/)
- [`gallery/fp64-mandelbrot-de-twin/fp64-mandelbrot-de-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-mandelbrot-de-twin/)
- [`gallery/fp64-newton-twin/fp64-newton-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-newton-twin/)
- [`gallery/fp64-rtc-twin/fp64-rtc-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-rtc-twin/)
- [`gallery/fp64-sine-sweep-twin/fp64-sine-sweep-twin.shade.ts`](https://typeshade.dev/guide/examples/fp64-sine-sweep-twin/)
- [`gallery/array-literal-ramp/array-literal-ramp.shade.ts`](https://typeshade.dev/guide/examples/array-literal-ramp/)
- [`gallery/array-methods/array-methods.shade.ts`](https://typeshade.dev/guide/examples/array-methods/)
- [`gallery/bare-position/bare-position.shade.ts`](https://typeshade.dev/guide/examples/bare-position/)
- [`gallery/bit-bump/bit-bump.shade.ts`](https://typeshade.dev/guide/examples/bit-bump/)
- [`gallery/bitfield-bands/bitfield-bands.shade.ts`](https://typeshade.dev/guide/examples/bitfield-bands/)
- [`gallery/block-scope/block-scope.shade.ts`](https://typeshade.dev/guide/examples/block-scope/)
- [`gallery/bool-select/bool-select.shade.ts`](https://typeshade.dev/guide/examples/bool-select/)
- [`gallery/class-builder/class-builder.shade.ts`](https://typeshade.dev/guide/examples/class-builder/)
- [`gallery/class-parts/class-parts.shade.ts`](https://typeshade.dev/guide/examples/class-parts/)
- [`gallery/class-syntax/class-syntax.shade.ts`](https://typeshade.dev/guide/examples/class-syntax/)
- [`gallery/clip-planes/clip-planes.shade.ts`](https://typeshade.dev/guide/examples/clip-planes/)
- [`gallery/closures/closures.shade.ts`](https://typeshade.dev/guide/examples/closures/)
- [`gallery/convert-grid/convert-grid.shade.ts`](https://typeshade.dev/guide/examples/convert-grid/)
- [`gallery/cube-array-gather/cube-array-gather.shade.ts`](https://typeshade.dev/guide/examples/cube-array-gather/)
- [`gallery/cube-env/cube-env.shade.ts`](https://typeshade.dev/guide/examples/cube-env/)
- [`gallery/cutout/cutout.shade.ts`](https://typeshade.dev/guide/examples/cutout/)
- [`gallery/default-args/default-args.shade.ts`](https://typeshade.dev/guide/examples/default-args/)
- [`gallery/feedback-trail/feedback-trail.shade.ts`](https://typeshade.dev/guide/examples/feedback-trail/)
- [`gallery/generic-class/generic-class.shade.ts`](https://typeshade.dev/guide/examples/generic-class/)
- [`gallery/generic-helpers/generic-helpers.shade.ts`](https://typeshade.dev/guide/examples/generic-helpers/)
- [`gallery/gradient-twin/gradient-twin.shade.ts`](https://typeshade.dev/guide/examples/gradient-twin/)
- [`gallery/hello/hello.shade.ts`](https://typeshade.dev/guide/examples/hello/)
- [`gallery/hello-uniform/hello-uniform.shade.ts`](https://typeshade.dev/guide/examples/hello-uniform/)
- [`gallery/hello-uniform-struct/hello-uniform-struct.shade.ts`](https://typeshade.dev/guide/examples/hello-uniform-struct/)
- [`gallery/hello-vsin/hello-vsin.shade.ts`](https://typeshade.dev/guide/examples/hello-vsin/)
- [`gallery/hello-vsout/hello-vsout.shade.ts`](https://typeshade.dev/guide/examples/hello-vsout/)
- [`gallery/higher-order/higher-order.shade.ts`](https://typeshade.dev/guide/examples/higher-order/)
- [`gallery/id-pick/id-pick.shade.ts`](https://typeshade.dev/guide/examples/id-pick/)
- [`gallery/imported-noise/imported-noise.shade.ts`](https://typeshade.dev/guide/examples/imported-noise/)
- [`gallery/inferred-returns/inferred-returns.shade.ts`](https://typeshade.dev/guide/examples/inferred-returns/)
- [`gallery/integer-math/integer-math.shade.ts`](https://typeshade.dev/guide/examples/integer-math/)
- [`gallery/loops-over-data/loops-over-data.shade.ts`](https://typeshade.dev/guide/examples/loops-over-data/)
- [`gallery/mixin-surface/mixin-surface.shade.ts`](https://typeshade.dev/guide/examples/mixin-surface/)
- [`gallery/module-const/module-const.shade.ts`](https://typeshade.dev/guide/examples/module-const/)
- [`gallery/msaa-resolve/msaa-resolve.shade.ts`](https://typeshade.dev/guide/examples/msaa-resolve/)
- [`gallery/normal-matrix/normal-matrix.shade.ts`](https://typeshade.dev/guide/examples/normal-matrix/)
- [`gallery/null-values/null-values.shade.ts`](https://typeshade.dev/guide/examples/null-values/)
- [`gallery/optional-fields/optional-fields.shade.ts`](https://typeshade.dev/guide/examples/optional-fields/)
- [`gallery/optional-values/optional-values.shade.ts`](https://typeshade.dev/guide/examples/optional-values/)
- [`gallery/orbit-inout/orbit-inout.shade.ts`](https://typeshade.dev/guide/examples/orbit-inout/)
- [`gallery/packed-bytes/packed-bytes.shade.ts`](https://typeshade.dev/guide/examples/packed-bytes/)
- [`gallery/packing-bitcast/packing-bitcast.shade.ts`](https://typeshade.dev/guide/examples/packing-bitcast/)
- [`gallery/palette-const/palette-const.shade.ts`](https://typeshade.dev/guide/examples/palette-const/)
- [`gallery/pick-composite/pick-composite.shade.ts`](https://typeshade.dev/guide/examples/pick-composite/)
- [`gallery/private-state/private-state.shade.ts`](https://typeshade.dev/guide/examples/private-state/)
- [`gallery/ray-class/ray-class.shade.ts`](https://typeshade.dev/guide/examples/ray-class/)
- [`gallery/reference-parameters/reference-parameters.shade.ts`](https://typeshade.dev/guide/examples/reference-parameters/)
- [`gallery/rng-method/rng-method.shade.ts`](https://typeshade.dev/guide/examples/rng-method/)
- [`gallery/sample-branch/sample-branch.shade.ts`](https://typeshade.dev/guide/examples/sample-branch/)
- [`gallery/separable-blur/separable-blur.shade.ts`](https://typeshade.dev/guide/examples/separable-blur/)
- [`gallery/shadow-compare/shadow-compare.shade.ts`](https://typeshade.dev/guide/examples/shadow-compare/)
- [`gallery/shape-inheritance/shape-inheritance.shade.ts`](https://typeshade.dev/guide/examples/shape-inheritance/)
- [`gallery/textured-quad/textured-quad.shade.ts`](https://typeshade.dev/guide/examples/textured-quad/)
- [`gallery/tuple-and-brand/tuple-and-brand.shade.ts`](https://typeshade.dev/guide/examples/tuple-and-brand/)
- [`gallery/twin-structs/twin-structs.shade.ts`](https://typeshade.dev/guide/examples/twin-structs/)
- [`gallery/uniform-array/uniform-array.shade.ts`](https://typeshade.dev/guide/examples/uniform-array/)

## See also

- [Attributes](https://typeshade.dev/reference/attributes/)
