If you declare a global array in a shader and access it via a pixel shader it will always return 0 regardless of the actual value stored.
If anyone knows any workarounds please let me know. Here is an example of the issue.
float test = 1;
float test2[2] = { 0.5, 1 };
float4 PixelShaderFunction(float4 position : SV_Position, float4 c : COLOR0, float2 uv : TEXCOORD0) : COLOR
{
return float4(test, 0, 0, 1); //This returns red (1,0,0,1)
return float4(test2[0], 0, 0, 1); //This returns black (0,0,0,1) , I would expect dark red
return float4(test2[1], 0, 0, 1); //This returns black (0,0,0,1) , I would expect red
}
It is a major pain when converting shaders to monogame.
I have tried changing the shader flags, and have tried using the uniform keyword.