Trouble Reading MGFX Float Array

Hello there,

It seems that when I try to access a float array declared inside of an effect file, the value returned is always 1 or 0. Here I have a simple cel shading technique inside of my pixel shader:

float ToonBrightnessLevels[3] = { 1.3f, 0.9f, 0.4f };

float4 PSToon(ToonVSOutput pin) : SV_Target0
float4 color = SAMPLE_TEXTURE(Texture, pin.TexCoord);
float3 lightDir = normalize(lightPos - pin.worldPos);
float light = saturate(dot(pin.normal, lightDir));
light *= 1 - pow(saturate(distance(lightPos, pin.worldPos) / 300), 2);
if (light > .8f)
    light = ToonBrightnessLevels[0];
else if (light > .4f)
    light = ToonBrightnessLevels[1];
    light = ToonBrightnessLevels[2];
color.rgb *= light;
return color;

When I draw a model with this, the color is either fully lit up, or completely black. After messing around with it, I’ve found that “ToonBrightnessLevels[1]” always returns 0. if I manually write in the values instead of accessing the array, the texture shows up correctly. I’m not changing the array outside of the shader, just using its initial values. Is this an MGFX bug, or am I missing something?

After playing with it for a while, I found out that declaring variables without using the register keyword doesn’t seem to work. If I declare variables with it, like so:

float3 lightPosition : register(vs, c0);

It works as expected.