Compile Shader-Effect (fx-File) for iOS

Hi,

I created a MonoGame-Project with a Custom-Pixelshader-Effect. The XNA-Project on Windows works good.
I use the MonoGame-develop branch and so I need to compile the effect file with the newest MonoGame ConentProcessor-Project on Windows. But if I compile my Content-Project to build the xnb-files, it shows an error-message.

Contentoutput: DllNotFoundException … libmojoshader_64.dll … EffectObject.cs line 799

What can I do to compile my Effect-File to a XNB-File for iOS to be compatible with the newest monogame-develop version.

Regards
Ronny

Can you try to compile the 2MGFX tool found in the MonoGame.Windows.sln? That’s the tool that does the dirty work of converting fx to opengl fx. If there is some issue with dlls on the development branch you should be able to run the tool from command line.

Hi, thank you. I ve converted my fx-File with the OpenGL-Flag.
Now, I have a OpenGL-Compatible Shader-File. But I thought that the 2MGFX-Tool
would create a XNB-File.

I don’t know what I have to do now with the converted shader file.

Regards
Ronny

Okay, I can load the Effect with the byte-Array from the mgfx-File.
The Effect was created. But the App shows only a Black screen.
Maybe something is wrong with the effect.

Its a simple gaussianblur effect. I hope anyone could help.
Here is the effect-file-content.

Best Regards
Ronny


#define RADIUS 7
#define KERNEL_SIZE (RADIUS * 2 + 1)

//-----------------------------------------------------------------------------
// Globals.
//-----------------------------------------------------------------------------

float weights[KERNEL_SIZE];
float2 offsets[KERNEL_SIZE];

bool grayscale = false;

//-----------------------------------------------------------------------------
// Textures.
//-----------------------------------------------------------------------------

texture colorMapTexture;

sampler2D colorMap = sampler_state
{
Texture = ;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
};

//-----------------------------------------------------------------------------
// Pixel Shaders.
//-----------------------------------------------------------------------------

float4 PS_GaussianBlur(float2 texCoord : TEXCOORD) : COLOR0
{
float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
for (int i = 0; i < KERNEL_SIZE; ++i) {
color += tex2D(colorMap, texCoord + offsets[i]) * weights[i];
}
if ( grayscale )
color.rgb = dot(color.rgb, float3(0.3, 0.59, 0.11));

return color;

}

//-----------------------------------------------------------------------------
// Techniques.
//-----------------------------------------------------------------------------

technique GaussianBlur
{
pass
{
PixelShader = compile ps_2_0 PS_GaussianBlur();
}
}

:frowning:

Can anyone help?

Regards

The trick with debugging fx files is usually to output plain red color and see if the screen displays red boxes instead of sprites. Then you can add a piece at a time and see what-s not working.