Game Development Reference
For each primitive
For each fragment
ptr = fetch(
ptr = fetch(ssID)
ptr = fetch(
Figure 3.4. The outline of decoupled deferred shading in a rasterization pipeline. Prior
to rasterization, each primitive is bound and projected to a shading grid. During frag-
ment processing, the fragments are mapped to their corresponding cells on the shading
grid. Shading reuse is implemented by referencing the same data from multiple samples
in the render targets.
Sampling stage. We rasterize all surfaces into the compact geometry buffer ( CG-
buffer ). Figure 3.4 shows the outline of this sampling stage. During rasterization
each fragment is assigned to a shading sample ID ( ssID ), which is searched in the
cache. If the shading data was found, we only store a pointer to its address in
the memory. In case of a miss, we also need to allocate a new slot in the compact
buffers and store the data in addition to referencing it.
In Section 3.2.2 we have already introduced the concept of a shading grid. In
our pipeline, we use this grid to allocate an ssID range for each primitive. This
virtual address space ensures that shading sample keys of concurrently raster-
ized primitives do not overlap, and the sampler can use these ssIDs to uniquely
reference a cached shading sample entry.
We provide further implementation details in the next section. In fact, we
only made a small modification in the decoupled sampling pipeline. While the