在 .fx 效果文件中加载 Monogame

Monogame loading in a .fx effect file

目前我正在尝试将以下教程中的 .fx 文件加载到 monogame 中 http://www.xnahub.com/simple-2d-lighting-system-in-c-and-monogame/

FX文件如下:

sampler s0;  

texture lightMask;  
sampler lightSampler = sampler_state{Texture = lightMask;};  

float4 PixelShaderLight(float2 coords: TEXCOORD0) : COLOR0  
{  
    float4 color = tex2D(s0, coords);  
    float4 lightColor = tex2D(lightSampler, coords);  
    return color * lightColor;  
}  


technique Technique1  
{  
    pass Pass1  
    {  
        PixelShader = compile ps_2_0 PixelShaderLight();  
    }  
}  

我已经使用 2MFGX.exe 工具将我的 .fx 文件转换为编译良好的 mgfxo 文件,但是当我尝试使用以下代码将 mfgxo 文件加载到我的游戏中时:

        Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("Mist.Content.lighteffect.mgfxo");
        BinaryReader Reader = new BinaryReader(s);
        effect1 = new Effect(GraphicsDevice, Reader.ReadBytes((int)Reader.BaseStream.Length)); 

我收到以下错误:

此 MGFX 效果适用于旧版本的 MonoGame,需要重建。

我已经浏览过网络,并且正在竭尽全力试图理解为什么会发生这种情况。任何帮助将不胜感激!

原来问题出在 HLSL 文件中的一行代码。

sampler lightSampler = sampler_state{Texture = lightMask;}; 

应该是

 sampler lightSampler = sampler_state{Texture = <lightMask>;}; 

有趣的是它在没有这个的情况下被编译,但是 monogame 不喜欢它。