I've just begun implementing some lighting-models in hlsl, but i just can't figure out how to solve the arbitrary-sized light-vectors...
[source lang = "cpp"]
struct PointLight
{
float4 position;
float4 ambient, diffuse, specular;
float roloff, range;
float att0, att2, att4;
};
int iNumActivePointLights : PointLights;
PointLight MyArbitrarySizedArrayOfPointLights[???] : PointLight;
I sure could pre-allocate a constant max-available lights like this
[source lang = "cpp"]
PointLight MyArbitrarySizedArrayOfPointLights[255] : PointLight;
but that is not that wise, because the hlsl-compiler requires a whole lot of constant registers during the compilation and even though my app requires 1 active lightsource at the moment, i can't compile this with ps_1_1 target so my question is if there is any way to dynamically allocate arrays in a shader?
edit: omg, the gibberish :)