Search code examples
c#shadermonogame

Loading shaders in Monogame is impossible


So I have this .fx file with HLSL code. The next step is to compile using 2MGFX.exe and this is where things go crazy. I can't run it on my computer at all.

So then I tried fxc.exe - installing this alone was a little too hard - but it generates a header. So I started following along with this post. I started trying to remove the headers byte-by-byte with HexEdit, again to no avail. What further bothers me is that there might also be extra footers, not just headers. No matter what I do, my project absolutely refuses to load my .mgfxo file.

Exception

I'm getting pretty fed-up with this process. Are there any other tools or methods I can employ? How about loading the file myself and feeding into the CPU myself?


Solution

  • You can actually use the Content Pipeline tool to use your shader directly. Open the tool and either add you .fx directly or create a new one (to ensure everything is good) and then copy paste yours on top of it.