Reputation: 251
Currently I am trying to load into monogame a .fx file from the following tutorial http://www.xnahub.com/simple-2d-lighting-system-in-c-and-monogame/
The FX file is as follows:
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();
}
}
I have used the 2MFGX.exe tool to convert my .fx file to a mgfxo file which compiles fine, however when I try and load the mfgxo file into my game with this code:
Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("Mist.Content.lighteffect.mgfxo");
BinaryReader Reader = new BinaryReader(s);
effect1 = new Effect(GraphicsDevice, Reader.ReadBytes((int)Reader.BaseStream.Length));
I receive the following error:
This MGFX effect is for an older release of MonoGame and needs to be rebuilt.
I have looked over the web and I am pulling my hair out trying to understand why this is happening. Any help would be greatly appreciated!
Upvotes: 1
Views: 846
Reputation: 251
So it turns out the issue was a line of code in the HLSL file.
sampler lightSampler = sampler_state{Texture = lightMask;};
should have been
sampler lightSampler = sampler_state{Texture = <lightMask>;};
The funny thing is it was being compiled without this, but monogame didn't like it.
Upvotes: 1