InputLayouts

Started by
6 comments, last by David_pb 10 years, 11 months ago

Hello!

I'm currently writing input layout manager. Well the problem is ...

d3ddev->CreateInputLayout(inputElemDesc.get(), numSemantics,
pShader->GetShaderBlob().GetBufferPointer(), <------------------------------------ HERE
pShader->GetShaderBlob().GetBufferLength(),
&m_pD3D11Layout);
The result is 'success' against that shader :


float4 main(
): SV_Position
{
float4 retval = float4(0.f, 0.f, 0.f, 1.f);
 
return retval;   
}
But when i try to Draw something that error occurs : " Signatures between stages are incompatible. The input stage requires Semantic/Index (POSITION,0) as input, but it is not provided by the output stage. "
inputElemDesc is containing the 'POSITION' Semantic (only) but the shader compiler is cutting it! (the format is r32g32b32_FLOAT)
I can't compile shaders online(because of hardware limitations), so i cannot generate dummy shader for each inputlayout...
Any suggestions?
Advertisement

I went through something like like this. Make sure you are using the same structs with the exact same semantics for each shader stage. I had an issue where I was toying with my vertex shader output struct and forgot to also change my other shaders to match.

So, where does your shader signature require position? Are you sure you've the right shader bound to the pipeline while submitting the drawcall?

Yes im shure that evrything about the shader and inputElementDesc is OK. The problem is that im validating the inputLayout(with position only) against the shader that doesn't require any input. The layout is created succefully. After that im using the same input layout with shader that requires POSITION . The error message is : "Signatures between stages are incompatible. The input stage requires Semantic/Index (POSITION,0) as input, but it is not provided by the output stage."

Actually the input layout provides the position semantic, but obviously it is illigal to validate input layout against shader without any input rquirements.
I want to find a way to validate my input layout. I think that InputLayouts must be build for the mesh object not for ther shader. That thing is driving me crazy!!!

Well actually there is one solution (witch i cannot use): to create on the fly vertex shader based no the input layout, but because of platform limitations I cannot compile shader at runtime(windows phone and (im not shure about it) Xbox).

I can't compile shaders online(because of hardware limitations), so i cannot generate dummy shader for each inputlayout...

Most practical method is to validate the input layout against an actual shader that uses the input layout.

When binding an input layout together with a vertex shader, the layout needs to have (validated) element for all the VS' input elements (matching in position and order). It can have additional element used by other shaders, but it can never omit elements required by the shader.

For example, if you have an input layout that's validated against a shader that uses the input elements [POSITION, NORMAL, UV], the layout can be used to feed the following shader input structs: [POSITION, NORMAL, UV] [POSITION, NORMAL] [POSITION] [-]. (You'd validate such an input layout against the shader that has the largest span of input elements.)

What i've found today : http://ftscode.blogspot.com/2012/09/directx11-input-layout.html

My question is what is the price to make the vertex data binding in the openGL style(aka to bind one vertex buffer several times (see the link above))

Using multiple streams would add some overhead (for both the API and the Input Assembler). This will increase with the number of semantics used.

Splitting vertex-data in multiple streams can be very handy if you don't want to always provide the full amount of vertex information. Let's say you want to do a z-prepass, you don't need information like normal/tangent, color etc... The proposed solution however can easily result in a huge number of simultaneous bound vertex streams and thus can badly impact IA fetch performance.

This topic is closed to new replies.

Advertisement