In my GLSL code, I have large functions being called multiple times.
As an example, inside my perlin noise function I run a hash function many times.
float perlinNoise (...) {
...
float x0y0z0 = pcgUnit3(seedminX,seedminY,seedminZ);
float x0y0z1 = pcgUnit3(seedminX,seedminY,seedmaxZ);
float x0y1z0 = pcgUnit3(seedminX,seedmaxY,seedminZ);
float x0y1z1 = pcgUnit3(seedminX,seedmaxY,seedmaxZ);
float x1y0z0 = pcgUnit3(seedmaxX,seedminY,seedminZ);
float x1y0z1 = pcgUnit3(seedmaxX,seedminY,seedmaxZ);
float x1y1z0 = pcgUnit3(seedmaxX,seedmaxY,seedminZ);
float x1y1z1 = pcgUnit3(seedmaxX,seedmaxY,seedmaxZ);
...
}
In my procedural generation algorithm, I call the perlin noise function multiple times.
I notice that for every time I add a call to the perlin noise function, the compile time for the shaders takes longer. I think the problem is that glsl inlines the function calls, and thereby the shader code becomes very large.
Am I correct about the inlining, and if so, how do I prevent it from happening?