Using GPU atomic counters in Vulkan
The goal of this recipe is to introduce atomics in Vulkan and demonstrate how to use them to see how the GPU scheduler distributes the fragment shader workload. In a sense, this is the order in which the GPU rasterizes triangles into fragments on the screen. Let's learn how to implement a Vulkan application to visualize the rendering order of fragments in a full-screen quad consisting of two triangles.
Getting ready
The demo from Implementing order-independent transparency uses an atomic counter to maintain per-pixel linked lists of transparent fragments. Make sure you read that recipe. Please recall our Vulkan scene data structures by reading the Working with shapes lists in Vulkan recipe of Chapter 9, Working with Scene Graphs.
The source code for this recipe can be found in Chapter10/VK01_AtomicsTest
.
How to do it...
The application runs using just two render passes. The first pass renders a full-screen quad and, at each fragment...