Maybe this is because of the old hardware but there are two issues when compiling the fragment shader on linux:
texSlot is not properly converted to an integer. Here is an ugly workaround:
#version 330 core
in vec2 texCoord;
in vec4 spriteColor;
in float texSlot;
uniform sampler2D u_Textures[32];
out vec4 fragColor;
void main()
{
switch(int(texSlot))
{
case 0: fragColor = spriteColor * texture(u_Textures[0], texCoord); break;
case 1: fragColor = spriteColor * texture(u_Textures[1], texCoord); break;
case 2: fragColor = spriteColor * texture(u_Textures[2], texCoord); break;
case 3: fragColor = spriteColor * texture(u_Textures[3], texCoord); break;
case 4: fragColor = spriteColor * texture(u_Textures[4], texCoord); break;
case 5: fragColor = spriteColor * texture(u_Textures[5], texCoord); break;
case 6: fragColor = spriteColor * texture(u_Textures[6], texCoord); break;
case 7: fragColor = spriteColor * texture(u_Textures[7], texCoord); break;
case 8: fragColor = spriteColor * texture(u_Textures[8], texCoord); break;
case 9: fragColor = spriteColor * texture(u_Textures[9], texCoord); break;
case 10: fragColor = spriteColor * texture(u_Textures[10], texCoord); break;
case 11: fragColor = spriteColor * texture(u_Textures[11], texCoord); break;
case 12: fragColor = spriteColor * texture(u_Textures[12], texCoord); break;
case 13: fragColor = spriteColor * texture(u_Textures[13], texCoord); break;
case 14: fragColor = spriteColor * texture(u_Textures[14], texCoord); break;
case 15: fragColor = spriteColor * texture(u_Textures[15], texCoord); break;
case 16: fragColor = spriteColor * texture(u_Textures[16], texCoord); break;
case 17: fragColor = spriteColor * texture(u_Textures[17], texCoord); break;
case 18: fragColor = spriteColor * texture(u_Textures[18], texCoord); break;
case 19: fragColor = spriteColor * texture(u_Textures[19], texCoord); break;
case 20: fragColor = spriteColor * texture(u_Textures[20], texCoord); break;
case 21: fragColor = spriteColor * texture(u_Textures[21], texCoord); break;
case 22: fragColor = spriteColor * texture(u_Textures[22], texCoord); break;
case 23: fragColor = spriteColor * texture(u_Textures[23], texCoord); break;
case 24: fragColor = spriteColor * texture(u_Textures[24], texCoord); break;
case 25: fragColor = spriteColor * texture(u_Textures[25], texCoord); break;
case 26: fragColor = spriteColor * texture(u_Textures[26], texCoord); break;
case 27: fragColor = spriteColor * texture(u_Textures[27], texCoord); break;
case 28: fragColor = spriteColor * texture(u_Textures[28], texCoord); break;
case 29: fragColor = spriteColor * texture(u_Textures[29], texCoord); break;
case 30: fragColor = spriteColor * texture(u_Textures[30], texCoord); break;
case 31: fragColor = spriteColor * texture(u_Textures[31], texCoord); break;
}
}
Hardware max texture slots is 16. The fact that we're creating a uniform sampler2D u_Textures[32];
makes the compilation to fail.
Either we need to make a separated shader for Linux with a limited number of textures slots (and limit it in the Painter
as well). Or find a workaround.