ID3D11Device::CreateInputLayout Method

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

Syntax

HRESULT CreateInputLayout(
  [in]   const D3D11_INPUT_ELEMENT_DESC *pInputElementDescs,
  [in]   UINT NumElements,
  [in]   const void *pShaderBytecodeWithInputSignature,
  [in]   SIZE_T BytecodeLength,
  [out]  ID3D11InputLayout **ppInputLayout
);

Parameter

  • pInputElementDescs [in]
    Typ: const D3D11_INPUT_ELEMENT_DESC*

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

  • NumElements [in]
    Typ: UINT

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

  • pShaderBytecodeWithInputSignature [in]
    Typ: const void*

    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 [in]
    Typ: SIZE_T

    Size of the compiled shader.

  • ppInputLayout [out]
    Typ: ID3D11InputLayout**

    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.

Rückgabewert

Typ: HRESULT

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

Hinweise

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.

Anforderungen

Header

D3D11.h

Bibliothek

D3D11.lib

Siehe auch

ID3D11Device