ID3D11Device::CreateGeometryShaderWithStreamOutput method (d3d11.h)

Creates a geometry shader that can write to streaming output buffers.

Syntax

HRESULT CreateGeometryShaderWithStreamOutput(
  [in]            const void                       *pShaderBytecode,
  [in]            SIZE_T                           BytecodeLength,
  [in, optional]  const D3D11_SO_DECLARATION_ENTRY *pSODeclaration,
  [in]            UINT                             NumEntries,
  [in, optional]  const UINT                       *pBufferStrides,
  [in]            UINT                             NumStrides,
  [in]            UINT                             RasterizedStream,
  [in, optional]  ID3D11ClassLinkage               *pClassLinkage,
  [out, optional] ID3D11GeometryShader             **ppGeometryShader
);

Parameters

[in] pShaderBytecode

Type: const void*

A pointer to the compiled geometry shader for a standard geometry shader plus stream output. For info on how to get this pointer, see Getting a Pointer to a Compiled Shader.

To create the stream output without using a geometry shader, pass a pointer to the output signature for the prior stage. To obtain this output signature, call the D3DGetOutputSignatureBlob compiler function. You can also pass a pointer to the compiled shader for the prior stage (for example, the vertex-shader stage or domain-shader stage). This compiled shader provides the output signature for the data.

[in] BytecodeLength

Type: SIZE_T

Size of the compiled geometry shader.

[in, optional] pSODeclaration

Type: const D3D11_SO_DECLARATION_ENTRY*

Pointer to a D3D11_SO_DECLARATION_ENTRY array. Cannot be NULL if NumEntries > 0.

[in] NumEntries

Type: UINT

The number of entries in the stream output declaration ( ranges from 0 to D3D11_SO_STREAM_COUNT * D3D11_SO_OUTPUT_COMPONENT_COUNT ).

[in, optional] pBufferStrides

Type: const UINT*

An array of buffer strides; each stride is the size of an element for that buffer.

[in] NumStrides

Type: UINT

The number of strides (or buffers) in pBufferStrides (ranges from 0 to D3D11_SO_BUFFER_SLOT_COUNT).

[in] RasterizedStream

Type: UINT

The index number of the stream to be sent to the rasterizer stage (ranges from 0 to D3D11_SO_STREAM_COUNT - 1). Set to D3D11_SO_NO_RASTERIZED_STREAM if no stream is to be rasterized.

[in, optional] pClassLinkage

Type: ID3D11ClassLinkage*

A pointer to a class linkage interface (see ID3D11ClassLinkage); the value can be NULL.

[out, optional] ppGeometryShader

Type: ID3D11GeometryShader**

Address of a pointer to an ID3D11GeometryShader interface, representing the geometry shader that was created. Set this to NULL to validate the other parameters; if validation passes, the method will return S_FALSE instead of S_OK.

Return value

Type: HRESULT

This method returns one of the Direct3D 11 Return Codes.

Remarks

For more info about using CreateGeometryShaderWithStreamOutput, see Create a Geometry-Shader Object with Stream Output.

The Direct3D 11.1 runtime, which is available starting with Windows 8, provides the following new functionality for CreateGeometryShaderWithStreamOutput.

The following shader model 5.0 instructions are available to just pixel shaders and compute shaders in the Direct3D 11.0 runtime. For the Direct3D 11.1 runtime, because unordered access views (UAV) are available at all shader stages, you can use these instructions in all shader stages.

Therefore, if you use the following shader model 5.0 instructions in a geometry shader, you can successfully pass the compiled geometry shader to pShaderBytecode. That is, the call to CreateGeometryShaderWithStreamOutput succeeds.

If you pass a compiled shader to pShaderBytecode that uses any of the following instructions on a device that doesn’t support UAVs at every shader stage (including existing drivers that are not implemented to support UAVs at every shader stage), CreateGeometryShaderWithStreamOutput fails. CreateGeometryShaderWithStreamOutput also fails if the shader tries to use a UAV slot beyond the set of UAV slots that the hardware supports.

Windows Phone 8: This API is supported.

Requirements

Requirement Value
Target Platform Windows
Header d3d11.h
Library D3D11.lib

See also

ID3D11Device