Error #342: device_shader_linkage_semanticname_not_found

Started by
14 comments, last by riuthamus 11 years, 7 months ago
Also, just for clarification, what does the (SlimDX?) documentation say on the InputElement constructor that doesn't take an offset value for each element? Is it auto-calculated?

Hazard Pay :: FPS/RTS in SharpDX (gathering dust, retained for... historical purposes)
DeviantArt :: Because right-brain needs love too (also pretty neglected these days)

Advertisement
Hi,

I guess that you have verified with debugger that you are actually using the correct vertex declaration with correct vertex shader?

Best regards!

Just trying to help think outloud, but is it a problem that your normal and color values show as unused in this PIX data?


I have other shaders that show unused inputs and they dont error. And I tried changing it so the vertex shader passes those along to the pixel shader, still errors.


Hi,

I guess that you have verified with debugger that you are actually using the correct vertex declaration with correct vertex shader?

Best regards!


Yea, the input layout and input signature in the original post are from PIX on the draw call that is erroring. The vertex shader and input layout are correct.


Also, just for clarification, what does the (SlimDX?) documentation say on the InputElement constructor that doesn't take an offset value for each element? Is it auto-calculated?


The constructor I'm using sets the offset to APPEND_ELEMENT_ALIGNED. I've tried explicitly setting the offsets to 0, 12, and 24. It still errors with that though.

For those wanting to see the shader code:


float4x4 World;
float4x4 View;
float4x4 Projection;
float FarPlane;

//color of the light
float3 Color;

//position of the camera, for specular light
float3 CameraPosition;

//this is used to compute the world-position
float4x4 InvertViewProjection;

//this is the position of the light
float3 LightPosition;

//how far does this light reach
float LightRadius;

//control the brightness of the light
float LightIntensity;

// diffuse color, and specularIntensity in the alpha channel
Texture2D ColorMap : register(t0);
// normals, and specularPower in the alpha channel
Texture2D NormalMap : register(t1);
//depth
Texture2D DepthMap : register(t2);

SamplerState colorSampler
{
Filter = Min_Mag_Mip_Linear;
AddressU = Clamp;
AddressV = Clamp;
};

SamplerState normalSampler
{
Filter = Min_Mag_Mip_Point;
AddressU = Clamp;
AddressV = Clamp;
};

SamplerState depthSampler
{
Filter = Min_Mag_Mip_Point;
AddressU = Clamp;
AddressV = Clamp;
};

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

struct VertexShaderOutput
{
float4 Position : SV_POSITION;
float4 ScreenPosition : TEXCOORD0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
VertexShaderOutput output;
float4 worldPosition = mul(float4(input.Position, 1), World);
float4 viewPosition = mul(worldPosition, View);
output.Position = mul(viewPosition, Projection);

output.ScreenPosition = output.Position;

output.Position.z = log(0.001 * output.Position.z + 1) / log(0.001 * FarPlane + 1) * output.Position.w;
return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : SV_TARGET0
{
--snip--
}

technique11 Technique1
{
pass Pass1
{
SetVertexShader(CompileShader(vs_4_0, VertexShaderFunction()));
SetPixelShader(CompileShader(ps_4_0, PixelShaderFunction()));
}
}

The shader code is absolutely fine, unfortunately. Just to sum it up:
The shader is ok, the struct is ok and the InputLayout is set correctly. Then there are only a few things I can think about which may cause this but they are rather unlikely and I'm sure you checked it already..
First: The constructor never receives a valid value. To test it set the color to fixed value in the constructor instead of using the input.
Second: I'm guessing you are using instancing anywhere in your code. Is it possible that there is something messed up with different vertex streams?
And the last one: Using the wrong technique may cause it when the previous VS input was bigger.

Oh and one last thing. If this is the whole relevant shader code and since your not using the color and normal values just try:
VertexShaderOutput VertexShaderFunction(float3 inPosition : POSITION)
and see if the error is the same.
Believe it or not, removing the normal and color from the struct fixed it. I feel like maybe that's just masking the real issue but... its just a warning, so I suppose its fine. The shader is still not producing the right output but at least I know its not because of a directx error now. Thanks for your help guys.
Thanks a bunch, our lighting system is looking amazing. I will have some screenshots for you guys shortly!

This topic is closed to new replies.

Advertisement