Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Invalid vs_2_0 output semantic

Tags:

hlsl

Its says: Invalid vs_2_0 output semantic SV_Target.

So for some reason Visual Studio 2017 is compiling my pixel shader as if it is a vertex shader. But in the properties panel I specified it to be a ps_5_0. Is there something I'm missing that should be specified?

Vertex shader:-

cbuffer ConstantBuffer : register(b0)
{
    matrix World;
    matrix View;
    matrix Projection;
}

struct Input {
    float3 Pos  : POSITION;
    float4 Color: COLOR;
};

struct VS_OUTPUT
{
    float4 Pos : SV_POSITION;
    float4 Color : COLOR0;
};

VS_OUTPUT main(Input input)
{
    VS_OUTPUT output = (VS_OUTPUT)0;

    output.Pos = mul(input.Pos, World);
    output.Pos = mul(output.Pos, View);
    output.Pos = mul(output.Pos, Projection);

    output.Color = input.Color;
    return output;
}

Pixel shader:-

struct VS_OUTPUT
{
    float4 Pos : SV_POSITION;
    float4 Color : COLOR0;
};

float4 main(VS_OUTPUT input) : SV_Target
{
    return input.Color;
}

And here are my settings for the pixel shader. I hope someone can help me.

like image 772
Kay Verbruggen Avatar asked Jul 31 '17 18:07

Kay Verbruggen


1 Answers

Open the Property page for the .hlsl file, and in HLSL Compiler/General/Shader Type select Pixel Shader.

like image 134
joseangelmt Avatar answered Nov 15 '22 12:11

joseangelmt