0
\$\begingroup\$

am trying to compile three .fx custom shader files from a monogame sample project, i am tryting to get running for windows phone.

The GaussianBlur.fx file is:

// Pixel shader applies a one dimensional gaussian blur filter.
// This is used twice by the bloom postprocess, first to
// blur horizontally, and then again to blur vertically.

sampler TextureSampler : register(s0);

#define SAMPLE_COUNT 15

float2 SampleOffsets[SAMPLE_COUNT];
float SampleWeights[SAMPLE_COUNT];


float4 PixelShaderFunction(float2 texCoord : TEXCOORD0) : COLOR0
{
    float4 c = 0;

    // Combine a number of weighted image filter taps.
    for (int i = 0; i < SAMPLE_COUNT; i++)
    {
        c += tex2D(TextureSampler, texCoord + SampleOffsets[i]) * SampleWeights[i];
    }

    return c;
}


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

I am trying to compile it using MG2FX.exe - I cloned the latest monogame develop repo and built the 2MGFX project x64|release

The command I run is - 2MGFX.exe GaussianBlur.fx GuassianBlur.mgfx

******* I can only get it to compile if use ps_2_0 - ps_4_0_level_9_1 fais to compile, saying error X3523: DX9-style intrinsics are disabled when not in dx9 compatibility mode. and ps_4_0 fails with Invalid profile ''. Pixel shader 'PixelShaderFunction' must be SM 3.0 or lower!

I have no idea how to set it to work with ps_4_0 - am I building 2MGFX incorrectly? all i did was open the project and press build.

Next, I am tryng to take the files and load them by calling

gaussianBlurEffect = Game.Content.Load<Effect>("Shaders/GaussianBlur.mgfx");

I am setting the mgfx file as content

But when I try to load it, I get an exception stating:

System.Exception: The MGFX effect is the wrong profile for this platform!

I am assuming that I need to get it loaded in ps_4_0 first, so my question is how can I get 2MGFX to recognize this? Then once I have built the mgfx file using 2MGFX, can I just load it like a normal .xnb file.

\$\endgroup\$
  • \$\begingroup\$ AFAIK 2MGFX does not support > SM 3.0 so PS_4_0 is impossible. You will need to downgrade to PS_2 \$\endgroup\$ – mklingen Apr 6 '15 at 19:53
  • \$\begingroup\$ if I downgrade to ps_2 or ps_3 how do I get past the "wrong profile for this platform error" - sorry if this is a silly question \$\endgroup\$ – Pectus Excavatum Apr 7 '15 at 8:46
  • \$\begingroup\$ See this github.com/mono/MonoGame/issues/1726 \$\endgroup\$ – mklingen Apr 7 '15 at 15:37

Your Answer

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

Browse other questions tagged or ask your own question.