How can I make this 2D light shader run faster?

This is something of an aside, but I notice in your original shader that you use an array of float3 to pass in the light data. I’m curious, were you able to make it work with both DirectX and OpenGL? There is ( or was ) a bug involving passing in certain arrays, and I was wondering what your C# looked like if you were able to successfully pass in the array.

I didn’t know it was a bug until now, but I did notice that presetting the value was not working, so I manually set the float3 values every draw frame like this:

_lightEffect.Parameters[“Intensity”].SetValue(new Vector3(0.8f, 0.8f, 0.8f));

I am also using MG 3.6, though. So I don’t know if that makes a difference too or not.

I think the bug only affects arrays, but I’m still working to figure out shaders myself. What is the code you used to set the Lights variable in the first version?

float3 Lights[64];

From Microsoft.Xna.Framework.Graphics: public void SetValue(Vector3[] value);
so something similar to
Vector3[] lights = …array of lights…
_lightEffect.Parameters[“Lights”].SetValue(lights);