OpenGL 4.2 Atomic Counters: Rasterization Pattern, Helper for Rendering Optimization (Windows, Linux)
- 1 – Rasterization pattern
- 2 – Number of Processed Vertices
- 3 – Number of Processed Fragments
- 4 – Bugs…
- 5 – References
This demo is an update of the first atomic counters demo I published last year. No big changes except this new demo is for GLSL Hacker and then is available for Windows and Linux and maybe in a decade for OS X (bad luck, OpenGL 4.2 is required and OS X just got OpenGL 4.1) 😉
This demo of atomic counters allows to show three uses:
- 1 – the rasterization pattern on several different GPUs
- 2 – the number of vertices processed to render a triangular mesh
- 3 – the number of fragments processed to render a triangular mesh
The demos of this article have been coded with GLSL Hacker and you can find all source codes in the Code Sample Pack in the moon3d/gl-420-atomic_counters/ folder. You can download GLSL Hacker from this page.
As usual, the GLSL programs are not specific to GLSL Hacker. You can use them in any OpenGL/WebGL application with minor changes only (shader inputs).
All demos are based on Lua programming language and modules are used to simplify the main code.
1 – Rasterization pattern
Atomic counters allows to show in which order the pixels are renderer. The following images show how a 256×256-pixel quad is renderer on GeForce GTX 660, 680, 780 and on Radeon HD 6970.
The order of rendering corresponds to the color: black zones are rendered first then the red ones.
GeForce GTX 680 + R325.25, Linux Mint 13
GeForce GTX 680 + R326.98, Windows 8
GeForce GTX 660 + R326.98, Windows 7
GeForce GTX 780 + R326.98, Windows 8
Radeon HD 6970 + Cat 13.10 beta, Windows 8