Need help with FX file

Hello,

I’m trying to use a FX file from my old XNA project. The 2mgfx tool is throwing the following error: “Unable to load DLL ‘libmojoshader_64.dll’: the specified module could not be found.”

I’m running Windows 7 64-bit.

Here are my command line arguments:

2mgfx colorswap.fx colorswap.mgfx /profile:OpenGL

And here are the contents of the colorswap.fx file:

sampler2D input : register(s0);
bool UseDefaultPalette = true;
float4 FromColor1 : register(C0);
float4 FromColor2 : register(C1);
float4 FromColor3 : register(C2);
float4 FromColor4 : register(C3);
float4 ToColor1 : register(C4);
float4 ToColor2 : register(C5);
float4 ToColor3 : register(C6);
float4 ToColor4 : register(C7);

float4 CurrentColor1;
float4 CurrentColor2;
float4 CurrentColor3;
float4 CurrentColor4;

float4 main(float2 uv : TEXCOORD) : COLOR 
{ 
    float4 Color; 
    Color= tex2D(input , uv.xy); 

	if (!UseDefaultPalette)
	{
		if (Color.r == FromColor1.r && Color.g == FromColor1.g && Color.b == FromColor1.b)
			return ToColor1;
		else if (Color.r == FromColor2.r && Color.g == FromColor2.g && Color.b == FromColor2.b)
			return ToColor2;
		else if (Color.r == FromColor3.r && Color.g == FromColor3.g && Color.b == FromColor3.b)
			return ToColor3;
		else if (Color.r == FromColor4.r && Color.g == FromColor4.g && Color.b == FromColor4.b)
			return ToColor4;
	}

    return Color;
}

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

bump.

Any ideas on this? I’ve tried several different approaches to getting an fx file working in MonoGame, but I keep hitting a dead-end. If I use the existing xnb files from XNA, I get a runtime error of “This does not appear to be a MonoGame MGFX file!” and if I add the fx file using the MonoGame Pipeline tool, I get a build error of “Unable to load DLL ‘libmojoshader_64.dll’: the specified module could not be found.”

I’m running Windows 7 64-bit. Any advice or workarounds would be much appreciated.

Thanks!

How have you built/installed monogame?

procd - I’ve installed MonoGame 3.4 for Visual Studio. I’m able to build and run a MonoGame Windows project from Visual Studio, but 2mgfx is not able to see libmojoshader_64.dll, even though it’s in the same folder as 2mgfx.exe.

*NOTE: I had a similar issue with the FreeImage DLL and installing this was the fix:

Visual C++ Redistributable for Visual Studio 2012 Update 4
http://www.microsoft.com/en-NZ/download/details.aspx?id=30679

I’ve made progress, but now I’m getting a different error. Originally, I had only run the MonoGame 3.4 installer, but now I’ve pulled down the MonoGame project from git, per these instructions: http://www.monogame.net/documentation/?page=Setting_Up_MonoGame_Source

The 2mgfx project builds successfully, but when I try running the tool I get the following error:

Unable to load DLL ‘d3dcompiler_47.dll’: The specified module could not be found.

It looks like other’s have run into this issue as well: MonoGameTests errors regarding 'd3dcompiler_47.dll' · Issue #4131 · MonoGame/MonoGame · GitHub

I tried installing the latest DirectX runtime, but the error persists.

Please help…I’m really excited to port my XNA game to MonoGame, but I need to tackle the basics (like shaders) first.

Sorry but can’t really help you any further. Seems VS 2015 is a bit broken Cannot build MonoGame.Framework.Windows and may be related to your problem. All I can suggest is using something like ILSpy and trying to see where it thinks the dll’s are.

@Tom, I’ve read several posts where you’ve been able to help others on this. Any ideas?

Bump.

I forced a DirectX install, which fixed the d3dcompiler error, but I’m now getting a different error:

“Unable to load DLL ‘libmojoshader_64.dll’: The specified module could not be found.”

This happens both in the Pipeline app and when running 2mgfx.exe from the command line, using /Profile:OpenGL.

I have verified that the libmojoshader_64.dll exists in the 2mgfx.exe folder.

Any ideas? @Tom?

Thanks again