draw: move some pipeline-specific code & state to draw_pipe.[ch]