Share shader code? directx & opengl

Worked windows DirectX. Not working on android OpenGL, no texture appear.

Texture2D _colorTex;
SamplerState linearSampler
{
Filter = LINEAR;
AddressU = CLAMP;
AddressV = CLAMP;
};

float4 MainPS(VS_Out IN) : COLOR
{
float3 color = _colorTex.Sample(linearSampler, IN.UV).rgb;
return float4(color,1.0);
}

It’s Working on android OpenGL, and windows DirectX

Texture2D _colorTex;
SamplerState colorSampler = sampler_state
{
Texture = <_colorTex>;
Filter = LINEAR;
AddressU = CLAMP;
AddressV = CLAMP;
};

float4 MainPS(VS_Out IN) : COLOR
{
float3 color = tex2D(colorSampler, IN.UV).rgb;
return float4(color,1.0);
}

Take a look at the stock effects that are part of monogame (search the whole repo for .fx files) and notice in particular macros.fxh – which is the solution monogame itself uses to having a single unified .fx file which compiles for all platforms.