Graphics Rendering Pipeline on GPU - lorentzo/IntroductionToComputerGraphics GitHub Wiki

Introduction

  • High level Rasterization-based rendering steps
  • Graphics rendering hardware (GPU) is optimized for performing rasterization-based rendering
  • Writing rendering pipeline that performs on GPU is done by using APIs such as OpenGL, Vulkan or Metal.
  • Rasterization can be also implemented on CPU (we will discuss it later) but we will focus on using GPU.

Rasterization-based rendering steps

https://www.scratchapixel.com/lessons/3d-basic-rendering/rasterization-practical-implementation

High-level Graphics pipeline on GPU

Rendering image is done by invoking Graphics rendering pipeline containing several stages.

Modern Graphics rendering pipeline requires at least specification of:

  • Triangulated object mesh vertices.
  • Vertex program (shader).
  • Fragment program (shader).

Initial information is defined on so called "Application stage".

Once initiated, the pipeline operates in the following order:

  1. Vertex processing:
1.1. Vertex Shader -> operations on individual input vertices. Output are vertices.
1.2. (Optional) Tessellation Stage  -> patches of vertex data are subdivided into smaller Primitives. Output are primitives.
1.3. (Optional) Geometry shader -> operations on primitives. Output are primitives.
  1. Vertex Post-processing:
2.1. [Transform Feedback](https://www.khronos.org/opengl/wiki/Transform_Feedback) happens here.
2.2. [Primitive Assembly](https://www.khronos.org/opengl/wiki/Primitive_Assembly)
2.3. Primitive [Clipping](https://www.khronos.org/opengl/wiki/Clipping), the [perspective divide (https://www.khronos.org/opengl/wiki/Perspective_Divide), and the [viewport transform (https://www.khronos.org/opengl/wiki/Viewport_Transform) to window space.
  1. Rasterization: Scan conversion and primitive parameter interpolation, which generates a number of Fragments.

  2. Fragment Shader processes each fragment. Each fragment generates a number of outputs.

  3. Per-Sample_Processing, including but not limited to:

5.1. [Scissor Test](https://www.khronos.org/opengl/wiki/Scissor_Test)
5.2. [Stencil Test](https://www.khronos.org/opengl/wiki/Stencil_Test)
5.3. [Depth Test](https://www.khronos.org/opengl/wiki/Depth_Test)
5.4. [Blending](https://www.khronos.org/opengl/wiki/Blending)
5.5. [Logical Operation](https://www.khronos.org/opengl/wiki/Logical_Operation)
5.6. [Write Mask](https://www.khronos.org/opengl/wiki/Write_Mask)

Topics:

  • anti-aliasing and pixel sampling

Practical example

Foundational implementation of rasterization-based renderer on GPU:

Literature: