Game Development Reference
In-Depth Information
Moving triangle
Rasterize
Shading domain
For each primitive
For each fragment
Get ssID
Get ssID
Cache lookup
Ye s
Store
shading
data
Store
pointer
ptr = fetch(
ptr = fetch(ssID)
ptr?
ptr = fetch(
No
Map
?
Compact buffers
Normal
Diffuse
Specular
Render
targets
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.
3.3.1
Algorithm Outline
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
 
 
Search Nedrilad ::




Custom Search