Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I've stared at this for at least half an hour now and I cannot figure out what directx is complaining about. I know this error normally means you put float3 instead of a float4 or something like that, but I've checked over and over and as far as I can tell, everything matches.

This is the full error message:

D3D11: ERROR: ID3D11DeviceContext::DrawIndexed: Input Assembler - Vertex Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (COLOR,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND ]

This is the vertex shader's input signature as seen in PIX:

// Input signature:
//
// Name                 Index   Mask Register SysValue Format   Used
// -------------------- ----- ------ -------- -------- ------ ------
// POSITION                 0   xyz         0     NONE  float   xyz 
// NORMAL                   0   xyz         1     NONE  float       
// COLOR                    0   xyzw        2     NONE  float      

The HLSL structure looks like this:

struct VertexShaderInput
{
    float3 Position : POSITION0;
    float3 Normal : NORMAL0;
    float4 Color: COLOR0;
};

The input layout, from PIX, is:

enter image description here

The C# structure holding the data looks like this:

[StructLayout(LayoutKind.Sequential)]
public struct PositionColored
{
    public static int SizeInBytes = Marshal.SizeOf(typeof(PositionColored));

    public static InputElement[] InputElements = new[]
    {
        new InputElement("POSITION", 0, Format.R32G32B32_Float, 0),
        new InputElement("NORMAL", 0, Format.R32G32B32_Float, 0),
        new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 0)
    };

    Vector3 position;
    Vector3 normal;
    Vector4 color;

    #region Properties
    ...
    #endregion

    public PositionColored(Vector3 position, Vector3 normal, Vector4 color)
    {
        this.position = position;
        this.normal = normal;
        this.color = color;
    }
    public override string ToString()
    {
        StringBuilder sb = new StringBuilder(base.ToString());
        sb.Append(" Position=");
        sb.Append(position);
        sb.Append(" Color=");
        sb.Append(Color);
        return sb.ToString();
    }
}

SizeInBytes comes out to 40, which is correct (4*3 + 4*3 + 4*4 = 40). Can anyone find where the mistake is?

share|improve this question
    
I suspect that since your input elements don't specify the exact offset of the values in the structure, it's assuming they're all aligned and is trying to read from 0, 16, and 32-byte offsets. So it would be trying to read 16 bytes of color from offset 32, which would read past the end of the 40-byte vertex, so instead it gives you an error. –  John Calsbeek Sep 2 '12 at 6:12
    
I've always used Append_Aligned_Element without any problems before. And explicitly setting the offsets to 0, 12, and 24 didn't help. –  Telanor Sep 2 '12 at 10:10

1 Answer 1

up vote 1 down vote accepted

Turns out that removing the normal and color (I wasnt using them anyway) from the VertexShaderInput struct makes the warning go away. I suspect this is just covering up some other problem but unless someone has any other ideas, I'll go with this for now.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.