WebGL 1 doesn't seem to have support for the flat modifier.
As a result, how do I avoid duplicating a ton of data when sending data to the vertex shader?
For example, in my use-case I have many lights to render (which are just a bunch of triangles clipped by a circular radius). So let's say each light point has a radius, tint, and center. If I were to do separate draw calls, this is trivial, as I can pass things like tint and radius as uniforms.
However, let's say I wanted to render all of my lights in one draw call. My intuition is that I would have to load the vertex buffer like so:
Triangle Points Attribute: X1, Y1, X2, Y2, X3, Y3, ...
Radius Attribute: 100, 100, 100, 100, 100, 100, ...
Center Attribute: X1, Y1, X1, Y1, X1, Y1, ...
Tint Attribute: 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, ...
This is because varyings are naturally interpolated, so unless I duplicate them, the attribute values will be interpolated from triangle to triangle, when in reality I desire they just stay static and unchanging, like a uniform. But they can't be a uniform because different light points have different radiuses, centers, tints, etc. As you can see, in the above, the only non-duplicated data are the triangle points. Everything else is just repeated over and over.
I suppose an alternative is to just have a separate draw call for each light point, but I'm not sure which is "better" practice. If I have separate draw calls, then I avoid duplicating data, but then I have to iterate through static every light in the game and redraw them all separately.
Ideally there would be a way to just pass attributes as non-varying so that I could avoid having to duplicate all this data, but I'm not sure how to do that. Is that possible?