Slow compile with large fixed-size arrays in SSBO

Hi,

when using large arrays with fixed size, the GLSL compiler will hang on glLinkProgram.

layout(binding = 0) restrict buffer Buf {
uint array;
};

works fine, but for example
layout(binding = 0) restrict buffer Buf {
uint array[1 << 26];
};

will compile for ages (I’m not sure if it compiles at all as i never witnessed it finishing)

Is this expected behaviour? The reason I want to use fixed size arrays is that I want to place multiple large arrays in one large buffer. While this still is possible using unsized arrays and layout(offset = ???) declarations per array, it is highly inconvenient. What is the best way to
manage several large arrays in SSBO?

1 Like

This is still a problem four years later - is there no solution in sight?

I can’t use multiple bindings with dynamic arrays as I have more arrays than the maximum number of bindings allowed (96).

I can’t use images as I have arrays of structures which need to match the CPU versions.

No individual array is particularly huge, but in total they can add up to several hundred MB.

Still an issue all these years later, bump.

On an RTX 3060, compiling a shader that contains a static 128MB SSBO (openGL 4.3) takes nearly a minute. Same story on an RTX 2060 mobile. I also tested on an RX 580 and Vega64, compiles in less than 5 seconds. The AMD compile times are basically constant for the SSBO size, while the Nvidia compile times seem to get even worse with larger SSBO sizes.

Also, the systems with Nvidia GPUs use a significant amount of system RAM during compilation, in excess of 1GB. Then, while compiling on AMD never even gets past 200MB. Once compiled the application itself doesnt exceed 200MB on either system.

Pretty sure this is a driver bug. A very old one too…

1 Like

Yes.
In addition, GLSL does not support reference type. That excludes the possibility to write functions referring to data.
Because of this problems since 2011, GLSL is still not suitable for General purpose computing.
I use OpenCL with a small overhead on pixel transfer from OpenCL to OpenGL