in OpenCL big non fixed size arrays of data are commonly passed as cl_mem objects (unformatted byte buffers within global memory scope) which are seen in the OpenCL kernel as pointers, like traditional C arrays: typeName* varName Thus, accessing a value from this array is simply done by using the operator : typeName a = varName. How about GLSL, specially for compute shaders? In my experience with vertex shaders, I pass generic buffers as texture buffers like
glBufferData(GL_TEXTURE_BUFFER, data_size_in_bytes, data_array, GL_STATIC_DRAW);
glTexBuffer(GL_TEXTURE_BUFFER, GL_DATA_TYPE, tex_Buffer);
and in the shader program I use uniform (TYPE)samplerBuffer varName and fetch values from array with texelFetch. Is that the best way to do it for generic type non fixed size and random read/write access data buffers?
I heard about buffers, instead of samplerBuffer, but it seems to be intended to other usages, since they are more limited in size and not well designed for random access.