pan/mdg: Refactor texture op/mode handling