I attempt to use the image load/store function.I need several images,and if they are indexed ,it's convienient for coding,so I want to use the image2DArray uniform.But it seems that only the first layer of the image2DArray works.In another word, the iimage2DArray perform like an iimage.

the fragment shader(only used by fs):

Code :
#version 420                                                                                                                                                    
coherent uniform layout(r32i) iimage2DArray sigmal;                                                                       
out vec4 FragColor;                                                                                                                                                 
void main()                                                                       
{                                                                               
    ivec2 coord = ivec2(gl_FragCoord.xy);
    int increment=100;
    int v=imageAtomicAdd(sigmal,ivec3(coord,**1**),increment);  //the promlem is that it seems 
                                                            //the coordinate z has no influence
    FragColor =vec4(coord/screenSize,v/1000.0f,1);
 
}
the c++ code: binding:
Code :
glGenTextures(1,&image);
glBindTexture(GL_TEXTURE_2D_ARRAY,image);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB,0);
//Allocate the storage.
glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_R32I, width, height, layerCount);
 
glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, width, height, layerCount, GL_RED_INTEGER, GL_INT, clearData);     //
 
glBindImageTexture(0, image, 0, GL_TRUE, 0, GL_READ_WRITE, GL_R32I);
 
//Always set reasonable texture parameters
glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
render:

Code :
glBindTexture(GL_TEXTURE_2D_ARRAY,image);
shader.use();
shader.setUniform("sigmal",0);
glBindVertexArray(vao);
glDrawArrays(GL_TRIANGLES, 0, 6);
shader.unuse();
glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT);
int *data=new int[viewport[2]*viewport[3]*layerCount];
glBindTexture(GL_TEXTURE_2D_ARRAY,image);
glBindBuffer(GL_PIXEL_PACK_BUFFER_ARB,0);
glGetTexImage(GL_TEXTURE_2D_ARRAY, 0 , GL_RED_INTEGER, GL_INT,data );
printf("%d %d\n",data[0],data[viewport[2]*viewport[3]]);
The printf result is data[0] which I think is the first texel of the first layer increase frame by frame,whereas,data[viewport[2]*viewport[3]] which I think is the first texel of the second layer doesn't change.I think the reasonable result is opposite.