Is there a way to load fx shader without using the Monogame content pipeline?


Is there a way I can load and run fx shader in MonoGame without using the content Pipeline?


I don’t use the content pipeline at all, because my program is a compiler of sorts and just creates an executable, so I embed the files into the exe as a resource.

Well I have been avoiding the content pipeline so far. I even wrote my own font renderer. The only thing that I don’t know how to do is how do I load the .fx shader file and apply it to my game without the help of the content pipeline.

Can you help me with that?

You do still need to compile the shader file with mgcb to give the mgfxo file. Can then load using

                Assembly assembly = Assembly.GetExecutingAssembly();
            BinaryReader Reader = new BinaryReader(assembly.GetManifestResourceStream("ScratchEffects.mgfxo"));
            BinaryReader Reader2 = new BinaryReader(assembly.GetManifestResourceStream("ScratchEffects2.mgfxo"));

        scratchEffect = new Effect(GraphicsDevice, Reader.ReadBytes((int)Reader.BaseStream.Length));
        scratchEffect2 = new Effect(GraphicsDevice, Reader2.ReadBytes((int)Reader2.BaseStream.Length));