Validation of my "How to compile custom effect"

Hello Mono community :),
I’v been fighting few days with Custom effect .fx file and MonoGame.

My Specs:
Windows 7, VS 2012, Target platform: Windows, Project type WindowsGL
Monogame completelly compiled from Source (since last week), also with compiled tools, 2mgfx, and so on.

My content processing works properly for all types except .fx files. What I don’t understand, is following:
Test Case:
1.======================
Fx File:
VertexShader = compile vs_2_0 VertexShaderFunction();
PixelShader = compile ps_2_0 PixelShaderFunction();

Content processor: Effect - XNA Framework
Compiled successfully, Cannot be loaded with Content.Load:
This does not appear to be a MonoGame MGFX file!

2.======================
Fx File:
VertexShader = compile vs_2_0 VertexShaderFunction();
PixelShader = compile ps_2_0 PixelShaderFunction();

Content processor: MonoGame Effect
Compiled with errors::
Building content threw DllNotFoundException: Unable to load DLL ‘libmojoshader_64.dll’: The specified module could not be found.

I assume that PS and VS version 2_0 will head to errors when I now correct location for mojoshader

3.======================
Fx File:
VertexShader = compile vs_2_0 VertexShaderFunction();
PixelShader = compile ps_2_0 PixelShaderFunction();

Compiled via:
2MGFX.exe terrain.fx terrain.fxg /Profile:OpenGL
Compiled successfully, Cannot be loaded with Content.Load:
This MGFX effect was built for a different platform!

4.======================
Fx File:
VertexShader = compile vs_4_0_level_9_1 VertexShaderFunction();
PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();

Compiled via:
2MGFX.exe terrain.fx terrain.fxg /Profile:OpenGL
Compiled with Errors
error X3523: DX9-style intrinsics

5.======================
Fx File:
VertexShader = compile vs_4_0_level_9_1 VertexShaderFunction();
PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();

Compiled via:
2MGFX.exe terrain.fx terrain.fxg /Profile:DirectX_11
Compiled successfully and successfully loaded !

My Questions:
Step 5: Why, If my project is set to OpenGL Windows, I had to compile effect with DirectX_11 2mgfx profile ?
Step 2: Where (in which directory of project Game or ContentBuilder or Content) should I put libmojoshader_64.dll ?

Thank you very much for clearing it for me.

1 Like