1
votes

I'm little bit confused when read graphics pipeline about primitive assembly. In documentation says, that

Primitive assembly is the process of collecting a run of vertex data output from the prior stages and composing it into a sequence of primitives. The type of primitive the user rendered with determines how this process works. The output of this process is an ordered sequence of simple primitives (lines, points, or triangles). If the input is a triangle strip primitive containing 12 vertices, for example, the output of this process will be 10 triangles.

It says that vertex data proccessing into sequence of primitives, but in the same time tesselation stage operate primitives, and geometric stage operate primitives(from input primitive it can generate zero or more primitives). My question is: why primitive assembly not in front of Tesselation an geometry shader stages?

2

2 Answers

3
votes

There are different types of primitives, and each stage can take different types of primitives as inputs, and produce different types of primitives as outputs.

  • The tesselation evaluation shader takes patches as input. So you cannot put normal primitive assembly before the tesselation evaluation shader, since primitive assembly produces points, lines, or triangles.

  • The geometry shader takes points, lines, triangles, lines with adjacency, or triangles with adjacency as input. So you cannot put normal primitive assembly before the geometry shader, because otherwise you would not be able to use lines or triangles with adjacency data.

Think about it this way: The main primitive assembly stage just turns one stream of primitives into a stream of primitives that can be converted into fragments. So, it’s the last thing that happens before everything in the pipeline is converted into fragments.

Note that a limited form of primitive assembly does take place before the geometry and tesselation evaluation shaders. From Rendering Pipeline Overview:

If tessellation or geometry shaders are active, then a limited form of primitive assembly is executed before these Vertex Processing stages. This is used to feed those particular shader stages with individual primitives, rather than a sequence of vertices.

1
votes

The reason is the result of tessellation and geometry shader stage can generate additional vertex data (you end up with more geometries). After this, the primitive assembly stage can assemble all the vertex data, including those that are generated from tessellation and geometry shader into primitives and then rasterization follows.