I've implemented a sprite batch class that uses a sampler array so that I can select a texture to use based on the gl_PrimitiveID. The idea was to be able to draw sprites that use different textures in a single draw call. I've managed to get it to compile the shaders and run, but the sampler indexing part does not seem to work, although I did not get any OpenGL error. I've done a bit of research and found out that it doesn't seem possible to index into a sampler array with an index that is not a compile-time constant or uniform variable.
Am I doing something wrong or is building a texture atlas the only way to draw sprites that use different textures at once?