HLSL Linkage Errors

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Jan 20, 2012 at 08:28

Hey. I have some errors I’m having some trouble with. I’d appreciate it if anyone could help.

D3D10: ERROR: ID3D10Device::DrawIndexed: Vertex Shader - Geometry Shader linkage error: Signatures between stages are incompatible. The reason is that the input stage requires Semantic/Index (World,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND ]
D3D10: ERROR: ID3D10Device::DrawIndexed: Vertex Shader - Geometry Shader linkage error: Signatures between stages are incompatible. The reason is that the input stage requires Semantic/Index (World,1) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND ]
D3D10: ERROR: ID3D10Device::DrawIndexed: Vertex Shader - Geometry Shader linkage error: Signatures between stages are incompatible. The reason is that the input stage requires Semantic/Index (World,2) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND ]
D3D10: ERROR: ID3D10Device::DrawIndexed: Vertex Shader - Geometry Shader linkage error: Signatures between stages are incompatible. The reason is that the input stage requires Semantic/Index (World,3) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND ]
D3D10: ERROR: ID3D10Device::DrawIndexed: Vertex Shader - Geometry Shader linkage error: Signatures between stages are incompatible. The reason is that Semantic 'Texcoord' is defined for mismatched hardware registers between the output stage and input stage. [ EXECUTION ERROR #343: DEVICE_SHADER_LINKAGE_REGISTERINDEX ]
D3D10: ERROR: ID3D10Device::DrawIndexed: Vertex Shader - Geometry Shader linkage error: Signatures between stages are incompatible. The reason is that Semantic 'Texcoord' of the input stage has a hardware register component mask that is not a subset of the output of the previous stage. [ EXECUTION ERROR #345: DEVICE_SHADER_LINKAGE_REGISTERMASK ]
D3D10: ERROR: ID3D10Device::DrawIndexed: Vertex Shader - Geometry Shader linkage error: Signatures between stages are incompatible. The reason is that Semantic 'Color' is defined for mismatched hardware registers between the output stage and input stage. [ EXECUTION ERROR #343: DEVICE_SHADER_LINKAGE_REGISTERINDEX ]
D3D10: ERROR: ID3D10Device::DrawIndexed: Vertex Shader - Geometry Shader linkage error: Signatures between stages are incompatible. The reason is that Semantic 'Color' of the input stage has a hardware register component mask that is not a subset of the output of the previous stage. [ EXECUTION ERROR #345: DEVICE_SHADER_LINKAGE_REGISTERMASK ]
D3D10: ERROR: ID3D10Device::DrawIndexed: Vertex Shader - Geometry Shader linkage error: Signatures between stages are incompatible. The reason is that the input stage requires Semantic/Index (UVSize,0) as input, but it is not provided by the output stage. [ EXECUTION ERROR #342: DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND ]
D3D10: ERROR: ID3D10Device::DrawIndexed: Geometry Shader - Pixel Shader linkage error: Signatures between stages are incompatible. The reason is that 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 ]
D3D10: ERROR: ID3D10Device::DrawIndexed: Geometry Shader - Pixel Shader linkage error: Signatures between stages are incompatible. The reason is that Semantic 'TEXCOORD' is defined for mismatched hardware registers between the output stage and input stage. [ EXECUTION ERROR #343: DEVICE_SHADER_LINKAGE_REGISTERINDEX ]
D3D10: ERROR: : The declared input primitive type in the current Geometry Shader does not match the current input topology. [ EXECUTION ERROR #360: DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH ]

It’s weird because they all seem to mention Geometry Shaders while I’m not using any.

Here are two Shaders I wrote:

//RASTERIZER
RasterizerState DisableCulling { CullMode = NONE; };

//GLOBALS
//Matrix vars
float4x4 m_MatWVP : WORLDVIEWPROJECTION;
float4x4 m_MatW : WORLD;
float4x4 m_MatViewInv : VIEWINVERSE;

//Lighting vars
float3 m_LightDirection:DIRECTION
<
string UIName = "Light Direction";
string Object = "TargetLight";
> = float3(0.577f, 0.577f, -0.577f);

//Texture vars
Texture2D m_TexDiff
<
string UIName = "Texture Diffuse";
string UIWidget = "Texture";
>;

SamplerState m_Sampler
{
Filter = MIN_MAG_MIP_LINEAR;
AddressU = WRAP;
AddressV = WRAP;
AddressW = WRAP;
};

//STRUCTS
//VSInput
struct VSInput{
float3 pos: POSITION;
float3 norm: NORMAL;
float2 tex: TEXCOORD;
float3 tangent: TANGENT;
};

//PSInput
struct PSInput{
float4 pos: SV_POSITION; //system value
float3 norm: NORMAL;
float3 worldPos: COLOR0;
float2 tex: TEXCOORD0;
};

//------------------------------------------------------------------------------------------------------

//VERTEX SHADER
PSInput MainVS(VSInput input) {
PSInput output = (PSInput)0;
output.pos = mul(float4(input.pos.xyz, 1.0), m_MatWVP);
output.worldPos = mul(float4(input.pos.xyz, 1.0), m_MatW).xyz;
output.norm = mul(input.norm, (float3x3)m_MatW);
output.tex = input.tex;
return output;
}

//PIXEL SHADER
float4 MainPS(PSInput input) : SV_TARGET {
float3 lightDir = normalize(m_LightDirection);
float3 viewDir = normalize(input.worldPos.xyz - m_MatViewInv[3].xyz);
float3 normal = normalize(-input.norm);

//calc diffuse
float diffLambert = dot(lightDir, normal);
diffLambert = max(diffLambert, 0);

//calc spec
float3 reflLightDir = reflect(lightDir, normal);
float specPhong = dot(-viewDir, reflLightDir);
specPhong = max(specPhong, 0);
specPhong = pow(specPhong, 25);

//calc finalColor
float4 col = m_TexDiff.Sample(m_Sampler, input.tex);
col *= diffLambert;
col += specPhong;

return col;
}

//------------------------------------------------------------------------------------------------------

//DX10 TECHNIQUES
technique10 DefaultTechniqueDX10 {
pass p0 {
SetRasterizerState(DisableCulling); 
SetVertexShader(CompileShader(vs_4_0, MainVS()));
SetPixelShader(CompileShader(ps_4_0, MainPS()));
}
}

//RASTERIZER
RasterizerState DisableCulling { CullMode = NONE; };

//BLENDSTATE
BlendState AlphaBlend
{
BlendEnable[0] = TRUE;
SrcBlend = SRC_ALPHA;
DestBlend = INV_SRC_ALPHA;
BlendOp = ADD;
SrcBlendAlpha = ZERO;
DestBlendAlpha = ZERO;
BlendOpAlpha = ADD;
RenderTargetWriteMask[0] = 0x0F;
};

//GLOBALS
//Matrix vars
float4x4 m_MatrixWorldViewProj : WORLDVIEWPROJECTION;
float4x4 m_MatrixWorld : WORLD;
float4x4 m_MatrixViewInv : VIEWINVERSE;

//LightDirection
float3 m_LightDirection : DIRECTION<
string UIName = "Light Direction";
string Object = "TargetLight";
> = float3(-.577f,-.577f,.577f);

//Dynamic Stuff
float m_Time : TIME;

//Lighting
int m_Shininess <
string UIName = "Shininess";
string UIWidget = "Slider";
int UIMin = 0;
int UIMax = 100;
> = 2;

//Sampler
SamplerState m_SamplerTexture
{
Filter = MIN_MAG_MIP_LINEAR;
AddressU = WRAP;
AddressV = WRAP;
};

//Textures
Texture2D m_TextureDiffuse <
string UIName = "Texture Diffuse";
>;

//STRUCTS
//VSInput
struct VSInput{
float3 pos: POSITION;
float3 normal: NORMAL;
float2 tex: TEXCOORD;
float3 tangent : TANGENT;
};

//PSInput
struct PSInput{
float4 pos: SV_POSITION; //system value
float3 normal: NORMAL;
float2 tex: TEXCOORD0;
float3 worldPos: TEXCOORD1;
};

//------------------------------------------------------------------------------------------------------

//VERTEX SHADER
PSInput MainVS(VSInput input) {
PSInput output = (PSInput)0;
output.pos = mul(float4(input.pos.xyz, 1.0), m_MatrixWorldViewProj);
output.normal = normalize(mul(input.normal, (float3x3)m_MatrixWorld));
output.tex = input.tex;
output.worldPos = mul(input.pos, m_MatrixWorld);
return output;
}

//PIXEL SHADER
float4 MainPS(PSInput input) : SV_TARGET {
//normals
float3 n = -input.normal;
float3 lightdir = normalize(m_LightDirection);

//diffuse
float Dstren = dot(n, lightdir);
Dstren = max(Dstren, 0);

//specular (phong)
float3 viewDir = normalize(input.worldPos - m_MatrixViewInv[3].xyz);
float3 lightdirRefl = reflect(lightdir, n);
float Sstren = dot(-viewDir, lightdirRefl);
Sstren = max(Sstren, 0);
Sstren = pow(Sstren, m_Shininess);

//diffuse color
float time = m_Time - (int)m_Time;
float2 texCoord = (input.tex + time);
float4 diffColor = m_TextureDiffuse.Sample(m_SamplerTexture, texCoord);

//final color
float4 finalCol = float4(0.0f,0.0f,0.0f,1.0f);
finalCol.rgb += Dstren * diffColor.xyz;
finalCol.rgb += Sstren * float3(1.0f,1.0f,1.0f);
finalCol.a *= 0.33f + (0.5f + (sin(m_Time*10))/2.0f)/3.0f;

return finalCol;
}

//------------------------------------------------------------------------------------------------------

//DX10 TECHNIQUES
technique10 DefaultTechniqueDX10 {
pass p0 {
SetRasterizerState(DisableCulling); 
SetVertexShader(CompileShader(vs_4_0, MainVS()));
SetPixelShader(CompileShader(ps_4_0, MainPS()));
SetBlendState(AlphaBlend, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xffffffff);
}
}

Can anyone see problems or does the problem lay outside of the shader code?

6 Replies

Please log in or register to post a reply.

B5262118b588a5a420230bfbef4a2cdf
0
Stainless 151 Jan 20, 2012 at 10:28

Try changing VS_POSITION to POSITION0

“The reason is that the input stage requires Semantic/Index (World,0) as input, but it is not provided by the output stage.”

This implies to me that the vertex shader is not supplying POSITION0 so the system cannot get a pixel location for the pixel shader

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Jan 20, 2012 at 17:18

Can’t be the problem because the Pixel Shader must be supplied with an SV_POSITION, this is how directX knows where the vertices etc are at in screen coords.

I tried it nonetheless, but no success. Halp!

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Jan 20, 2012 at 17:56

Try adding SetGeometryShader(NULL) to your technique. I’ve found this to be necessary sometimes. Not sure why.

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Jan 20, 2012 at 18:13

Nice. This helped a lot.

Still got 3 new errors:

D3D10: INFO: ID3D10Device::DrawIndexed: The Pixel Shader unit expects a Shader Resource View at Slot 1, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D10: INFO: ID3D10Device::DrawIndexed: The Pixel Shader unit expects a Shader Resource View at Slot 2, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]
D3D10: INFO: ID3D10Device::DrawIndexed: The Pixel Shader unit expects a Shader Resource View at Slot 3, but none is bound. This is OK, as reads of an unbound Shader Resource View are defined to return 0. It is also possible the developer knows the data will not be used anyway. This is only a problem if the developer actually intended to bind a Shader Resource View here.  [ EXECUTION INFO #353: DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET ]

I have an “ubershader” in which I have multiple textures, but I only set some of them since I don’t need the others. I think this might be that problem but I’m not sure how to solve it?

Also, another question.

In some shader techniques I set SetRasterizerState(DisableCulling);
My question regarding this: Does it also reset to the previous rasterizerstate when the shader is done (the draw has happened), or do I need to set it before every draw call?

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Jan 20, 2012 at 19:47

Yeah, it’s complaining that some textures are unset, but that sounds like it’s expected. You could set the unused textures to a 1x1 black texture or something to silence it. As for the rasterizer state, I’m not sure, but I’d be interested to know the answer to that too, if you figure it out.

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Jan 20, 2012 at 20:50

All right, I’ll let you know. But first I’m going to solve some other problems so it’ll take a while.