Sending thousands of uniforms to a shader. (3.2 -4.0),
Members - Reputation: 149
Posted 13 March 2012 - 06:17 PM
I'm trying to get a lot of light data into a shader to perform deferred lighting.
The lighting system populates the screen with 32*32 tiles, which are drawn instanced onto the screen. Each tile needs to be fed the data for 8 point lights.
I'm struggling to get my head around how to get the data to the shader in GLSL. Currently I have a large UBO with all the tile light arrays in, and can rebind the UBO at the correct data struct for each tile. However, when doing this, I can't use a single instanced call. So thats not fast enough.
Is there any way I can just bind the whole UBO? Trying to define a large array in GLSL (understandably) causes the shader not to link.
I know I can do this relatively easily by packing the data into a texture, but I'd like to know if there is a more intuative way that fits the uniform paradigm.