I’m trying to translate some code that was ported from GLSL to Java back into GLSL. The code starts by setting up a few static buffers and in one place has this code:
private static int p[] = {151,160,137,91,90,15, ... };
// To remove the need for index wrapping, double the permutation table length
private static int perm[] = new int[512];
static { for(int i=0; i<512; i++) perm[i]=p[i & 255]; }
I’m trying to figure out if there is a neat way to do the same in GLSL, or if I should just cut and paste two copies of the p
array into perm
. I’ve noticed that this will compile in GLSL, but I don’t know if it is actually giving me an array that is two concatenated copes of p:
const int p[] = {151,160,137,91,90,15,...};
const int perm[] = {p, p};
Edit:
Okay, it looks like const int perm[] = {p, p};
is just creating an array of the addresses. Still, is there a way to concatenate two copies of this array?