‘main’: input parameter ‘input’ missing semantics

If you’ve received the error message “input parameter ‘xxxx’ missing semantics” in a shader the cause of the error is a missing piece of information on one of your parameters or structures. Here is an example of a shader that will produce that error.

struct VSIn {
	float3 position;
	float4 color;
};

struct PS_IN
{
	float3 position:SV_POSITION;
	float4 color:COLOR;
};

PS_IN main(VSIn input)
{
	PS_IN output;
	output.position = input.position;
	output.color = input.color;
	return output;
}

Here the correction would be to add the semantics POSITION and COLOR to the shader. The corrected shader looks like the following.

struct VSIn {
	float3 position:POSITION;
	float4 color:COLOR;
};

struct PS_IN
{
	float3 position:SV_POSITION;
	float4 color:COLOR;
};

PS_IN main(VSIn input)
{
	PS_IN output;
	output.position = input.position;
	output.color = input.color;
	return output;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s