Wow, I didn't know about the limitation with dynamic indexing! There is so much I still don't know.

I am implementing my own multiple point light shader and I was wondering If I write permutations for every single number of point lights (up to a reasonable limit) and then use only constant indexing, can I overcome the generation of the hidden "if" statements? Basically figure out how many point lights are affecting the object, and render it using the appropriate shader.

Also, if instead of creating a new output variable in the vertex shader like this:

void VS_MainNM(in float3 inPos : POSITION,
in float2 inTexCoord : TEXCOORD,
in float3 inNormal : NORMAL,
in float3 inTangent : TANGENT,
....
out float3 outPoint1Dir : TEXCOORD5,
out float3 outPoint2Dir : TEXCOORD6,
out float3 outPoint3Dir : TEXCOORD7,
out float3 outPoint4Dir : TEXCOORD8

I was thinking I could use and array:

void VS_MainNM(in float3 inPos : POSITION,
in float2 inTexCoord : TEXCOORD,
in float3 inNormal : NORMAL,
in float3 inTangent : TANGENT,
...
out float3 outPointDir[4] : TEXCOORD5

I tried out the shader and it works. But my question is will I be able to avoid the hidden "if"s if in the pixel shader I am always using constant indexes, like inPointDir[2] and never int i = 2; inPoint1Dir[i]?