ID3D11DeviceContext::IASetIndexBuffer Method

Bind an index buffer to the input-assembler stage.

Syntax

public:
void IASetIndexBuffer(
         ID3D11Buffer *pIndexBuffer,
         DXGI_FORMAT Format,
         UINT Offset
)  

Parameters

pIndexBuffer
Type: ID3D11Buffer *

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

Format
Type: DXGI_FORMAT 

[in] 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.

Offset
Type: UINT 

[in] 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.

Requirements

Header: Declared in d3d11_x.h (d3d11.h on other Windows platforms).

Library: Use d3d11_x.lib (d3d11.lib on other Windows platforms).

See also

ID3D11DeviceContext

ID3D11DeviceContext Members