Graphics Reference
In-Depth Information
Read-Only Depth Stencil Views
One other new feature in Direct3D 11 is the ability to use a depth stencil resource as a
depth/stencil target in the output merger stage, and to also simultaneously view its contents
through a shader resource view in one of the programmable shader stages. At first thought,
this would seem to violate the rule that a resource cannot simultaneously be read from and
written to from different resource, since the depth stencil resource would be written to in
the depth test portion of the output merger.
However, if the depth stencil view is created with the appropriate read-only flags, 3 7
this ensures that the resource is not written to by the output merger stage. Instead it is only
read by the output merger to determine if the depth test has passed or failed (if the depth
test is currently enabled). This effectively makes both of the pipeline locations that the re-
source is bound to read-only access points, which still follows the simultaneous read/write
rules. This configuration is depicted in Figure 3.80. This is useful because a secondary
rendering pass can use the depth buffer contents without having to copy them into another
resource, while at the same time the resource is also being used for the depth test.
3.12.3 Output Merger Stage Processing
The output merger stage performs two types of operations—visibility tests and blending
operations. The visibility tests provide configurable operations that are used to determine
if each particular fragment should be blended into the output resources attached to the
output merger. If the fragment passes both the depth test and the stencil test, it is passed
to the blending function to be combined with the render targets. The blending function is
also configurable, which allows for a wide variety of methods to apply pixel shader out-
puts to the render target. In this section, we follow the path that a fragment would follow
through the output merger stage. We first discuss each of the two visibility tests, to better
understand how the tests operate and what modifications can be made to them. Next, we
investigate how the blending function performs its duty and examine the available modes
for blending.
Visibility Tests
Two visibility tests are performed simultaneously by the output merger stage for each frag-
ment passed on to it: the depth test and the stencil test. Both of these tests use the depth
stencil resource that is bound to the output merger stage with a depth stencil view (DSV),
and require an appropriate data format to be selected for the depth stencil resource. The
3 7
Two flags are available, D3D11_DSV_READ_0NLY_DEPTH and D3D11_DSV_READ_0NLY_STENCIL, which
correspond to the depth and stencil portions of a depth/stencil target, respectively.
Search WWH ::




Custom Search