Graphics Reference
In-Depth Information
ordering of additions and removals is not guaranteed, because the resource is accessed by
many threads simultaneously. Addition of values is done with the Append method of the
AppendStructuredBuffer type, while removal is done with the Consume method of the
ConsumeStructunedBuffer type. As their names suggest, these types are both structured
buffer resources.
6.5.3 Stream-Output Buffer
The stream-output buffer is a simple resource object used by the geometry shader to emit
primitive vertex data. Unlike other resource types, it is not declared globally and mapped
to a register. Instead, it is taken as an inout parameter to the geometry shader entry point
function. Three types of stream-output buffers can be declared, each corresponding to a dif-
ferent primitive type. They are PointStream, LineStream, and TriangleStream, which
correspond to a point strip, a line strip, and a triangle strip, respectively. The parameter
declaration should also include a type as the template argument, which indicates the data
format of the vertices. Typically, this type is a structure containing all vertex data that needs
to be passed to the pixel shader, or that will be output by the stream output stage. Adding
a vertex to the strip is done with the Append method, while RestartStrip cuts the current
strip and begins a new strip. If a strip is cut before the minimum number of vertices is ap-
pended, the incomplete primitive is discarded. 1
6.5.4 Input and Output Patches
HLSL includes two patch types, which are used for accessing an array of control point data
in the hull and domain shaders, and are also available as input to the geometry shader. 2
The InputPatch contains an array of points that can be declared as an input attribute for
the hull shader, the patch constant function, and the geometry shader. The OutputPatch
contains an array of points that is declared as an input to the domain shader. Both of types
are accessed using the array operator, and expose a Length property for determining the
number of elements they contain.
1 Further details on the declaration and usage of stream output buffers can be found in the "Geometry Shader"
and "Stream Output" sections of Chapter 3.
2 The geometry shader is typically not thought of as being able to receive an InputPatch as its input, but it
is valid to declare and use this in the same manner as seen with the hull shader. This can be used to perform
higher-order surface operations in the geometry shader if the control patches are not consumed by the tessella-
tion stages.
Search WWH ::




Custom Search