Graphics Reference
In-Depth Information
system value semantic. In addition, the contents of this attribute must contain the post-
projection clip space position of the vertex in order to be rasterized properly. Stages prior
to the geometry shader stage could use this attribute with other forms of the position (such
as object space, world space, or view space positions), but the geometry shader must pass
the final clip space position to the rasterizer stage.
In addition to the position of each vertex, the geometry shader can take advantage
of a pair of system values that have not been available prior to this stage in the pipeline.
The first of these system values is SV_RenderTargetIndex. This system value provides an
unsigned integer value that identifies the slice of a render target that this primitive should
be rendered into. As described in Chapter 2, it is possible to create 2D texture resources
that contain an array of textures. Each of these textures is referred to as a slice of the
texture. If a render target is bound for output to the pipeline and contains multiple slices,
then the geometry shader can dynamically decide which render target to apply a particular
primitive to. This method of selecting the render target to be applied to goes hand in hand
with the single-pass environment mapping examples described earlier in this section. The
SV_GSInstanceID value would be used to determine which copy of a primitive is passed
into each render target by copying its value into SV_RenderTargetIndex. Of course, the
bound render target must have an appropriate number of slices to accommodate the range
of instances specified in the geometry shader. We will discuss binding render targets to the
pipeline in more detail in the "Output Merger" stage section. The use of this system value
semantic is depicted in Figure 3.42.
Figure 3.42. Using the geometry shader to write to multiple texture slices simultaneously with the "SV_
RenderTargetIndex" system value semantic.
Search WWH ::




Custom Search