• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Telanor

Error #342: device_shader_linkage_semanticname_not_found

15 posts in this topic

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:

[code]
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 ]
[/code]

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

[code]
// 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
[/code]

The HLSL structure looks like this:

[code]
struct VertexShaderInput
{
float3 Position : POSITION0;
float3 Normal : NORMAL0;
float4 Color: COLOR0;
};
[/code]

The input layout, from PIX, is:

[attachment=11040:InputLayouts.png]

The C# structure holding the data looks like this:

[code]
[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();
}
}
[/code]

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

Share this post


Link to post
Share on other sites
Everything you've posted looks okay. Are you sure you have the right input layout and vertex shader bound when that error message gets output? If you capture a frame in PIX, you can double-click on the error and it will take you to the exact call that caused it. Then you can check the state of your device context, and make sure it's what you expect it to be.
1

Share this post


Link to post
Share on other sites
Yea, the screenshot of the input layout is from the device state on the draw call that has the warning. I also double checked in the code that it sets the right layout before drawing.
0

Share this post


Link to post
Share on other sites
Perhaps there is another way to put down point lights? or is this the only method when using deferred rendering? Cause we are at a dead end if there is no error with our code. *shrugs* thanks for the help MJP though.
0

Share this post


Link to post
Share on other sites
I never looked that deep into deferred rendering so I can't help you on that atm but is it possible to see some shader code because when directx is complaining the error is not always where it says it should be.
1

Share this post


Link to post
Share on other sites
Yeah, def. I will have him post it as soon as he gets up. Or pm you with it, you have been most helpful quiSHAD, if you ever need some art let me know.
1

Share this post


Link to post
Share on other sites
I'm not familiar with that error, but is it possible that its complaining when trying to link the pixel/vertex shaders together? Does the PS require a COLOR0 input that the VS isn't outputting?
1

Share this post


Link to post
Share on other sites
[quote name='riuthamus' timestamp='1346777253' post='4976474']
Yeah, def. I will have him post it as soon as he gets up. Or pm you with it, you have been most helpful quiSHAD, if you ever need some art let me know.
[/quote]

Thanks I'm always glad when I can help. Also I like challenging problems and not only within my projects.


[quote name='Hodgman' timestamp='1346778407' post='4976478']
I'm not familiar with that error, but is it possible that its complaining when trying to link the pixel/vertex shaders together? Does the PS require a COLOR0 input that the VS isn't outputting?
[/quote]

I would say everything is possible but typically D3D11 would output something like: "D3D11: ERROR: ID3D11DeviceContext::DrawIndexed: Vertex Shader - Pixel Shader"
So it is pointing in to VS input. But in my experience sometimes even D3D is confused. So theoretically the error could be everywhere and most likely at a point where you normally would never look for it.
1

Share this post


Link to post
Share on other sites
[quote name='quiSHADgho' timestamp='1346779552' post='4976492']
I would say everything is possible but typically D3D11 would output something like: "D3D11: ERROR: ID3D11DeviceContext::DrawIndexed: Vertex Shader - Pixel Shader"
So it is pointing in to VS input. But in my experience sometimes even D3D is confused. So theoretically the error could be everywhere and most likely at a point where you normally would never look for it.
[/quote]

This was the problem that we were afraid of. We almost were hoping it was a numerical issue rather than having to deal with a "needle in a haystack" situation. Telanor should be up 3 hours, I will make sure he sees this once he does and we can go from there. Thanks again, both of you. Edited by riuthamus
0

Share this post


Link to post
Share on other sites
[quote name='Telanor' timestamp='1346547594' post='4975601']
This is the vertex shader's input signature as seen in PIX:
[code]
// 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
[/code]
[/quote]

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

edit: oh god that converted horribly. Quote tool doth not preserve tab spacing Edited by BCullis
0

Share this post


Link to post
Share on other sites
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?
1

Share this post


Link to post
Share on other sites
Hi,

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

Best regards!
1

Share this post


Link to post
Share on other sites
[quote name='BCullis' timestamp='1346782487' post='4976511']
Just trying to help think outloud, but is it a problem that your normal and color values show as unused in this PIX data?
[/quote]

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.

[quote name='kauna' timestamp='1346784980' post='4976532']
Hi,

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

Best regards!
[/quote]

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.

[quote name='BCullis' timestamp='1346783336' post='4976518']
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?
[/quote]

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:

[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()));
}
}

[/code]
0

Share this post


Link to post
Share on other sites
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.
1

Share this post


Link to post
Share on other sites
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.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0