ATI Shader Compilation

Hi All,

Im using ATI Radeon 4870.

I have written a shader (GLSL) which looks something like this

void main()
{
float wi[5] = float[5]( 0.01 , 0.02 , 0.03 , 0.04 , 0.05 );
int i;
int j;
for( i = -2; i <= 2; i++ )
{
for( j = -2; j <= 2; j++ )
{
weight = w[i+2] * w[j+2];


}
}


gl_FragData[ 0 ] = vec3( 1, 0 , 0 1 );
}

when the above shader is compiled on ATI graphics card I am getting the following error

Not supported when use temporary array indirect index.
Not supported when use temporary array indirect index.

for the line --> weight = w[i+2] * w[j+2];

The same line compiles fine on nVidia Card for opengl and d3d9 but on ATI, the d3d9 is fine but not the opengl.

your help is very much appreciated.

thx

Chidu

Try with laster ATI driver version. What is your current version by the way ?

Driver Packaging Version 8.552-081028a-070229C-ATI
Catalyst® Version 08.11
Provider ATI Technologies Inc.
2D Driver Version 7.01.01.838
2D Driver File Path /REGISTRY/MACHINE/SYSTEM/ControlSet001/Control/Class/{4D36E968-E325-11CE-BFC1-08002BE10318}/0000
Direct3D Version 7.14.10.0621
OpenGL Version 6.14.10.8201
Catalyst® Control Center Version 2008.1028.2134.36851

I believe I am using the latest, I downloaded all the lastest package from ATI yesterday

As far as I know, in glsl 1.2 you have to use direct array indexing (ie, put a constant value as array index). Sometimes use a variable as an array index would compile if the compiler can unroll the loop, otherwise it won’t.
I don’t know if in glsl 1.3 it is still the case and of your card support it.
On nvidia cards, this works because the compiler choose a special profile that allows indirect indexing.