Split up set_uniform into 3 functions to reduce overhead.