• Advertisement
Sign in to follow this  

GLSL struct of array takes more memory

This topic is 908 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey every body,
i'm in the middle of implementing tiled deferred rendering in the fragment shader, but i keep getting a gpu program link error like this:

error(#468) Link error : the number of uniform symbols exceeds the maximum of system defined.

this is the uniform buffer i'm using in the fragment shader.


layout (std140, binding = 4) LightTilesBlock {
uvec4 au4LightIndices[8*400];
} u_lightTiles;

i manually calculate it's size and i found that it's 51200 bytes please correct me if i'm wrong.

GL_MAX_UNIFORM_BLOCK_SIZE return the following 65536

and the same problem even with a vec4 not a problem with 1024 mat4 in the vertex shader.

 

Share this post


Link to post
Share on other sites
Advertisement

You're right, it should work. Are you sure it's complaining because of that piece of code?

Something I see likely is the compiler getting confused due to [8*400]. Try writing 3200 instead.

Share this post


Link to post
Share on other sites

Sorry, im a noob with GLSL, but is 'uniform' required in this line?

 

layout (std140, binding = 4) LightTilesBlock {

maybe should be...

layout (std140, binding = 4) uniform LightTilesBlock {

 

and if not, maybe this helps...

https://www.opengl.org/discussion_boards/showthread.php/184654-Using-Uniform-Buffer-Objects-%28UBO%29-in-Fragment-Shaders

 

sorry if all this is bs, i'm learning myself and did some seaching for my own amusment.

Share this post


Link to post
Share on other sites
Matias Goldberg

i did tried that, and not working.

 

fleabay

that's  right, but this is not the syntax i'm using my engine to declare a uniform buffer i have just write that here, what i use is "UniformBlock LightTilesBlock" instead of "layout (std140, binding = 4) uniform", thanks for pointing this out though.

Share this post


Link to post
Share on other sites

Alright, i did a find the root problem,

in my engine i'm using a "layout(location = x) uniform" and  generate the locations based on the names of those uniforms based on a table, now, for some reason that i don't now, the shader cannot use a uniform buffer of such a size, so all i did was to remove that mechanism and let opengl decide the locations.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement