glsl: Rework lowering of non-constant array indexing