Wrong MGFX version on Android

Hi there!

I have a couple of post-processing shaders that used to work before updating to MonoGame 3.5. I’m using the 2MGFX tool for building them, with /Profile:OpenGL. The build succeeds, I have double checked that the build script refers to the newest version of 2MGFX, and the same shaders work nicely on Windows UWP and WP 8.1. I have the SM4/else checks in the shader code, so that should be fine. In Xamarin I updated the MonoGame Addin and the MonoGame NuGet package to the 3.5 versions. Still getting the “Wrong MGFX version” exception when trying to load the effects.

Any ideas what I might still be missing?

I have been using MonoGame on and off for a couple of years already, and always managed somehow without asking for help, but this time I am truly out of ideas.

Not sure… but if you can share the XNB file I can take a closer look at it.

@dellis1972 - Ideas? Could there be something wrong with the pipeline addin for XamStudio?

You can download the original code and the .mgfxo from this link: crt-shader

I’m using the following code to load the shaders on Android:
using(var stream = TitleContainer.OpenStream(@“Content\Shaders” + name + “.mgfxo”))
{
var ms = new MemoryStream ();
stream.CopyTo(ms);
var bytes = ms.ToArray();
result = new Effect(GraphicsDevice, bytes);
}

I could also see what happens if I just create a new Android project from scratch, and try to load a dummy shader without anything special.

Okay, good news. It seems to work nicely in a new project, both through the Content.mgcb and loading the .mgfxo. So obviously something in my project file got messed up. Have to investigate some more.

Maybe the .targets file was redirecting to the wrong version of the content tools?

I have no idea what happened, but I guess I’ll just create a new project from scratch. And ditch Xamarin Studio now that I can start using Visual Studio for Android as well :slightly_smiling: