Graphics Reference
In-Depth Information
is 1 and ComponentCount is 2, the {y,z} components would be streamed. The final argu-
ment for this structure is OutputSlot, which determines which stream output stage buffer
resource will receive the streamed data. The valid values range from 0 to 3, to correspond
with as many as four output buffers.
Once an application has properly filled in an array of these structures to define the
information to be streamed out, the geometry shader object can be created. Listing 3.20
shows the method used to create this special version of the shader object.
HRESULT Create6eometryShaderWithStream0utput(
const void *pShaderBytecode,
SIZE_T BytecodeLength,
const D3D11_SO_DECLARATION_ENTRY *pSODeclaration,
UINT NumEntrieS;
const UINT *pBufferStrideS;
UINT NumStrides,
UINT RasterizedStream,
ID3D11ClassLinkage *pClassLinkage,
ID3D11GeometryShader **ppGeometryShader
);
Listing 3.20. The CreateGeometryShaderWithStreamOutput() method of the ID3DllDevice
interface.
We are the most interested in seeing which of these parameters is different than the nor-
mal geometry shader object creation method. The first new parameter, pSODeclaration, is the
pointer to an array of the declarations described above. This is followed by NumEntries,
which indicates how many entries are in the array. The next two parameters, pBuffer-
Strides and NumStrides, provide the vertex strides of each of the vertices that will be
streamed to each buffer. This allows each buffer to use a different vertex format to store the
desired information. The final new parameter is RasterizedStream, which provides the
index of the output stream that should be sent to the rasterizer stage. If none of the streams
will be rasterized, this parameter should be set to the constant D3D11_SO_NO_RASTERIZED_
STREAM. Whichever stream is specified for rasterization, it can still provide data to one of
the stream output buffers as well.
When a geometry shader object is created with this method and then subsequently
bound in the geometry shader stage, it activates the stream output stage. Then when a
pipeline execution begins, any data passed into an output stream in the geometry shader is
matched up with the output configuration based on its semantic name and semantic index.
Once a match has been found, that data is streamed to the appropriate buffer to create the
completed output vertices.
Search WWH ::




Custom Search