Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm having trouble compiling a very simple pixel shader using the content pipeline in MonoGame 3.2.

Whenever I compile the shader using "ps_3_0" it works but when I try to load it using the ContentManager I get the error that "The MGFX effect is the wrong profile for this platform!" (I'm using DirectX, not OpenGL). If I now change it from "ps_3_0" to "ps_4_0_level_9_1" as I've seen people recommend I get this error instead: "Pixel shader 'PixelShaderFunction' must be SM 3.0 or lower!".

I'm at a loss here and I haven't really found an answer that made sense to me.

This is the shader I'm using (A simple desaturation effect):

sampler TextureSampler : register(s0);

float4 PixelShaderFunction(float4 pos: POSITION, float4 col: COLOR, float2 coords: TEXCOORD0) : COLOR0
{
    float4 tex = tex2D(TextureSampler, coords);

    float gray = dot(tex.rgb, float3(0.3, 0.59, 0.11));

    tex.rgb = lerp(gray, tex.rgb, 1);

    return tex;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
    }
}

The effect is compiled with the "MonoGame Effect" content processor. I'm trying to load it using the ContentManager like so:

PPSpiritWorld = Content.Load<Effect>("PPSpiritWorld");

Thank you for your time!

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.