0
votes

I'm trying to get some Morph Based Vertex animations going, but I'm getting #342 errors telling me that:

D3D11 ERROR: ID3D11DeviceContext::Draw: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (NR_POSITION,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND]
D3D11 ERROR: ID3D11DeviceContext::Draw: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (NORMAL,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND]
D3D11 ERROR: ID3D11DeviceContext::Draw: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (COLOUR,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND]
D3D11 ERROR: ID3D11DeviceContext::Draw: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. Semantic 'UV' is defined for mismatched hardware registers between the output stage and input stage. [ EXECUTION ERROR #343: DEVICE_SHADER_LINKAGE_REGISTERINDEX]
D3D11 ERROR: ID3D11DeviceContext::Draw: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (BLEND,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND]
D3D11 ERROR: ID3D11DeviceContext::Draw: Vertex Shader - Pixel Shader linkage error: Signatures between stages are incompatible. The input stage requires Semantic/Index (LS_POSITION,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND]

This confuses me greatly as looking at my shaders, the Vertex Shader's output matches the input of the pixel shader exactly, something I've confirmed by copy pasting the input from the pixel shader over to the vertex shader without it fixing the problem. I'm currently stumped on this, as I have no idea what's wrong. I've read somewhere that if you don't set an output value it "doesn't count," gets discarded, and that causes a linkage error, but I'm setting all the values and still getting the error.

Here is my shader code:

Vertex Shader

struct MorphShaderInput
{
    float4 position : POSITION;
    uint index : INDEX; // Not at all a position but the input layout screams if I don't call it as such
};

struct MorphShaderOutput
{
    float4 position : SV_POSITION;
    float4 NR_Position : NR_POSITION;
    float4 normal : NORMAL;
    float3 colour : COLOUR;
    float2 uv : UV;
    float blend : BLEND;
    float4 positionLightSpace : LS_POSITION;
};

struct morphPoint
{
    float4 position;
    float4 normal;
};

// A structured buffer of the previous frame's values
StructuredBuffer<morphPoint> firstPoint : register(t0);
// A structured buffer of the next frame's values
StructuredBuffer<morphPoint> secondPoint : register(t1);

cbuffer interpolationValue : register(b1) // (This buffer is in slot 1 and not 0)
{
    matrix morphWvp;
    matrix morphSpace;
    float iValue;
}

MorphShaderOutput main(MorphShaderInput input)
{
    MorphShaderOutput output;

    float4 morphedPosition = (iValue * firstPoint[input.index].position) + ((1.0f - iValue) * secondPoint[input.index].position);
    float4 morphedNormal = (iValue * firstPoint[input.index].normal) + ((1.0f - iValue) * secondPoint[input.index].normal);

    output.position = mul(morphedPosition, morphWvp);
    output.NR_Position = mul(morphedPosition, morphSpace);
    output.normal = mul(morphedNormal, morphSpace);
    output.colour = float3(0.7f, 0.7f, 0.7f);
    output.uv = float2(0, 0);
    output.blend = 1.0f;
    output.positionLightSpace = float4(0.0f, 0.0f, 0.0f, -1.0f);

    return output;
}

Pixel Shader

Texture2D rockTexture : register(t0);
Texture2D dirtTexture : register(t1);
Texture2D grassTexture : register(t2);
Texture2D shadowMap : register(t3);
SamplerState Sampler : register(s0);
SamplerState ShadowSampler : register(s1);

struct PixelShaderInput
{
    float4 position : SV_POSITION;
    float4 NR_Position : NR_POSITION;
    float4 normal : NORMAL;
    float3 colour : COLOUR;
    float2 uv : UV;
    float blend : BLEND;
    float4 positionLightSpace : LS_POSITION;
};

cbuffer phongLighting : register(b0)
{
    float4 l_pos;
    float4 l_cam;
    float l_amb;
    float l_dif;
    float l_spc;
}

cbuffer shadowMapping : register(b1)
{
    matrix wvpLight;
    matrix inverseWorld;
    float2 mapSize;
}

float4 main(PixelShaderInput input) : SV_TARGET
{
    // Does containt code that works when linked with other vertex shaders. I don't think the contents here matters to the linkage error
}
1
Duplicating those structs is error prone. Consider putting them into a common .hlsli file and including it in both shaders.trojanfoe

1 Answers

2
votes

Well don't I feel dumb, turns out the problem wasn't even in the shader files, but that I had made the type of "VSGetShader()" instead of "VSSetShader()."

Friendly reminder to all other novices: Remember to check if you really wrote "Set"...