CreateInputLayout throws E_INVALIDARG

Started by
1 comment, last by trevex 11 years, 3 months ago

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...

Advertisement
This:
...{"TEXCOORD0",...
is illegal.

Enable the debug runtime at device creation with D3D11_CREATE_DEVICE_DEBUG and watch the debug output telling you this:

[4848] D3D10: ERROR: ID3D10Device::CreateInputLayout: Element[1]: SemanticName string ("TEXCOORD0") cannot end with a number. Instead, use the number in the SemanticIndex field. For example, ...

Sorry for the delayed answers, but for whatever reason I wasn't able to login anymore...

Anyway thanks a lot that fixed it :)

This topic is closed to new replies.

Advertisement