Graphics Reference
In-Depth Information
To gain insight into how the blending configuration is used, we will use the same
paradigm that we employed for the stencil and depth tests and follow the path of a fragment
that is running through the blending functionality. Listing 3.32 shows the members of the
D3D11_RENDER_TARGET_BLEND_DESC structure.
Struct D3D11_RENDER_TARGET_BLEND_DESC {
BOOL BlendEnable;
D3D11_BLEND SrcBlend;
D3D11_BLEND DestBlend;
D3D11_BLEND_0P BlendOp;
D3D11_BI_END SrcBlendAlpha;
D3D11_BLEND DestBlendAlpha;
D3Dll_BLEND_OP BlendOpAlpha;
UINT8
RenderTargetWriteMask;
Listing 3.32. The D3D11_RENDER_TARGET_BLEND_DESC structure.
The first member, BlendEnable, performs exactly what its name states. It enables
or disables the blending functionality. We will assume that blending is enabled for this
example. Next, we see two sets of three states. The three members following BlendEnable
are used to blend color values (the RGB components of the fragment color), and the next
three are used for blending the alpha value (the A component of the fragment color). This
separation of blending state allows completely different blending modes to be used for
alpha and color, which can let them be used for separate purposes.
The three members that are supplied for both color and alpha are used to define
the blending equation. The two data sources for the blending equation are selected by
SrcBlend and DestBlend parameters for the color blending, and SrcBlendAlpha and
DestBlendAlpha for alpha blending. These parameters define their data source as one of
the members of the D3D11_BLEND enumeration, which is shown in Listing 3.33.
enum D3D11_BLEND {
D3D11_BLEND_ZER0,
D3D11_BLEND_0NE,
D3D11_BLEND_SRC_C0L0R,
D3D11_BLEND_INV_SRC_C0L0R,
D3D11_BLEND_SRC_ALPHA,
D3D11_BLEND_INV_SRC_ALPHA,
D3D11_BLEND_DEST_ALPHA J
D3D11_BLEND_INV_DEST_ALPHA,
D3D11_BLEND_DEST_C0L0R,
D3D11_BLEND_INV_DEST_C0L0R,
D3D11_BLEND_SRC_ALPHA_SAT,
D3D11_BLEND_BLEND_FACT0R,
D3D11_BLEND_INV_BLEND_FACT0R,
Search WWH ::




Custom Search