error X4502: invalid vs_4_0 output semantic 'SV_TARGET'

Started by
1 comment, last by viper110110 11 years, 5 months ago
I have a pixel shader, copied from the font tutorial at rastertek. I have changed the tutorials for the new windows sdk on windows 8, but when I try to load the shader, the output says

error X4502: invalid vs_4_0 output semantic 'SV_TARGET'

I find this weird because I have another shader that also uses SV_TARGET in the same place and it works fine.

Here is my shader:

[source lang="cpp"]/////////////
// GLOBALS //
/////////////
Texture2D shaderTexture;
SamplerState SampleType;

cbuffer PixelBuffer
{
float4 pixelColor;
};


//////////////
// TYPEDEFS //
//////////////
struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
};

////////////////////////////////////////////////////////////////////////////////
// Pixel Shader
////////////////////////////////////////////////////////////////////////////////
float4 FontPixelShader(PixelInputType input) : SV_TARGET
{
float4 color;


// Sample the texture pixel at this location.
color = shaderTexture.Sample(SampleType, input.tex);

// If the color is black on the texture then treat this pixel as transparent.
if(color.r == 0.0f)
{
color.a = 0.0f;
}

// If the color is other than black on the texture then this is a pixel in the font so draw it using the font pixel color.
else
{
color.a = 1.0f;
color = color * pixelColor;
}

return color;
}[/source]
Advertisement
You're compiling the shader with the wrong profile. You're compiling it with vs_4_0, and you want ps_4_0.
Thanks, I've been staring at that problem for days now, and I knew it was something as simple as that.

This topic is closed to new replies.

Advertisement