Graphics Reference
In-Depth Information
on complete geometric primitives, and also produces geometric primitives. This stage can
both add and remove data elements from the pipeline, which allows for some interesting,
non-traditional uses. In addition, it can take one type of geometry as input and generate
a different type of geometry as output. This allows the conversion of single vertices into
complete triangles, or even multiple triangles. The geometry shader is also the conduit
through which processed geometry can be streamed out of the pipeline into a buffer re-
source. This is accomplished in the stream output stage.
After the geometry is sent out of the geometry shader, it has completed the portion
of the pipeline that operates at the geometric level. From this point on, the geometry is
rasterized and dealt with at the fragment level. A fragment is essentially a group of data
that corresponds to a pixel in a render target, and that can potentially be used to update the
current value of that pixel if it makes its way through the rest of the pipeline. The genera-
tion of fragment-level data begins with the fixed-function rasterizer stage. The rasterizer
produces fragments from the geometric data passed to it, by determining which pixels of
a render target are covered by the geometry. Each fragment receives interpolated versions
of all of the per-vertex attributes, to provide the information needed for further processing
later in the pipeline. In addition, the rasterizer produces a depth value for each fragment,
which will later be used for visibility testing in the output merger stage.
Once a fragment has been generated, the pixel shader is invoked to process it. The
pixel shader is required to generate a color value output for each of the render target out-
puts bound to the pipeline. To accomplish this, it may sample textures or perform computa-
tions on the incoming fragment attributes. In addition, it can also override the depth value
produced by the rasterizer stage, to allow for specialized algorithms to be implemented in
the pixel shader stage.
After the pixel shader has finished its work, its output is passed to the output merger
stage. It must correctly "merge" the pixel shader output with the bound depth/stencil and
render target resources. This includes performing depth and stencil tests, performing the
blending function, and finally, performing the actual writing of the output to the appropri-
ate resources.
This has been a brief high-level overview of each of the pipeline stages, but there are
many more details to be considered when using each of them. We will dive much deeper
into all of the available configurations and capabilities of each stage in the Chapter 3, "The
Rendering Pipeline." Until we reach that point, keep this overview of the pipeline in mind
as we continue our overview of the API.
1.2.2 Computation Pipeline
With all of the other new pipeline stages that came along with Direct3D 11, there is one ad-
ditional stage that has not yet been discussed—the compute shader stage. This stage is in-
tended to perform computation outside of the traditional rendering paradigm, and therefore
Search WWH ::




Custom Search