By Peter Young, Developer Technology Group
.PDF version, SDK 9.51 Code Sample, SDK 10 Code Sample
CSAA (Coverage Sampling Antialiasing) is one of the key new features of the GeForce 8 Series GPU.
In summary, CSAA produces antialiased images that rival the quality of 8x or 16x MSAA, while introducing only a minimal performance hit over standard (typically 4x) MSAA. It works by introducing the concept of a new sample type: a sample that represents coverage. This differs from previous AA techniques where coverage was always inherently tied to another sample type. In supersampling for example, each sample represents shaded color, stored color/z/stencil, and coverage, which essentially amounts to rendering to an oversized buffer and downfiltering. MSAA reduces the shader overhead of this operation by decoupling shaded samples from stored color and coverage; this allows applications using antialiasing to operate with fewer shaded samples while maintaining the same quality color/z/stencil and coverage sampling. CSAA further optimizes this process by decoupling coverage from color/z/stencil, thus reducing bandwidth and storage costs.
On the GeForce 8800, the following CSAA modes are supported:
| CSAA Mode | # of Color/Z/Stencil Samples |
# of Coverage Samples |
| 8x | 4 | 8 |
| 8xQ (Quality) | 8 | 8 |
| 16x | 4 | 16 |
| 16xQ (Quality) | 8 | 16 |
Figure 1: Color and coverage storage/layout in 16x CSAA
CSAA can be enabled in one of the two following scenarios:
It is recommended that applications enable CSAA directly. The process of implementing CSAA is incredibly simple (almost exactly the same as implementing MSAA), and the benefit to your users is enormous; they get much higher image quality at almost zero performance loss, without the fuss and hassle of manipulating the control panel.
CSAA is invoked through the use of the Quality field in the multisample descriptor structure:
typedef struct DXGI_SAMPLE_DESC {
UINT Count;
UINT Quality;
} DXGI_SAMPLE_DESC, *LPDXGI_SAMPLE_DESC;
Since this structure already provides a mechanism to specify the number of stored color/z/stencil samples through the Count field, and the number of shaded color samples is always 1 in a multisampled buffer, we can specify the number of coverage samples by setting the Quality field to the desired value. Below is a table listing the various CSAA modes, and the appropriate Count/Quality values used to enable them:
Table 1: CSAA modes and corresponding sample/coverage counts for DX10
| Desired CSAA Mode | Count (# Color/Z/Stencil samples) |
Quality Value |
| 8x | 4 | 8 |
| 8xQ (Quality) | 8 | 8 |
| 16x | 4 | 16 |
| 16xQ (Quality) | 8 | 16 |
Checking for CSAA support is simple:
For example, if you pass a SampleCount of 4, a pNumQualityLevels value of 9 or greater indicates that the 8x and 8xQ CSAA modes are available. A pNumQualityLevels value of 17 or greater indicates that the 16x and 16xQ CSAA modes are available.
The method of implementing CSAA in DX9 differs from DX10. This is due to a limitation in the DX9 runtime, which prohibits the driver from exposing multisample quality values greater than 7. For this reason, instead of specifying the number of coverage samples with the quality value, we simply set quality to a predetermined value which will be interpreted as a specific CSAA mode by the driver.
When creating a D3D device or render target, use the D3DMULTISAMPLE_TYPE parameter to specify the number of color/z/stencil samples, and use the quality parameter to set the CSAA mode. Refer to the following table:
Table 2: CSAA modes and corresponding sample/coverage counts for DX9
| Desired CSAA Mode | Multisample Value | Quality Value |
| 8x | D3DMULTISAMPLE_4_SAMPLES | 2 |
| 8xQ (Quality) | D3DMULTISAMPLE_8_SAMPLES | 0 |
| 16x | D3DMULTISAMPLE_4_SAMPLES | 4 |
| 16xQ (Quality) | D3DMULTISAMPLE_8_SAMPLES | 2 |
Checking for CSAA support is simple:
For example, if you pass a sample count of 4, a pQualityLevels value of 5 or greater indicates that both 8x and 16x CSAA modes are available.
Implementing CSAA in OpenGL is done through a new extension:
GL_NV_framebuffer_multisample_coverage
When support for this extension is verified, you may use the following function to create CSAA render buffers:
void RenderbufferStorageMultisampleCoverageNV( enum target, sizei coverageSamples, sizei colorSamples, enum internalformat, sizei width, sizei height);
Use of this function is identical to the older RenderbufferStorageMultisampleEXT(); the only difference is the ability to specify distinct color/z/stencil sample counts and coverage sample counts. Like DX10, the OpenGL function to specify color samples and coverage samples takes exact sample counts as arguments.
Refer to the table below:
| CSAA Mode | colorSamples value | coverageSamples value |
| 8x | 4 | 8 |
| 8xQ (Quality) | 8 | 8 |
| 16x | 4 | 16 |
| 16xQ (Quality) | 8 | 16 |
CSAA performance is generally very similar to that of typical MSAA performance, given the same color/z/stencil sample count. For example, both the 8x and 16x CSAA modes (which use 4 color/z/stencil samples) perform similarly or identical to 4x MSAA.
CSAA is also extremely efficient in terms of storage, as the coverage samples require very little memory.
Transparency AA is 100% compatible with CSAA. However, keep in mind that transparency AA operates at a lower resolution; it works at color/stencil/z resolution instead of coverage resolution, since transparency AA requires the color/z/stencil sample information to work.
For best image quality results, try to avoid the following scenarios when implementing CSAA:
Below are images from the SDK 10 CSAA sample highlighting the difference in quality between standard 4x MSAA and 16x CSAA modes. Observe the improvement in image quality for 16x, and note the fact that 16x CSAA typically performs similarly to 4x MSAA.
| No AA | |
| 4x MSAA | ![]() |
| 16x CSAA | ![]() |
| 16xQ CSAA | ![]() |