ID3D11DeviceContext::GSSetConstantBuffers method

Sets the constant buffers used by the geometry shader pipeline stage.


void GSSetConstantBuffers(
  [in]           UINT                StartSlot,
  [in]           UINT                NumBuffers,
  [in, optional] ID3D11Buffer *const *ppConstantBuffers


StartSlot [in]

Type: UINT

Index into the device's zero-based array to begin setting constant buffers to (ranges from 0 to D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - 1).

NumBuffers [in]

Type: UINT

Number of buffers to set (ranges from 0 to D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT - StartSlot).

ppConstantBuffers [in, optional]

Type: ID3D11Buffer*

Array of constant buffers (see ID3D11Buffer) being given to the device.

Return value

This method does not return a value.


The method will hold a reference to the interfaces passed in. This differs from the device state behavior in Direct3D 10.

You can't use the ID3D11ShaderReflectionConstantBuffer interface to get information about what is currently bound to the pipeline in the device context. But you can use ID3D11ShaderReflectionConstantBuffer to get information from a compiled shader. For example, you can use ID3D11ShaderReflectionConstantBuffer and ID3D11ShaderReflectionVariable to determine the slot in which a geometry shader expects a constant buffer. You can then pass this slot number to GSSetConstantBuffers to set the constant buffer. You can call the D3D11Reflect function to retrieve the address of a pointer to the ID3D11ShaderReflection interface and then call ID3D11ShaderReflection::GetConstantBufferByName to get a pointer to ID3D11ShaderReflectionConstantBuffer.

The Direct3D 11.1 runtime, which is available starting with Windows 8, can bind a larger number of ID3D11Buffer resources to the shader than the maximum constant buffer size that is supported by shaders (4096 constants – 4*32-bit components each). When you bind such a large buffer, the shader can access only the first 4096 4*32-bit component constants in the buffer, as if 4096 constants is the full size of the buffer.

If the application wants the shader to access other parts of the buffer, it must call the GSSetConstantBuffers1 method instead.






See also