Graphics Reference
In-Depth Information
D3D11_BLEND_SRC1_C0L0R J
D3D11_BLEND_INV_SRC1_COLOR,
D3D11_BLEND_SRC1_ALPHA,
D3D11_BLEND_INV_SRC1_ALPHA
}
Listing 3.33. The D3D11_BLEND enumeration.
As you can see, there are a substantial number of possible data sources. The general
options in this list include data sources such constant values and color/alpha values, with
several possible modifiers. The color and alpha sources all provide source and destina-
tion modifiers, where the source is the value from the current fragment and the desti-
nation is the value located in the "destination" render target. Each of these values also
provides an "inverse" value, which is generated by using 1 minus the value. For example,
the D3D11_BLEND_SRC_C0L0R selects the current fragment color as its source. However,
D3D11_BLEND_INV_DEST_C0L0R selects the inverse of the destination render target value as
its source. In addition to each of these modified color and alpha values, it is also possible to
use one of several constant values. The constant values that can be chosen are either 0, 1,
or the blend factor that is set by the application with the ID3DllDeviceContext: :0MSet
BlendState() method. The blend factor also provides an inverse value as well.
You may also notice that there are several parameters with the SRC1 modifier in their
names, such as D3D11_BLEND_SRC1_C0L0R and D3D11_BLEND_INV_SRC1_ALPHA. These
values are actually taken from the second output register in the pixel shader, and can be
used in blending operations at the same time as the first output register. This lets two source
quantities be read from the current fragment, instead of using the contents of the destina-
tion buffer. Using both of the output register values is referred to as dual-source color
blending, and can only be used with a single render target output (otherwise, the second
color value would be passed to the second render target).
Once the data sources have been selected, the blending operation must be selected.
This operation combines the two data source values into a single value to be written into
the output render target destination. The available operations are provided in Listing 3.34.
The available operations are fairly self-explanatory and implement what their names imply.
There are three arithmetic operations (A+B, A-B, B-A), along with minimum and maxi-
mum selection options.
enum D3D11_BLEND_0P {
D3D11_BLEND_0P_ADD,
D3D11_BLEND_0P_SUBTRACT,
D3D11_BLEI\ID_0P_REV_SUBTRACT,
D3D11_BLEND_0P_MIN,
D3D11_BLEND_0P_MAX
}
Listing 3.34. The D3D11 BLEND OP enumeration.
Search WWH ::




Custom Search