gallivm: use common code to select texel type