Graphics Reference
In-Depth Information
3.9.3 Stream Output Stage Processing
Automated Drawing
There are two general ways to make use of the stream output functionality. The first is to
actually use the resulting buffer resource as an input to the input assembler stage for sup-
plying the vertex data for a pipeline execution. In this case, a special draw call is used to
execute the pipeline. The buffer resource must be bound to the input assembler stage slot 0,
and the corresponding input layout object must also be configured by the application. Then
the ID3DllDeviceContext::DrawAuto() method will inspect the contents of a streamed-
out buffer that was bound to the input assembler stage. It then provides the appropriate
number of vertices and primitives to the input assembler to render the entire contents of the
buffer, with no interaction from the application. In this case, the geometry shader object
produces the streamed output vertices 2 3
and the primitive connectivity information is de-
termined by the input assembler's primitive type configuration. The primitive type should
be chosen to be compatible with the type of primitive stream used to stream the data out. If
it is then rendered with the DrawAuto method, the complete rendering is performed without
the application having knowledge of the contents of the buffer. This is another way in which
GPUs are becoming more autonomous and can operate somewhat independently of the CPU.
The utility of this operation may not be immediately obvious. After all, if the ge-
ometry reaches the geometry shader, we could just as easily pass its output stream to the
rasterizer stage and use it directly—what benefit is there to streaming a mesh out and then
re-rendering it? The important point to consider is that the complete set of operations that
have been performed between the input assembler and the geometry shader are included in
the output stream generated by the geometry shader. Any vertex transformations performed
in the vertex shader can be saved, allowing any further rendering passes requiring the same
geometry to skip the vertex transformations and continue directly to the next stage. When
an expensive vertex-level operation is performed, such as vertex skinning, this can result
in a significant reduction in the number of calculations performed during a rendering pass.
This is also especially useful for algorithms that require multiple rendering passes
when tessellation has been used. If a model's geometry is first transformed in the vertex
shader, and then tessellated in the tessellation stages, and finally streamed out in the ge-
ometry shader stage, the results are available for future rendering passes without having to
perform all of those calculations again. The tessellation stages can be quite expensive to
compute if a very high tessellation level is used, which means that caching the tessellated
mesh in this way can save a significant number of calculations. The processing savings are
depicted in Figure 3.44.
2 3
If either a triangle stream or a line stream is used to produce the output vertex data, the strips that are passed
into these streams are converted into lists of primitives. This provides a consistent data format for use with the
DrawAuto() method.
Search WWH ::




Custom Search