PDA

View Full Version : GLSL: out array size too large?



paul_g_griffiths
02-22-2017, 09:05 AM
I'm trying to use this:

out vec3 TangentLightPos[48];

the shader compiler is saying it's too large.

How do I get around this?

Should I be using Buffer Objects?

It's for parallax self shadowing with multiple lights, I have fixed my parallax, normal mapping & shadows in my portals based engine but need parallax self shadowing too:

https://s4.postimg.org/lcloc8lwt/parallax4.jpg

https://s8.postimg.org/lf522v9md/parallax3.jpg

https://s32.postimg.org/vypvt4iyt/parallax2.jpg

https://s23.postimg.org/azpimp3p7/parallax.jpg

john_connor
02-22-2017, 12:07 PM
I'm trying to use this:

out vec3 TangentLightPos[48];

the shader compiler is saying it's too large.

How do I get around this?

Should I be using Buffer Objects?

in what shaderstage is that ?
if you want to pass these values from the vertex / tesselation / geometry shader to the fragmentshader, you could you "transform feedback" to capture the data into a buffer object

using a computeshader would be another option

paul_g_griffiths
02-22-2017, 12:28 PM
From fragment to vertex shader.

I have had a quick look at both "transform feedback" & "computeshader" and both seem an overkill for such a simple task.

If I create a bufferobject can I simply update it and the vertex shader can then use these values?

john_connor
02-22-2017, 12:59 PM
From fragment to vertex shader.

the other way around ? or are you using deferred shading ?



I have had a quick look at both "transform feedback" & "computeshader" and both seem an overkill for such a simple task.

If I create a bufferobject can I simply update it and the vertex shader can then use these values?

i think thats not possible as long as you read form that buffer, you cannot read from and write to 1 buffer at the same time. maybe a double-buffered system (so-called "buffer pingpong-ing") could help

paul_g_griffiths
02-22-2017, 01:15 PM
Yes, the other way around, oops.

Thanks , I been search google and came up with storage buffer objects:


layout(std430, binding = 0) buffer ssbo
{
vec3 TangentLightPos[];
};

set easely like:


for (int i = 0; i < totalLights; i++)
TangentLightPos[i] = TBN * lights[i].Position;

Think this is the way to go as I'm using opengl 4.3 anyways.

Ill also start using uniform buffers so I can increase my lights and speed things up a little as have a lot of lights and portals.