I have a shader which I want to have a small (8x vec2) lookup table.
For simplification, I'll use two elements.. (2x vec2)
const vec2 L[2] = vec2[](vec2(0.0, 1.0), vec2(0.0, 2.0));
This doesn't compile:
ERROR: 0:19: 'array of 2-component vector of float' : constructor not
supported for type
ERROR: 0:19: 'array of 2-component vector of float' : no matching
overloaded function found
ERROR: 0:19: 'const 2-component vector of float' : cannot declare
arrays of this type
ERROR: 0:19: 'L' : redefinition
So.. I tried this next:
const float L[4] = float[] (0.0, 1.0, 0.0, 2.0);
This doesnt' compile either:
ERROR: 0:19: 'array of float' : constructor not supported for type
ERROR: 0:19: 'array of float' : no matching overloaded function found
ERROR: 0:19: 'const float' : cannot declare arrays of this type
ERROR: 0:19: 'L' : redefinition
I copied a declaration from what appears to be the GLSL reference
documentation (section 5.4.4 of http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.20.8.pdf).
const float c[3] = float[3](5.0, 7.2, 1.1);
const float d[3] = float[](5.0, 7.2, 1.1);
Neither of these compiled either:
ERROR: 0:19: 'array of float' : constructor not supported for type
ERROR: 0:19: 'array of float' : no matching overloaded function found
ERROR: 0:19: 'const float' : cannot declare arrays of this type
ERROR: 0:19: 'c' : redefinition
ERROR: 0:20: 'array of float' : constructor not supported for type
ERROR: 0:20: 'array of float' : no matching overloaded function found
ERROR: 0:20: 'const float' : cannot declare arrays of this type
ERROR: 0:20: 'd' : redefinition
What is going on here?
The shader is running at #version 120.
Is someone else able to test and confirm this behaviour?
NVIDIA GeForce 8600M GT OpenGL Engine 2.0 NVIDIA-1.5.26
Running on Mac OS X 10.5.2
Should I be using a texture lookup for this instead? It seems a bit
stupid for such a small amount of data...
Regards,
Samuel
So.... the spec is correct, but it isn't implemented as far as I can
tell.
If anyone else is able to test and let me know, please do.
Regards,
Samuel