Error: Invalid vs_2_0 output semantic
Asked Answered
N

3

7

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.

Nicobarese answered 31/7, 2017 at 18:19 Comment(1)
Have you check the target and platform in the property panel, VS2017 has a breaking change in behavior from past version and the panel does not open with the current IDE setting anymore and keep track of his own.Beckmann
D
17

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

Dragelin answered 30/1, 2018 at 14:48 Comment(0)
S
0

And don't forget to set this propertie for debug and release.

Sisterhood answered 17/3, 2019 at 19:1 Comment(0)
C
0

You can resolve the issue by modifying the shader property

properties -> HLSL Compiler -> General -> Shader Type -> Pixel Shader (/ps)

OR

Configuration properties -> General -> Excluded from Build = Yes.

Carrack answered 6/2, 2021 at 2:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.