Graphics Reference
In-Depth Information
either the depth component or the stencil component, or both, can be created as read-only.
This means that the view itself ensures that the resource can only be read from, which al-
lows it to be used in more than one location in the pipeline. The resource can be bound
for use in the depth test and simultaneously used as a shader resource. This can be very
beneficial when the depth buffer is used as an input to later rendering passes, but still needs
to be used for the depth test at the same time.
Blending
If a fragment has survived both the stencil test and the depth test, it is passed to the blending
function. The blending function makes it possible to combine two selectable values prior
to writing them to the output render target, and the function used to combine the values is
also selectable. This functionality has traditionally been used to perform alpha-blending
to implement partially transparent rendering materials. However, with the large number
of possible blend sources, operations, and write options, there is plenty of additional func-
tionality that can be used for other, less conventional techniques. The blending function
is controlled by the configurations contained within the blend state object. Listing 3.31
provides the list members that can be manipulated in the blend state.
Struct D3D11_BLEND_DESC {
BOOL AlphaToCoverageEnable;
BOOL IndependentBlendEnable;
D3D11_RENDER_TARGET_BLEND_DESC RenderTarget [8];
}
Listing 3.31. The D3D11_BLEND_DESC structure.
Here we find two top level configurations, followed by an array of eight render target
blend description structures. The first top-level member is the AlphaToCoverageEnable
parameter, which we have already discussed in the "Pixel Shader" section of this chapter.
The second top-level member is another Boolean value, which determines if all of the
render targets bound for output in the output merger stage will be blended independently,
or if they will all use the same blending configuration. As you may have guessed by now,
the blending configurations are stored in the eight-element array member of the blend state,
since there is a maximum of eight render target slots available. If individual blending is
enabled by setting IndependentBlendEnable to true, each of these array elements defines
the blending mode to use for the corresponding render target slot. If independent blending
is disabled, then all render targets will use the blending configuration from index 0 of the
array. If it is not needed, then independent blending should be disabled to allow for better
performance.
Search WWH ::




Custom Search