# [Primitive Assembly]

Hello, I hope you’re all doing well.

I’m trying to understand how OpenGL Graphics pipeline works but some steps seems to be a bit confusing.
I don’t get the purpose of the primitive assembly step, I mean I know what happens at this stage: Primitives are divided into a sequence of individual base primitives ( points, lines, triangles) but why it has to happen before rasterization and after Vertex Post processing stages.

Why can’t we just move from Vertex Post Processing to rasterization ?
Is it because we can’t rasterize, for example, a polygon unless it is divided into triangles or a basic primitive in general ? But why exactly ?

Also, I kept searching and I found this:

For example, a Geometry Shader operates on each input base primitive in the primitive sequence. Therefore, a form of primitive assembly must happen before the GS can execute. [https://www.khronos.org/opengl/wiki/Primitive_Assembly]

However the stage of primitive assembly takes place after the geometry shader according to this pipeline:

I found another pipeline version in some OpenGL tutorial which is different from the one above:

I know that tesselation is an optional stage but some other stages are missing like Vertex Post-processing which is an important one.
So I kinda don’t really know which pipeline I should adapt.

I really would appreciate it if you help me a bit, I’ve reading a lot about OpenGL pipeline and it’s a bit difficult to understand exactly how OpenGL works.
Thank you all.

What are you going to rasterise? You can’t rasterise vertices, as those are just points. You need to determine the set of pixels which are covered by a primitive, which means constructing primitives.

Primitive assembly corresponds to construction of the actual primitives upon which rasterisation operates. If you have a geometry shader, those are likely to be different to the primitives which are fed into the geometry shader (there wouldn’t be much point in having a geometry shader if the output primitives were identical to the input primitives).

The only difference is that it omits tessellation (which is a recent addition) and combines primitive assembly and rasterisation into one step. The specification also covers primitive assembly and rasterisation in one chapter (one point to note is that clipping is covered in the “fixed-function vertex post-processing” chapter, although the mechanics of clipping operate upon primitives rather than vertices).

Ultimately, the grouping of the various processes into discrete stages is somewhat arbitrary and doesn’t necessarily reflect what actually occurs in an implementation. The specification only describes observable behaviour, not implementation.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.