I have been at this awhile and I have done my best to research before asking for help. I have working Shaders/Effects from many projects, but when I tried to get them to work in the iOS version (though it is also the first 3.8 project I have made) at first they wouldnt compile at all, I fixed that issues earlier today…
Now after I have them compiling, I add them to the project, and run it. From there the program errors while loading the Effect with the error:
‘This MGFX effect is for an older release of MonoGame and needs to be rebuilt.’
I have update my .net core, I am compiling via the MGCB that is in the project, and yet still the error above…
What am I missing? Please help!
My file is below (I have been cutting it down to its basics all day so plz dont judge)
#if OPENGL
#define SV_POSITION POSITION
#define VS_SHADERMODEL vs_3_0
#define PS_SHADERMODEL ps_3_0
#else
#define VS_SHADERMODEL vs_4_0_level_9_1
#define PS_SHADERMODEL ps_4_0_level_9_1
#endif
// Our texture sampler
float xSize;
float ySize;
float xDraw;
float yDraw;
float4 filterColor;
Texture2D Texture;
sampler TextureSampler = sampler_state
{
Texture = <Texture>;
};
// This data comes from the sprite batch vertex shader
struct VertexShaderOutput
{
float4 Position : SV_POSITION;
float4 Color : COLOR0;
float2 TextureCordinate : TEXCOORD0;
};
// Our pixel shader
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
//float4 texColor = tex2D(TextureSampler, input.TextureCordinate);
float4 texColor = Texture.Sample(TextureSampler, input.TextureCordinate);
//result += tex2D(Sampler, float2(uv.x + offsets[x], uv.y)) * weights[x];
//result += Texture0.Sample(Sampler, float2(uv.x + offsets[x], uv.y)) * weights[x];
float vertPixSize = 1.0f/ySize;
float horPixSize = 1.0f/xSize;
float texMult = 5.0f;
float4 color;
if(xDraw/xSize < .6f || yDraw/ySize < .6f)
{
if(xDraw/xSize < .4f || yDraw/ySize < .3f)
{
vertPixSize = 2.0f/ySize;
horPixSize = 2.0f/xSize;
texMult = 6.0f;
}
float4 aboveColor = Texture.Sample(TextureSampler, (input.TextureCordinate) + float2(0, -vertPixSize));
float4 belowColor = Texture.Sample(TextureSampler, (input.TextureCordinate) + float2(0, vertPixSize));
float4 leftColor = Texture.Sample(TextureSampler, (input.TextureCordinate) + float2(-horPixSize, 0));
float4 rightColor = Texture.Sample(TextureSampler, (input.TextureCordinate) + float2(horPixSize, 0));
//float greyscaleAverage = (texColor.r + texColor.g + texColor.b)/3;
color = float4((texColor.r * texMult + aboveColor.r/4 + belowColor.r/4 + leftColor.r/4 + rightColor.r/4)/(1.0f+texMult),
(texColor.g * texMult + aboveColor.g / 4 + belowColor.g / 4 + leftColor.g / 4 + rightColor.g / 4) / (1.0f + texMult),
(texColor.b * texMult + aboveColor.b / 4 + belowColor.b / 4 + leftColor.b / 4 + rightColor.b / 4) / (1.0f + texMult),
(texColor.a + aboveColor.a + belowColor.a + leftColor.a + rightColor.a)/5.0f);
}
else
{
color = float4(texColor.r, texColor.g, texColor.b, texColor.a);
}
return color * filterColor * input.Color;
}
// Compile our shader
technique Technique1
{
pass Pass1
{
PixelShader = compile PS_SHADERMODEL PixelShaderFunction();
}
}
and i call it the same as I always have in C#:
effect = content.Load<Effect>(EFFECTPATH);