Graphics Reference
In-Depth Information
The second system value that the geometry shader can use is the SV_Viewport
ArrayIndex attribute. This attribute operates in a similar way to SV_RenderTargetIndex,
except that it determines which viewport it will be applied to, instead of the texture slice.
Viewports reside in the rasterizer stage, and hence have not been discussed yet. However,
we can generalize a viewport to represent a subregion within a render target. Multiple view-
ports can be bound simultaneously, with each representing different portions of a render tar-
get. The usefulness of these viewports is that different representations of a scene can be ren-
dered into each viewport. This is commonly done for split-screen rendering, where each side
of the screen shows one player's view of the scene. The geometry shader stage's instancing
abilities can also be used to provide an index for use as the viewport array index, effectively
allowing multiple sets of geometry to be passed to multiple viewports.
3.9 Stream Output
In the geometry shader stage, we saw how its stream output object is used to produce a
stream of primitives that is passed on to the rasterizer stage, where they are ultimately used
to modify the contents of a render target later in the pipeline. However, this is not the only
use of the output streams. We have also seen how the stream can be sent to the stream out-
put stage, where the output primitives can be streamed into a buffer resource for later use.
This is the sole purpose of the stream output stageā€”to provide a mechanism for connecting
the geometry shader and output buffer resources to hold the vertex data. The location of the
stream output stage in the pipeline is highlighted in Figure 3.43.
As mentioned above, it is possible to use more than one stream output buffer at the
same time. This allows the geometry shader to produce four different versions of its output,
and it provides a significant amount of freedom to implement a wide variety of algorithms.
The stream output stage can be considered a fixed-function pipeline stage, although no
real processing is performed within the stage itself. Instead, the application configures the
stream output stage by using a specially created geometry shader program, and then binds
the desired buffer resources to the stage. Since it serves as an exit point from the pipeline,
there is no pipeline stage attached to the output of the stream output stage.
Figure 3.43. The stream output stage.
Search WWH ::




Custom Search