Graphics Reference
In-Depth Information
that represent a regular sampling pattern between these vertices, the three vertex attribute
values must be interpolated to find an appropriate intermediate value to pass on to each
fragment. This is performed in the actual rasterization process, and will be discussed later
in this section.
3.10.2 Rasterizer Stage State Configuration
With such a large number of different functionalities available in the rasterizer stage, there
are a correspondingly large number of states to configure in order to control its operation.
These configurations are controlled by the application through three different sets of meth-
ods, which can be used either to query the existing state or to overwrite the existing state
with a new one.
Rasterizer State
The primary configuration of the rasterizer stage is performed with the rasterizer state ob-
ject. This object, represented by the ID3DllRasterizerState interface, is an immutable
state object that is validated when it is created. As is the case with all objects in Direct3D 11,
the object is created through a device method, the ID3D11Device: :CreateRasterizer
State(...) method in this case. Like other state objects, this method takes a pointer to a
description structure that provides the desired configuration values. Listing 3.21 provides
a description declaration, followed by the creation of a rasterizer state object. This is fol-
lowed by reading the existing state in the current device context, and then setting the new
state that we just created.
D3D11_RASTERIZER_STATE rs;
rs.FillMode = D3D11_FILL_S0LID;
rs.CullMode = D3D11_CULL_BACK;
rs.FrontCounterClockwise = false;
rs.DepthBias = 0;
rs.SlopeScaledDepthBias = 0.0f;
rs.DepthBiasClamp = 0.0f;
rs.DepthClipEnable = true;
rs.ScissorEnable = false;
rs.MultisampleEnable = false;
rs.AntialiasedLineEnable = false;
ID3DllRasterizerState* pState = 0;
HRESULT hr = m_pDevice->CreateRasterizerState( &rs, &pState );
Listing 3.21. The specification and creation of a rasterizer state object.
Search WWH ::




Custom Search