ID3D11DeviceContext::VSSetShaderResources method (d3d11.h)

Bind an array of shader resources to the vertex-shader stage.

Syntax

void VSSetShaderResources(
  [in]           UINT                     StartSlot,
  [in]           UINT                     NumViews,
  [in, optional] ID3D11ShaderResourceView * const *ppShaderResourceViews
);

Parameters

[in] StartSlot

Type: UINT

Index into the device's zero-based array to begin setting shader resources to (range is from 0 to D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - 1).

[in] NumViews

Type: UINT

Number of shader resources to set. Up to a maximum of 128 slots are available for shader resources (range is from 0 to D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT - StartSlot).

[in, optional] ppShaderResourceViews

Type: ID3D11ShaderResourceView*

Array of shader resource view interfaces to set to the device.

Return value

None

Remarks

If an overlapping resource view is already bound to an output slot, such as a rendertarget, then this API will fill the destination shader resource slot with NULL.

For information about creating shader-resource views, see ID3D11Device::CreateShaderResourceView.

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

In order to unbind resource slots, you must pass an array containing null values. For example, to clear the first 4 slots, use:

ID3D11ShaderResourceView* nullsrv[] = { nullptr, nullptr, nullptr, nullptr };
context->VSSetShaderResources(0, 4, nullsrv);

Requirements

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

See also

ID3D11DeviceContext