gallivm/nir: refactor image operations for indirect support.