Graphics Reference
In-Depth Information
fragments. When there are multiple streams used
in the geometry shader program, only one of the
declared streams can be selected to be passed on
to the rasterizer stage through the stream configu-
ration set by the application when compiling the
geometry shader program. The remaining streams
must be configured to be streamed to a buffer (one
buffer per stream) attached to the stream output
stage. The stream that is passed to the rasterizer
can optionally be streamed to a buffer as well.
Details about how to configure these streams from
the application will be covered in the "Stream
Output" stage section. Figure 3.38 shows multiple
stream outputs from the geometry shader.
A very important consideration when using
multiple output streams is that all stream types
must be point streams. This means that all verti-
Rgure 3.38. Multiple stream outputs from
the geometry shader.
ces passed to a buffer resource are collected individually, which also means that it is not
possible to produce triangles or lines that share vertices. In this scenario, a given set of
geometry may consume more memory than would normally be used with line strips or tri-
angle strips. However, if the algorithm in the geometry shader produces a known pattern of
vertices, it may be possible to use a preloaded index buffer to reference the vertices as the
desired primitives. In addition to this restriction, if a stream is sent to the rasterizer stage, it
will only appear as points. Because of this, most geometry shader programs with multiple
output streams don't rasterize any of the streams unless point rendering is desired.
Another possible configuration is to use a single stream output object (which can use
any of the three stream types) and pass it to both the rasterizer and the stream output stage.
Data sent to the stream output buffer is still stored as non-indexed geometry, so it causes
the same memory consumption increases as mentioned above. However, if the object is
being rasterized, it is possible to use triangles and lines instead of just points. These are all
options for the developer, and each situation may require using a different combination of
these streams to be used.
The final consideration when using multiple output streams is the scalar value output
limits imposed on each geometry shader invocation. We have already seen that there is a
limit of 1024 scalar values, and that this limit applies to the total number of scalars passed
into an output stream. In the case of multiple streams, we take the maximum vertex size
and use this to determine the maximum number of vertices that can be passed into the
output streams. There is only one set of output registers in the stage, and the registers
are shared among all of the output streams. The maximum vertex size is chosen, since
Search WWH ::




Custom Search