# Vertex Shader (VS) stage

The Vertex Shader (VS) stage processes vertices, typically performing operations such as transformations, skinning, and lighting. A vertex shader takes a single input vertex and produces a single output vertex.

## Purpose and uses

The Vertex Shader (VS) stage is used for individual per-vertex processing such as:

- Transformations
- Skinning
- Morphing
- Per-vertex lighting

The Vertex Shader stage is a programmable-shader stage; it is shown as a rounded block in the graphics pipeline diagram. This shader stage uses shader model 4.0 common-shader core.

The vertex-shader (VS) stage processes vertices from the input assembler. Vertex shaders always operate on a single input vertex and produce a single output vertex. The vertex shader stage must always be active for the pipeline to execute. If no vertex modification or transformation is required, a pass-through vertex shader must be created and set to the pipeline.

Each vertex shader input vertex can be comprised of up to 16 32-bit vectors (up to 4 components each). Each output vertex can be comprised of as many as 16 32-bit 4-component vectors. All vertex shaders must have a minimum of one input and one output, which can be as little as one scalar value.

The vertex-shader stage can consume two system-generated values from the input assembler: VertexID and InstanceID (see System Values and Semantics). Since VertexID and InstanceID are both meaningful at a vertex level, and IDs generated by hardware can only be fed into the first stage that understands them, these ID values can only be fed into the vertex-shader stage.

Vertex shaders are always run on all vertices, including adjacent vertices in input primitive topologies with adjacency. The number of times that the vertex shader has been executed can be queried from the CPU using the VSInvocations pipeline statistic.

A vertex shader can perform load and texture sampling operations where screen-space derivatives are not required (using HLSL intrinsic functions: Sample (DirectX HLSL Texture Object), SampleCmpLevelZero (DirectX HLSL Texture Object), and SampleGrad (DirectX HLSL Texture Object)).

## Input

A single vertex, with VertexID and InstanceID system-generated values. Each vertex shader input vertex can be comprised of up to 16 32-bit vectors (up to 4 components each).

## Output

A single vertex. Each output vertex can be comprised of as many as 16 32-bit 4-component vectors.

## Related topics

## Feedback

Submit and view feedback for