I am currently working with DirectX on a Coursework Assignment. My first simple shader worked fine, but now after adding some complexity and changing the input layout the code throws an unexpected error. I found a few related posts around here, that unfortunately didn't help me.
The input layout in the shader is defined as followed:
struct VSInput
{
float3 Position : POSITION;
float2 TexCoord : TEXCOORD0;
float3 Normal : NORMAL;
};
I try to setup the input layout in my small material class like this ( I use the effects framework):
const D3D11_INPUT_ELEMENT_DESC basicInput[] =
{
{"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"TEXCOORD0", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
{"NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0}
};
D3DX11_PASS_DESC passDesc;
m_Tech->GetPassByIndex(0)->GetDesc(&passDesc);
HR(static_cast<SDXRenderInfo*>(g_RenderInfo)->device->CreateInputLayout(basicInput, 3,
passDesc.pIAInputSignature, passDesc.IAInputSignatureSize, &m_InputLayout));
(HR is a small macro I found in the Frank Luna book; the static_cast might be irritating but the engine supports directx and opengl and this is part of my dirty solution)
EDIT:
Let me know if your need more informations...