ID3D11DeviceContext::IASetIndexBuffer method (d3d11.h)

Bind an index buffer to the input-assembler stage.

Syntax

void IASetIndexBuffer(
  [in, optional] ID3D11Buffer *pIndexBuffer,
  [in]           DXGI_FORMAT  Format,
  [in]           UINT         Offset
);

Parameters

[in, optional] pIndexBuffer

Type: ID3D11Buffer*

A pointer to an ID3D11Buffer object, that contains indices. The index buffer must have been created with the D3D11_BIND_INDEX_BUFFER flag.

[in] Format

Type: DXGI_FORMAT

A DXGI_FORMAT that specifies the format of the data in the index buffer. The only formats allowed for index buffer data are 16-bit (DXGI_FORMAT_R16_UINT) and 32-bit (DXGI_FORMAT_R32_UINT) integers.

[in] Offset

Type: UINT

Offset (in bytes) from the start of the index buffer to the first index to use.

Return value

None

Remarks

For information about creating index buffers, see How to: Create an Index Buffer.

Calling this method using a buffer that is currently bound for writing (i.e. bound to the stream output pipeline stage) will effectively bind NULL instead because a buffer cannot be bound as both an input and an output at the same time.

The debug layer will generate a warning whenever a resource is prevented from being bound simultaneously as an input and an output, but this will not prevent invalid data from being used by the runtime.

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

Windows Phone 8: This API is supported.

Requirements

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

See also

ID3D11DeviceContext