Graphics Reference
In-Depth Information
The first technique for calculating the depth bias is used when a depth buffer with a
unorm format is used, or if no depth buffer is bound to the pipeline. The second method
is used when a floating point depth buffer is used. In the first equation, the r parame-
ter represents the minimum value that can be represented that is greater than 0, and the
MaxDepthSlope is the greatest slope in depth found over the primitive. In the second
equation, the r parameter represents the number of mantissa bits in the floating point type
of the depth buffer. In either case, this bias value is calculated and then clamped to the
DepthBiasClamp parameter of the rasterizer state description. Finally, the bias value is
added to the z value of a vertex after clipping and before interpolation setup is performed.
The effect of adding a bias can effectively shift the rasterized surface to ensure that small
differences in calculation can't produce artifacts.
The remaining four settings of the rasterizer state description are all Boolean param-
eters that switch various functionalities on or off. We will explore each of these parameters
in more detail in the "Rasterizer Stage Processing" section, but we make a brief mention
of them here. The first of these settings is the DepthClipEnable parameter. This enables
or disables clipping of primitives, based on their depth values. This essentially clips the
geometry to the near and far clipping planes. Next is the ScissorEnable parameter, which
enables or disables the use of the scissor test. The scissor test is used to cull any frag-
ments that are generated outside of the scissor rectangle. The third Boolean parameter is
multisampleEnable, which essentially toggles whether the rasterizer performs multiple
coverage tests for MSAA render targets. And finally, AntialiasedLineEnable enables or
disables the use of anti-aliasing when a line primitive is rasterized.
Viewport State
In addition to the main rasterizer state, the application must also provide at least one view-
port for use in rendering operations. The viewport structure consists of six floating point
parameters that identify the subregion of the current render target that will be rasterized
into. Listing 3.22 shows the contents of this structure.
struct D3D11_VIEWP0RT {
FLOAT TopLeftX;
FLOAT TopLeftY;
FLOAT Width;
FLOAT Height;
FLOAT MinDepth;
FLOAT MaxDepth;
}
Listing 3.22. The members of the D3D11 VIEWPORT structure.
Search WWH ::




Custom Search