I'm attempting to compile a shader at the command prompt. What am I doing wrong that would make it generate this error?

fxc /Od /Zi /T ps_5_0 /E "ps_main" /Fo "basic.pso" "basic.ps"

Here is the pixel shader

struct VS_OUTPUT
    float4 Color    : COLOR0;

float4 ps_main(VS_OUTPUT input) : COLOR0
    return input.Color;

The return is:

<path here>\basic.ps(8,33-40): error X4502: invalid ps_5_0 output semantic 'COLOR0'

compilation failed; no code produced

COLOR0 is DX9. Since you're dealing with DX11 (ps_5_0) you need to replace COLOR0 with SV_Target.

  • \$\begingroup\$ to be clear, replace it only int the ps_main line \$\endgroup\$ – Babis Nov 26 '14 at 9:32
  • 1
    \$\begingroup\$ Changing the shader is the best option, but note that you can also just add /Gec to the command-line to have it allow Direct3D9-era semantic names. \$\endgroup\$ – Chuck Walbourn Dec 2 '14 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.