ID3D11Device::CreateInputLayout Method

Create an input-layout object to describe the input-buffer data for the input-assembler stage.

Syntax

public:
HRESULT CreateInputLayout(
         const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs,
         UINT NumElements,
         const void *pShaderBytecodeWithInputSignature,
         SIZE_T BytecodeLength,
         ID3D11InputLayout **ppInputLayout
)  

Parameters

pInputElementDescs
Type: D3D11_INPUT_ELEMENT_DESC *

[in] An array of the input-assembler stage input data types; each type is described by an element description (see D3D11_INPUT_ELEMENT_DESC).

NumElements
Type: UINT 

[in] The number of input-data types in the array of input-elements.

pShaderBytecodeWithInputSignature
Type: void *

[in] A pointer to the compiled shader. The compiled shader code contains a input signature which is validated against the array of elements. See remarks.

BytecodeLength
Type: SIZE_T 

[in] Size of the compiled shader.

ppInputLayout
Type: ID3D11InputLayout **

[out, optional] A pointer to the input-layout object created (see ID3D11InputLayout). To validate the other input parameters, set this pointer to be NULL and verify that the method returns S_FALSE.

Return value

Type: HRESULT 

If the method succeeds, the return code is S_OK. See Direct3D 11 return codes for failing error codes.

Remarks

After creating an input layout object, it must be bound to the input-assembler stage before calling a draw API.

Once an input-layout object is created from a shader signature, the input-layout object can be reused with any other shader that has an identical input signature (semantics included). This can simplify the creation of input-layout objects when you are working with many shaders with identical inputs.

If a data type in the input-layout declaration does not match the data type in a shader-input signature, CreateInputLayout will generate a warning during compilation. The warning is simply to call attention to the fact that the data may be reinterpreted when read from a register. You may either disregard this warning (if reinterpretation is intentional) or make the data types match in both declarations to eliminate the warning.

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

ID3D11Device

ID3D11Device Members