#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect tex;
const float index[16] = float[16](0.0, 7.0, -1.0, 6.0, -2.0, 5.0, -3.0, 4.0, -4.0, 3.0, -5.0, 2.0, -6.0, 1.0, -7.0, 0.0);
void main() {
vec2 texcoord = gl_TexCoord[0].xy;
ivec2 blockpos = ivec2(texcoord) & ivec2(15,15);
vec2 offset = vec2(index[(blockpos.x)],index[(blockpos.y)]);
gl_FragColor = texture2DRect(tex, texcoord + offset );
}
GL_VERSION: 2.1.8575
GL_SHADING_LANGUAGE_VERSION: 1.20
GL_RENDERER: ATI Mobility Radeon HD 2600
Compiler error: unexpected operator for indirect index
If i remove the “const” it compiles but then index[n] is always zero.
It works with “uniform” instead of “const” but i have to initialize the array from the c code.
It works declared inside the main() function (not as const), but it is initialized for each pixel processed (?).
Is the external const declaration working on nvidia ?
Should I say “ATI sucks” again ?..