Jump to content
  • Advertisement
Sign in to follow this  
trevex

OpenGL CreateInputLayout throws E_INVALIDARG

This topic is 2124 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

 

Share this post


Link to post
Share on other sites
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, ...

Share this post


Link to post
Share on other sites

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

 

Anyway thanks a lot that fixed it :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!